From f0affa4aec286658d8d307045e871a06c770fdce Mon Sep 17 00:00:00 2001 From: chylex <contact@chylex.com> Date: Thu, 31 Aug 2017 15:34:05 +0200 Subject: [PATCH] Implement 'Save all images as...' for images in quoted tweets --- Resources/Scripts/code.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js index cf7dcb7e..fab0b2ac 100644 --- a/Resources/Scripts/code.js +++ b/Resources/Scripts/code.js @@ -460,6 +460,10 @@ } }; + var processMedia = function(media){ + return media.filter(item => !item.isAnimatedGif).map(item => item.entity.media_url_https+":small").join(";"); + }; + app.delegate("section.js-column", "mouseenter mouseleave", function(e){ if (e.type === "mouseenter"){ if (!highlightedColumnObj){ @@ -483,8 +487,7 @@ let tweetUrl = tweet.getChirpURL(); let quoteUrl = tweet.quotedTweet ? tweet.quotedTweet.getChirpURL() : ""; let authors = tweet.quotedTweet ? [ tweet.getMainUser().screenName, tweet.quotedTweet.getMainUser().screenName ].join(";") : tweet.getMainUser().screenName; - let imageList = tweet.hasImage() ? tweet.getMedia().filter(item => !item.isAnimatedGif).map(item => item.entity.media_url_https+":small").join(";") : ""; - // TODO maybe handle embedded images too? + let imageList = tweet.quotedTweet ? processMedia(tweet.quotedTweet.getMedia()) : tweet.hasImage() ? processMedia(tweet.getMedia()) : ""; updateHighlightedTweet(me, tweet, tweetUrl || "", quoteUrl || "", authors, imageList); }