mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-02 20:34:07 +02:00
Rewrite theme change handling
This commit is contained in:
parent
acc9b58660
commit
c138b13d01
@ -63,6 +63,8 @@
|
|||||||
|
|
||||||
// Finish init
|
// Finish init
|
||||||
$TD.loadFontSizeClass(TD.settings.getFontSize());
|
$TD.loadFontSizeClass(TD.settings.getFontSize());
|
||||||
|
$TD.loadNotificationHeadContents(getNotificationHeadContents());
|
||||||
|
|
||||||
isInitialized = true;
|
isInitialized = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -173,24 +175,18 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Observe changes in <html> class to update font size.
|
// Block: Hook into settings object to detect when the settings change.
|
||||||
//
|
//
|
||||||
TD.settings.setFontSize = extendFunction(TD.settings.setFontSize,function(name){
|
TD.settings.setFontSize = extendFunction(TD.settings.setFontSize,function(name){
|
||||||
$TD.loadFontSizeClass(name);
|
$TD.loadFontSizeClass(name);
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
TD.settings.setTheme = extendFunction(TD.settings.setTheme,function(){
|
||||||
// Block: Observe stylesheet swapping.
|
setTimeout(function(){
|
||||||
//
|
$TD.loadNotificationHeadContents(getNotificationHeadContents());
|
||||||
new MutationObserver(function(mutations){
|
},0);
|
||||||
$TD.loadNotificationHeadContents(getNotificationHeadContents());
|
|
||||||
}).observe(document.head.querySelector("[http-equiv='Default-Style']"),{
|
|
||||||
attributes: true,
|
|
||||||
attributeFilter: [ "content" ]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$TD.loadNotificationHeadContents(getNotificationHeadContents());
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Hook into links to bypass default open function
|
// Block: Hook into links to bypass default open function
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user