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

Bypass t.co on click & fix right-clicking t.co links in notifications

This commit is contained in:
chylex 2017-09-02 13:07:40 +02:00
parent e8604a261d
commit 40ad836fc3
2 changed files with 15 additions and 5 deletions
Resources/Scripts

View File

@ -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];

View File

@ -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"));
});
//