1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-23 03:15:48 +02:00

Fix visual issues with screenshots (reply avatars, media margins, poll cleanup)

This commit is contained in:
chylex 2016-12-25 13:52:34 +01:00
parent ee5d172468
commit 85b90574b8

View File

@ -307,6 +307,12 @@
(function(){
var selectedTweet;
var setImportantProperty = function(obj, property, value){
if (obj.length === 1){
obj[0].style.setProperty(property, value, "important");
}
};
app.delegate("article.js-stream-item", "contextmenu", function(){
selectedTweet = $(this);
});
@ -314,18 +320,19 @@
window.TDGF_triggerScreenshot = function(){
if (selectedTweet){
var tweetWidth = selectedTweet.width();
var isDetail = selectedTweet.parent().hasClass("js-tweet-detail");
var parent = selectedTweet.parent();
var isDetail = parent.hasClass("js-tweet-detail");
var isReply = !isDetail && (parent.hasClass("js-replies-to") || parent.hasClass("js-replies-before"));
selectedTweet = selectedTweet.clone();
selectedTweet.children().first().addClass($(document.documentElement).attr("class")).css("padding-bottom", "12px");
var quotedTweet = selectedTweet.find(".js-quote-detail");
if (quotedTweet.length > 0){
quotedTweet[0].style.setProperty("margin-bottom", "0", "important");
}
setImportantProperty(selectedTweet.find(".js-quote-detail"), "margin-bottom", "0");
setImportantProperty(selectedTweet.find(".js-media-preview-container"), "margin-bottom", "0");
if (isDetail){
setImportantProperty(selectedTweet.find(".js-tweet-media"), "margin-bottom", "0");
selectedTweet.find(".js-translate-call-to-action").first().remove();
selectedTweet.find(".js-cards-container").first().nextAll().remove();
selectedTweet.find(".js-detail-view-inline").first().remove();
@ -334,6 +341,13 @@
selectedTweet.find("footer").last().remove();
}
if (isReply){
selectedTweet.find(".is-conversation").removeClass("is-conversation");
selectedTweet.find(".timeline-poll-container").first().remove(); // fix for timeline polls plugin
}
selectedTweet.find(".js-poll-link").remove();
var testTweet = selectedTweet.clone().css({
position: "absolute",
left: "-999px",