From a442adf8d5bdea9f301aa00eacf1935ba06df871 Mon Sep 17 00:00:00 2001
From: chylex <info@chylex.com>
Date: Sun, 2 Apr 2017 17:50:32 +0200
Subject: [PATCH] Fix screenshot margins for videos and image grids in detail
 view

---
 Resources/Scripts/code.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js
index 3d5f7bdd..16aa666b 100644
--- a/Resources/Scripts/code.js
+++ b/Resources/Scripts/code.js
@@ -305,16 +305,23 @@
         
         setImportantProperty(selectedTweet.find(".js-tweet-text"), "margin-bottom", "8px");
         setImportantProperty(selectedTweet.find(".js-quote-detail"), "margin-bottom", "10px");
-        setImportantProperty(selectedTweet.find(".js-media-preview-container"), "margin-bottom", "10px");
         setImportantProperty(selectedTweet.find(".js-poll-link").next(), "margin-bottom", "8px");
         
         if (isDetail){
-          setImportantProperty(selectedTweet.find(".js-tweet-media"), "margin-bottom", "0");
+          if (selectedTweet.find("[class*='media-grid-']").length > 0){
+            setImportantProperty(selectedTweet.find(".js-tweet-media"), "margin-bottom", "10px");
+          }
+          else{
+            setImportantProperty(selectedTweet.find(".js-tweet-media"), "margin-bottom", "6px");
+          }
+          
+          setImportantProperty(selectedTweet.find(".js-media-preview-container"), "margin-bottom", "4px");
           selectedTweet.find(".js-translate-call-to-action").first().remove();
           selectedTweet.find(".js-tweet").first().nextAll().remove();
           selectedTweet.find("footer").last().prevUntil(":not(.txt-mute.txt-small)").addBack().remove(); // footer, date, location
         }
         else{
+          setImportantProperty(selectedTweet.find(".js-media-preview-container"), "margin-bottom", "10px");
           selectedTweet.find("footer").last().remove();
         }