mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-05 20:34:07 +02:00
Bypass t.co on click & fix right-clicking t.co links in notifications
This commit is contained in:
parent
e8604a261d
commit
40ad836fc3
Resources/Scripts
@ -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(){
|
$(document.body).delegate("a", "contextmenu", function(){
|
||||||
let me = $(this)[0];
|
let me = $(this)[0];
|
||||||
|
@ -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){
|
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();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($TDX.skipOnLinkClick){
|
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")){
|
if (parentClasses.contains("js-tweet-text") || parentClasses.contains("js-quoted-tweet-text") || parentClasses.contains("js-timestamp")){
|
||||||
$TD.loadNextNotification();
|
$TD.loadNextNotification();
|
||||||
@ -33,7 +35,7 @@
|
|||||||
// Block: Allow bypassing of t.co in context menus.
|
// Block: Allow bypassing of t.co in context menus.
|
||||||
//
|
//
|
||||||
addEventListener(links, "contextmenu", function(e){
|
addEventListener(links, "contextmenu", function(e){
|
||||||
$TD.setLastRightClickedLink(e.currentTarget.getAttribute("data-full-url") || "");
|
$TD.setLastRightClickInfo("link", e.currentTarget.getAttribute("data-full-url"));
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user