mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-20 03:15:47 +02:00
Add middle-click actions (reply popout, RT quote, fav modal) & fix popout in temp columns
This commit is contained in:
parent
adefdadc19
commit
7346ce370d
@ -814,25 +814,56 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Make middle click on tweet reply icon open the compose drawer. Only works for non-temporary columns.
|
// Block: Make middle click on tweet reply icon open the compose drawer, retweet icon trigger a quote, and favorite icon open a 'Like from accounts...' modal.
|
||||||
//
|
//
|
||||||
app.delegate(".js-reply-action", "auxclick", function(e){
|
app.delegate(".tweet-action", "auxclick", function(e){
|
||||||
if (e.which === 2){
|
return if e.which !== 2;
|
||||||
let column = $(this).closest(".js-column");
|
|
||||||
|
let column = TD.controller.columnManager.get($(this).closest("section.js-column").attr("data-column"));
|
||||||
if (column && column.hasClass("column") && $("[data-drawer='compose']").hasClass("is-hidden")){
|
return if !column;
|
||||||
$(document).trigger("uiDrawerShowDrawer", {
|
|
||||||
drawer: "compose",
|
let ele = $(this).closest("article");
|
||||||
withAnimation: true
|
let tweet = column.findChirp(ele.attr("data-tweet-id")) || column.findChirp(ele.attr("data-key"));
|
||||||
|
return if !tweet;
|
||||||
|
|
||||||
|
// TODO fix "from" to accept reply-account plugin
|
||||||
|
|
||||||
|
switch($(this).attr("rel")){
|
||||||
|
case "reply":
|
||||||
|
let main = tweet.getMainTweet();
|
||||||
|
|
||||||
|
$(document).trigger("uiDockedComposeTweet", {
|
||||||
|
type: "reply",
|
||||||
|
from: [ TD.storage.clientController.client.getDefaultAccount() ],
|
||||||
|
inReplyTo: {
|
||||||
|
id: tweet.id,
|
||||||
|
htmlText: main.htmlText,
|
||||||
|
user: {
|
||||||
|
screenName: main.user.screenName,
|
||||||
|
name: main.user.name,
|
||||||
|
profileImageURL: main.user.profileImageURL
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mentions: tweet.getReplyUsers()
|
||||||
});
|
});
|
||||||
|
|
||||||
window.setTimeout(() => $(this).trigger("click"), 1);
|
break;
|
||||||
}
|
|
||||||
|
case "favorite":
|
||||||
|
$(document).trigger("uiShowFavoriteFromOptions", { tweet });
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "retweet":
|
||||||
|
tweet.quoteTo([ TD.storage.clientController.client.getDefaultAccount() ]);
|
||||||
|
break;
|
||||||
|
|
||||||
e.preventDefault();
|
default:
|
||||||
e.stopPropagation();
|
return;
|
||||||
e.stopImmediatePropagation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
e.stopImmediatePropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user