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

Customize login and logout pages

This commit is contained in:
chylex 2017-04-06 23:16:58 +02:00
parent ff40474f92
commit df4c4e443d
5 changed files with 41 additions and 0 deletions

View File

@ -79,6 +79,7 @@ public FormBrowser(PluginManager pluginManager, UpdaterSettings updaterSettings)
#endif
this.browser.LoadingStateChanged += browser_LoadingStateChanged;
this.browser.FrameLoadStart += browser_FrameLoadStart;
this.browser.FrameLoadEnd += browser_FrameLoadEnd;
this.browser.LoadError += browser_LoadError;
this.browser.RegisterAsyncJsObject("$TD", new TweetDeckBridge(this, notification));
@ -161,6 +162,12 @@ private void browser_LoadingStateChanged(object sender, LoadingStateChangedEvent
}
}
private void browser_FrameLoadStart(object sender, FrameLoadStartEventArgs e){
if (e.Frame.IsMain && BrowserUtils.IsTwitterWebsite(e.Frame)){
ScriptLoader.ExecuteFile(e.Frame, "twitter.js");
}
}
private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
if (e.Frame.IsMain && BrowserUtils.IsTweetDeckWebsite(e.Frame)){
e.Frame.ExecuteJavaScriptAsync(BrowserUtils.BackgroundColorFix);

View File

@ -92,6 +92,10 @@ public static bool IsTweetDeckWebsite(IFrame frame){
return frame.Url.Contains("//tweetdeck.twitter.com/");
}
public static bool IsTwitterWebsite(IFrame frame){
return frame.Url.Contains("//twitter.com/");
}
#if DEBUG
public static void HandleConsoleMessage(object sender, ConsoleMessageEventArgs e){
Debug.WriteLine("[Console] {0} ({1}:{2})", e.Message, e.Source, e.Line);

View File

@ -684,4 +684,8 @@
window.TD_PLUGINS.onReady();
}
});
$(document).on("uiLoginFormImpression", function(){
location.href = $("a.btn", ".js-login-form").first().attr("href");
});
})($, $TD, $TDX, TD);

View File

@ -0,0 +1,25 @@
//
// Block: Inject custom CSS and layout into the page.
//
setTimeout(function(){
var style = document.createElement("style");
document.head.appendChild(style);
style.sheet.insertRule("body { overflow: hidden !important; }", 0); // remove scrollbar
style.sheet.insertRule(".topbar { display: none !important; }", 0); // hide top bar
style.sheet.insertRule(".page-canvas, .buttons, .btn, input { border-radius: 0 !important; }", 0); // sharpen borders
style.sheet.insertRule("input { padding: 5px 8px 4px !important; }", 0); // tweak input padding
style.sheet.insertRule("#doc { width: 100%; height: 100%; margin: 0; position: absolute; display: table; }", 0); // center everything
style.sheet.insertRule("#page-outer { display: table-cell; vertical-align: middle; }", 0); // center everything
style.sheet.insertRule("#page-container { padding: 0 20px !important; width: 100% !important; box-sizing: border-box !important; }", 0); // center everything
style.sheet.insertRule(".page-canvas { margin: 0 auto !important; }", 0); // center everything
if (location.pathname === "/logout"){
style.sheet.insertRule(".page-canvas { width: auto !important; max-width: 888px; }", 0); // fix min width
style.sheet.insertRule(".signout-wrapper { width: auto !important; }", 0); // fix min width
style.sheet.insertRule(".btn { margin: 0 4px !important; }", 0); // add margin around buttons
style.sheet.insertRule(".btn.cancel { border: 1px solid #bbc1c5 !important; }", 0); // add border to cancel button
style.sheet.insertRule(".aside p { display: none; }", 0); // hide text below the logout dialog
}
}, 1);

View File

@ -339,6 +339,7 @@
<Content Include="Resources\Scripts\plugins.browser.js" />
<Content Include="Resources\Scripts\plugins.js" />
<Content Include="Resources\Scripts\plugins.notification.js" />
<Content Include="Resources\Scripts\twitter.js" />
<Content Include="Resources\Scripts\update.js" />
</ItemGroup>
<ItemGroup>