mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-15 06:15:47 +02:00
Fix login page links opening in the app instead of external browser
This commit is contained in:
parent
61d3ed891a
commit
8b8f5f5473
@ -39,4 +39,25 @@
|
||||
};
|
||||
|
||||
setTimeout(injectCSS, 1);
|
||||
|
||||
//
|
||||
// Block: Make login page links external.
|
||||
//
|
||||
if (location.pathname === "/login"){
|
||||
document.addEventListener("DOMContentLoaded", function(){
|
||||
let openLinkExternally = function(e){
|
||||
let href = e.currentTarget.getAttribute("href");
|
||||
$TD.openBrowser(href[0] === '/' ? location.origin+href : href);
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
let links = document.getElementsByTagName("A");
|
||||
|
||||
for(let index = 0; index < links.length; index++){
|
||||
links[index].addEventListener("click", openLinkExternally);
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user