mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-29 20:34:04 +02:00
Rewrite extra mouse button handling and fix skipping 'Back to Tweet'
Closes #74
This commit is contained in:
parent
25fa3cefab
commit
a4006deb8c
@ -379,32 +379,39 @@
|
|||||||
//
|
//
|
||||||
// Block: Support for extra mouse buttons.
|
// Block: Support for extra mouse buttons.
|
||||||
//
|
//
|
||||||
window.TDGF_onMouseClickExtra = function(button){
|
(function(){
|
||||||
if (button === 1){ // back button
|
var tryClickSelector = function(selector, parent){
|
||||||
var inlineComposer, drawerComposer, modal;
|
return $(selector, parent).click().length;
|
||||||
|
};
|
||||||
if ((modal = $("#open-modal")).is(":visible")){
|
|
||||||
modal.find("a[rel=dismiss]").click();
|
var tryCloseModal = function(){
|
||||||
|
var modal = $("#open-modal");
|
||||||
|
return modal.is(":visible") && tryClickSelector("a[rel=dismiss]", modal);
|
||||||
|
};
|
||||||
|
|
||||||
|
var tryCloseHighlightedColumn = function(){
|
||||||
|
if (highlightedColumnEle){
|
||||||
|
var column = highlightedColumnEle.closest(".js-column");
|
||||||
|
return (column.is(".is-shifted-2") && tryClickSelector(".js-tweet-social-proof-back", column)) || (column.is(".is-shifted-1") && tryClickSelector(".js-column-back", column));
|
||||||
}
|
}
|
||||||
else if ((inlineComposer = $(".js-inline-compose-close")).length === 1){
|
};
|
||||||
inlineComposer.click();
|
|
||||||
}
|
window.TDGF_onMouseClickExtra = function(button){
|
||||||
else if (highlightedColumnEle && highlightedColumnEle.closest(".js-column").is(".is-shifted-1")){
|
if (button === 1){ // back button
|
||||||
highlightedColumnEle.find(".js-column-back").first().click();
|
tryCloseModal() ||
|
||||||
}
|
tryClickSelector(".js-inline-compose-close") ||
|
||||||
else if ((drawerComposer = $(".js-app-content.is-open .js-drawer-close:visible")).length === 1){
|
tryCloseHighlightedColumn() ||
|
||||||
drawerComposer.click();
|
tryClickSelector(".js-app-content.is-open .js-drawer-close:visible") ||
|
||||||
}
|
tryClickSelector(".is-shifted-2 .js-tweet-social-proof-back") ||
|
||||||
else{
|
|
||||||
$(".js-column-back").click();
|
$(".js-column-back").click();
|
||||||
}
|
}
|
||||||
}
|
else if (button === 2){ // forward button
|
||||||
else if (button === 2){ // forward button
|
if (highlightedTweetEle){
|
||||||
if (highlightedTweetEle){
|
highlightedTweetEle.children().first().click();
|
||||||
highlightedTweetEle.children().first().click();
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
})();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Fix scheduled tweets not showing up sometimes.
|
// Block: Fix scheduled tweets not showing up sometimes.
|
||||||
|
Loading…
Reference in New Issue
Block a user