1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-07 18:15:52 +02:00
This commit is contained in:
chylex 2019-03-07 17:41:58 +01:00
parent 20e29a7975
commit d6a14edcdf
2 changed files with 26 additions and 19 deletions
Core/Notification
Resources/Scripts

View File

@ -33,7 +33,7 @@ protected virtual Point PrimaryLocation{
screen = Screen.AllScreens[Config.NotificationDisplay-1];
}
else{
screen = Screen.FromControl(owner);
screen = Screen.FromControl(owner); // TODO may be disposed?
}
int edgeDist = Config.NotificationEdgeDistance;

View File

@ -560,7 +560,7 @@
execSafe(function setupShortenerBypass(){
$(document.body).delegate("a[data-full-url]", "click auxclick", function(e){
if (e.button === 0 || e.button === 1){ // event.which seems to be borked in auxclick
$TD.openBrowser($(this).attr("data-full-url"));
$TD.openBrowser($(this).attr("data-full-url")); // TODO detect rel="tweet"?
e.preventDefault();
}
});
@ -755,28 +755,35 @@
return chirp.getMedia().filter(item => !item.isAnimatedGif).map(item => item.entity.media_url_https+":small").join(";");
};
const updateContextInfo = function(chirp){
let quote = chirp.quotedTweet;
if (chirp.chirpType === TD.services.ChirpBase.TWEET){
let tweetUrl = chirp.getChirpURL();
let quoteUrl = quote && quote.getChirpURL();
let chirpAuthors = quote ? [ chirp.getMainUser().screenName, quote.getMainUser().screenName ].join(";") : chirp.getMainUser().screenName;
let chirpImages = chirp.hasImage() ? processMedia(chirp) : quote && quote.hasImage() ? processMedia(quote) : "";
$TD.setRightClickedChirp(tweetUrl || "", quoteUrl || "", chirpAuthors, chirpImages);
}
else if (chirp instanceof TD.services.TwitterActionFollow){
$TD.setRightClickedLink("link", chirp.following.getProfileURL());
}
};
app.delegate("section.js-column", {
contextmenu: function(){
let hovered = getHoveredTweet();
return if !hovered;
let tweet = hovered.obj;
let quote = tweet.quotedTweet;
if (tweet.chirpType === TD.services.ChirpBase.TWEET){
let tweetUrl = tweet.getChirpURL();
let quoteUrl = quote && quote.getChirpURL();
let chirpAuthors = quote ? [ tweet.getMainUser().screenName, quote.getMainUser().screenName ].join(";") : tweet.getMainUser().screenName;
let chirpImages = tweet.hasImage() ? processMedia(tweet) : quote && quote.hasImage() ? processMedia(quote) : "";
$TD.setRightClickedChirp(tweetUrl || "", quoteUrl || "", chirpAuthors, chirpImages);
}
else if (tweet instanceof TD.services.TwitterActionFollow){
$TD.setRightClickedLink("link", tweet.following.getProfileURL());
}
hovered && updateContextInfo(hovered.obj);
}
});
if (ensurePropertyExists(TD, "services", "TwitterStatus", "prototype", "renderInMediaGallery")){
TD.services.TwitterStatus.prototype.renderInMediaGallery = appendToFunction(TD.services.TwitterStatus.prototype.renderInMediaGallery, function(){
updateContextInfo(this);
});
}
});
//