1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-23 21:15:49 +02:00

Rewrite font size handling

This commit is contained in:
chylex 2016-04-24 14:10:29 +02:00
parent 82a1e17b1d
commit b2892cc834
3 changed files with 9 additions and 20 deletions

View File

@ -71,14 +71,15 @@ public void ShowNotification(TweetNotification notification){
}
}
public void ShowNotificationForSettings(bool resetAnimation){
public void ShowNotificationForSettings(bool reset){
if (browser.Address == "about:blank"){
browser.Load("about:blank"); // required, otherwise shit breaks
browser.LoadHtml(TweetNotification.ExampleTweet.GenerateHtml(),"http://tweetdeck.twitter.com/");
resetAnimation = true;
reset = true;
}
if (reset){
browser.LoadHtml(TweetNotification.ExampleTweet.GenerateHtml(),"http://tweetdeck.twitter.com/");
if (resetAnimation){
totalTime = timeLeft = TweetNotification.ExampleTweet.GetDisplayDuration(Program.UserConfig.NotificationDuration);
timerProgress.Start();
}

View File

@ -70,7 +70,7 @@ public int GetDisplayDuration(Duration modifier){
public string GenerateHtml(){
StringBuilder build = new StringBuilder();
build.Append("<!DOCTYPE html>");
build.Append("<html class='os-windows ").Append(FontSizeClass).Append("'>");
build.Append("<html class='os-windows txt-base-").Append(FontSizeClass).Append("'>");
build.Append("<head>").Append(HeadTag).Append("</head>");
build.Append("<body class='hearty'><div class='app-columns-container'><div class='column' style='width:100%'>");
build.Append(html);

View File

@ -9,11 +9,6 @@
//
var isInitialized = false;
//
// Variable: Previous font size class in the <html> tag.
//
var prevFontSizeClass;
//
// Function: Initializes TweetD*ck events. Called after the website app is loaded.
//
@ -67,6 +62,7 @@
};
// Finish init
$TD.loadFontSizeClass(TD.settings.getFontSize());
isInitialized = true;
};
@ -192,16 +188,8 @@
//
// Block: Observe changes in <html> class to update font size.
//
new MutationObserver(function(mutations){
var fsClass = getFontSizeClass();
if (fsClass != prevFontSizeClass){
prevFontSizeClass = fsClass;
$TD.loadFontSizeClass(fsClass);
}
}).observe(document.documentElement,{
attributes: true,
attributeFilter: [ "class" ]
TD.settings.setFontSize = extendFunction(TD.settings.setFontSize,function(name){
$TD.loadFontSizeClass(name);
});
//