1
0
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:
chylex 2017-09-05 22:32:11 +02:00
parent 61d3ed891a
commit 8b8f5f5473

View File

@ -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);
}
});
}
})();