mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-17 21:15:47 +02:00
Fix middle-clicking on links in desktop notifications not skipping them or stripping t.co
This commit is contained in:
parent
8c168c9ad7
commit
89e92dab59
@ -14,22 +14,29 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Hook into links to bypass default open function and t.co.
|
// Block: Hook into links to bypass default open function and t.co, and handle skipping notification when opening links.
|
||||||
//
|
//
|
||||||
addEventListener(links, "click", function(e){
|
(function(){
|
||||||
let ele = e.currentTarget;
|
const onLinkClick = function(e){
|
||||||
|
if (e.button === 0 || e.button === 1){
|
||||||
$TD.openBrowser(ele.hasAttribute("data-full-url") ? ele.getAttribute("data-full-url") : ele.getAttribute("href"));
|
let ele = e.currentTarget;
|
||||||
e.preventDefault();
|
|
||||||
|
$TD.openBrowser(ele.hasAttribute("data-full-url") ? ele.getAttribute("data-full-url") : ele.getAttribute("href"));
|
||||||
if ($TDX.skipOnLinkClick){
|
e.preventDefault();
|
||||||
let parentClasses = ele.parentNode.classList;
|
|
||||||
|
if ($TDX.skipOnLinkClick){
|
||||||
if (parentClasses.contains("js-tweet-text") || parentClasses.contains("js-quoted-tweet-text") || parentClasses.contains("js-timestamp")){
|
let parentClasses = ele.parentNode.classList;
|
||||||
$TD.loadNextNotification();
|
|
||||||
|
if (parentClasses.contains("js-tweet-text") || parentClasses.contains("js-quoted-tweet-text") || parentClasses.contains("js-timestamp")){
|
||||||
|
$TD.loadNextNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
});
|
|
||||||
|
addEventListener(links, "click", onLinkClick);
|
||||||
|
addEventListener(links, "auxclick", onLinkClick);
|
||||||
|
})();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Allow bypassing of t.co in context menus.
|
// Block: Allow bypassing of t.co in context menus.
|
||||||
|
Loading…
Reference in New Issue
Block a user