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

Fix background color & twitter.com hooks not applying quickly enough sometimes

This commit is contained in:
chylex 2018-02-28 02:34:29 +01:00
parent 1f92d5e633
commit 8134843dad
3 changed files with 10 additions and 8 deletions

View File

@ -118,14 +118,18 @@ private void browser_LoadingStateChanged(object sender, LoadingStateChangedEvent
}
private void browser_FrameLoadStart(object sender, FrameLoadStartEventArgs e){
if (e.Frame.IsMain){
IFrame frame = e.Frame;
if (frame.IsMain){
if (Program.UserConfig.ZoomLevel != 100){
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Program.UserConfig.ZoomLevel);
}
if (TwitterUtils.IsTwitterWebsite(e.Frame)){
ScriptLoader.ExecuteFile(e.Frame, "twitter.js");
if (TwitterUtils.IsTwitterWebsite(frame)){
ScriptLoader.ExecuteFile(frame, "twitter.js");
}
frame.ExecuteJavaScriptAsync(TwitterUtils.BackgroundColorOverride);
}
}
@ -133,8 +137,6 @@ private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
IFrame frame = e.Frame;
if (frame.IsMain && TwitterUtils.IsTweetDeckWebsite(frame)){
frame.ExecuteJavaScriptAsync(TwitterUtils.BackgroundColorOverride);
UpdateProperties();
TweetDeckBridge.RestoreSessionData(frame);
ScriptLoader.ExecuteFile(frame, "code.js");

View File

@ -13,7 +13,7 @@ static class TwitterUtils{
public const string TweetDeckURL = "https://tweetdeck.twitter.com";
public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153);
public const string BackgroundColorOverride = "let e=document.createElement('style');document.head.appendChild(e);e.innerHTML='body,body::before{background:#1c6399!important}'";
public const string BackgroundColorOverride = "setTimeout(function f(){let h=document.head;if(!h){setTimeout(f,5);return;}let e=document.createElement('style');e.innerHTML='body,body::before{background:#1c6399!important}';h.appendChild(e);},1)";
public static readonly ResourceLink LoadingSpinner = new ResourceLink("https://ton.twimg.com/tduck/spinner", ResourceHandler.FromByteArray(Properties.Resources.spinner, "image/apng"));

View File

@ -4,7 +4,7 @@
//
var injectCSS = function(){
if (!document.head){
setTimeout(injectCSS, 25);
setTimeout(injectCSS, 5);
return;
}
@ -15,7 +15,7 @@
style.sheet.insertRule(rule, 0);
};
addRule("body { overflow: hidden !important; background-color: #1c6399 !important; }"); // remove scrollbar and change background
addRule("body { overflow: hidden !important; }"); // remove scrollbar
addRule(".page-canvas { box-shadow: 0 0 150px rgba(255, 255, 255, 0.3) !important; }"); // change page box shadow
addRule(".topbar { display: none !important; }"); // hide top bar