diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js index 195a7301..f2ec72d6 100644 --- a/Resources/Scripts/code.js +++ b/Resources/Scripts/code.js @@ -408,7 +408,15 @@ })(); // - // Block: Allow bypassing of t.co and include media previews in context menus. + // Block: Bypass t.co when clicking links. + // + $(document.body).delegate("a[data-full-url]", "click", function(e){ + $TD.openBrowser($(this).attr("data-full-url")); + e.preventDefault(); + }); + + // + // Block: Bypass t.co and include additional information in context menus. // $(document.body).delegate("a", "contextmenu", function(){ let me = $(this)[0]; diff --git a/Resources/Scripts/notification.js b/Resources/Scripts/notification.js index 71e1f2f0..29345db1 100644 --- a/Resources/Scripts/notification.js +++ b/Resources/Scripts/notification.js @@ -14,14 +14,16 @@ }; // - // Block: Hook into links to bypass default open function. + // Block: Hook into links to bypass default open function and t.co. // addEventListener(links, "click", function(e){ - $TD.openBrowser(e.currentTarget.getAttribute("href")); + let ele = e.currentTarget; + + $TD.openBrowser(ele.hasAttribute("data-full-url") ? ele.getAttribute("data-full-url") : ele.getAttribute("href")); e.preventDefault(); if ($TDX.skipOnLinkClick){ - let parentClasses = e.currentTarget.parentNode.classList; + let parentClasses = ele.parentNode.classList; if (parentClasses.contains("js-tweet-text") || parentClasses.contains("js-quoted-tweet-text") || parentClasses.contains("js-timestamp")){ $TD.loadNextNotification(); @@ -33,7 +35,7 @@ // Block: Allow bypassing of t.co in context menus. // addEventListener(links, "contextmenu", function(e){ - $TD.setLastRightClickedLink(e.currentTarget.getAttribute("data-full-url") || ""); + $TD.setLastRightClickInfo("link", e.currentTarget.getAttribute("data-full-url")); }); //