diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js index 464f4f93..683d79cc 100644 --- a/Resources/Scripts/code.js +++ b/Resources/Scripts/code.js @@ -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; }); diff --git a/Resources/Scripts/notification.js b/Resources/Scripts/notification.js index 91500bf7..ebbb7a21 100644 --- a/Resources/Scripts/notification.js +++ b/Resources/Scripts/notification.js @@ -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. //