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

Rewrite hacky link handling for the error page to be not as hacky

This commit is contained in:
chylex 2017-03-21 20:24:41 +01:00
parent 61d2d124ff
commit 0d95b8eb44
2 changed files with 3 additions and 13 deletions
Core
Resources/Scripts/pages

View File

@ -80,7 +80,6 @@ public FormBrowser(PluginManager pluginManager, UpdaterSettings updaterSettings)
this.browser.LoadingStateChanged += browser_LoadingStateChanged;
this.browser.FrameLoadEnd += browser_FrameLoadEnd;
this.browser.LoadError += browser_LoadError;
this.browser.AddressChanged += browser_AddressChanged;
this.browser.RegisterAsyncJsObject("$TD", new TweetDeckBridge(this, notification));
this.browser.RegisterAsyncJsObject("$TDP", plugins.Bridge);
@ -166,7 +165,7 @@ private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
}
private void browser_LoadError(object sender, LoadErrorEventArgs e){
if (!e.FailedUrl.StartsWith("http://td/") && !e.FailedUrl.StartsWith("td:")){
if (!e.FailedUrl.StartsWith("http://td/")){
string errorPage = ScriptLoader.LoadResource("pages/error.html", true);
if (errorPage != null){
@ -175,15 +174,6 @@ private void browser_LoadError(object sender, LoadErrorEventArgs e){
}
}
private void browser_AddressChanged(object sender, AddressChangedEventArgs e){
if (e.Address.StartsWith("td:")){
switch(e.Address){
case "td:reload": ReloadToTweetDeck(); break;
case "td:exit": this.InvokeAsyncSafe(ForceClose); break;
}
}
}
private void FormBrowser_Activated(object sender, EventArgs e){
if (!isLoaded)return;

View File

@ -42,8 +42,8 @@
<center>
<h1>Connection Error</h1>
<p>{err}</p>
<button onclick="location.href = 'td:reload'">Retry</button>
<button onclick="location.href = 'td:exit'">Exit</button>
<button onclick="location.href = 'https://tweetdeck.twitter.com'; [].forEach.call(document.getElementsByTagName('button'), e => e.style.visibility = 'hidden')">Retry</button>
<button onclick="window.close()">Exit</button>
</center>
</body>
</html>