1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-02 11:34:08 +02:00

Redo url hooks to avoid duplicate browser opens

This commit is contained in:
chylex 2016-04-12 02:29:02 +02:00
parent fa4a22fd55
commit ef0b699731

View File

@ -201,17 +201,32 @@
// //
// Block: Hook into links to bypass default open function // Block: Hook into links to bypass default open function
// //
$(document.body).delegate("a[target='_blank']","click",function(e){ (function(){
var me = $(this); var urlWait = false;
if (!me.is(".link-complex") && !(me.attr("rel") == "mediaPreview" && me.closest("#open-modal").length == 0)){ var onUrlOpened = function(){
$TD.openBrowser(me.attr("href")); urlWait = true;
} setTimeout(function(){ urlWait = false; },0);
};
e.preventDefault(); $(document.body).delegate("a[target='_blank']","click",function(e){
}); if (urlWait)return;
window.open = function(url){ var me = $(this);
$TD.openBrowser(url);
}; if (!me.is(".link-complex") && !(me.attr("rel") == "mediaPreview" && me.closest("#open-modal").length == 0)){
$TD.openBrowser(me.attr("href"));
}
e.preventDefault();
onUrlOpened();
});
window.open = function(url){
if (urlWait)return;
$TD.openBrowser(url);
onUrlOpened();
};
})();
})($,$TD); })($,$TD);