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

Fix not stripping t.co in notifications when dragging & sometimes when copying

This commit is contained in:
chylex 2018-06-06 15:10:52 +02:00
parent b9318dfd8e
commit 70ca890bef
2 changed files with 6 additions and 9 deletions
Resources/Scripts

View File

@ -197,6 +197,10 @@
html.find(".js-media").remove();
}
html.find("a[data-full-url]").each(function(){ // bypass t.co on all links
this.href = this.getAttribute("data-full-url");
});
html.find("a[href='#']").each(function(){ // remove <a> tags around links that don't lead anywhere (such as account names the tweet replied to)
this.outerHTML = this.innerHTML;
});

View File

@ -14,14 +14,14 @@
};
//
// Block: Hook into links to bypass default open function and t.co, and handle skipping notification when opening links.
// Block: Hook into links to bypass default open function, and handle skipping notification when opening links.
//
(function(){
const onLinkClick = function(e){
if (e.button === 0 || e.button === 1){
let ele = e.currentTarget;
$TD.openBrowser(ele.hasAttribute("data-full-url") ? ele.getAttribute("data-full-url") : ele.getAttribute("href"));
$TD.openBrowser(ele.href);
e.preventDefault();
if ($TDX.skipOnLinkClick){
@ -38,13 +38,6 @@
addEventListener(links, "auxclick", onLinkClick);
})();
//
// Block: Allow bypassing of t.co in context menus.
//
addEventListener(links, "contextmenu", function(e){
$TD.setLastRightClickInfo("link", e.currentTarget.getAttribute("data-full-url"));
});
//
// Block: Expand shortened links on hover or display tooltip.
//