mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-02 11:34:08 +02:00
Customize login and logout pages
This commit is contained in:
parent
ff40474f92
commit
df4c4e443d
@ -79,6 +79,7 @@ public FormBrowser(PluginManager pluginManager, UpdaterSettings updaterSettings)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
this.browser.LoadingStateChanged += browser_LoadingStateChanged;
|
this.browser.LoadingStateChanged += browser_LoadingStateChanged;
|
||||||
|
this.browser.FrameLoadStart += browser_FrameLoadStart;
|
||||||
this.browser.FrameLoadEnd += browser_FrameLoadEnd;
|
this.browser.FrameLoadEnd += browser_FrameLoadEnd;
|
||||||
this.browser.LoadError += browser_LoadError;
|
this.browser.LoadError += browser_LoadError;
|
||||||
this.browser.RegisterAsyncJsObject("$TD", new TweetDeckBridge(this, notification));
|
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){
|
private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||||
if (e.Frame.IsMain && BrowserUtils.IsTweetDeckWebsite(e.Frame)){
|
if (e.Frame.IsMain && BrowserUtils.IsTweetDeckWebsite(e.Frame)){
|
||||||
e.Frame.ExecuteJavaScriptAsync(BrowserUtils.BackgroundColorFix);
|
e.Frame.ExecuteJavaScriptAsync(BrowserUtils.BackgroundColorFix);
|
||||||
|
@ -92,6 +92,10 @@ public static bool IsTweetDeckWebsite(IFrame frame){
|
|||||||
return frame.Url.Contains("//tweetdeck.twitter.com/");
|
return frame.Url.Contains("//tweetdeck.twitter.com/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsTwitterWebsite(IFrame frame){
|
||||||
|
return frame.Url.Contains("//twitter.com/");
|
||||||
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public static void HandleConsoleMessage(object sender, ConsoleMessageEventArgs e){
|
public static void HandleConsoleMessage(object sender, ConsoleMessageEventArgs e){
|
||||||
Debug.WriteLine("[Console] {0} ({1}:{2})", e.Message, e.Source, e.Line);
|
Debug.WriteLine("[Console] {0} ({1}:{2})", e.Message, e.Source, e.Line);
|
||||||
|
@ -684,4 +684,8 @@
|
|||||||
window.TD_PLUGINS.onReady();
|
window.TD_PLUGINS.onReady();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on("uiLoginFormImpression", function(){
|
||||||
|
location.href = $("a.btn", ".js-login-form").first().attr("href");
|
||||||
|
});
|
||||||
})($, $TD, $TDX, TD);
|
})($, $TD, $TDX, TD);
|
||||||
|
25
Resources/Scripts/twitter.js
Normal file
25
Resources/Scripts/twitter.js
Normal 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);
|
@ -339,6 +339,7 @@
|
|||||||
<Content Include="Resources\Scripts\plugins.browser.js" />
|
<Content Include="Resources\Scripts\plugins.browser.js" />
|
||||||
<Content Include="Resources\Scripts\plugins.js" />
|
<Content Include="Resources\Scripts\plugins.js" />
|
||||||
<Content Include="Resources\Scripts\plugins.notification.js" />
|
<Content Include="Resources\Scripts\plugins.notification.js" />
|
||||||
|
<Content Include="Resources\Scripts\twitter.js" />
|
||||||
<Content Include="Resources\Scripts\update.js" />
|
<Content Include="Resources\Scripts\update.js" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user