From 6832b06a800583dcb76e89f2407cab39c530b0ea Mon Sep 17 00:00:00 2001
From: gotens1211 <nikeythe@gmail.com>
Date: Sun, 22 Jan 2017 19:27:49 +0530
Subject: [PATCH 1/3] FIX: Embedded Youtube videos lacking margin at bottom

Changed the cook function arguments for yotube videos.
---
 app/models/post_analyzer.rb | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/app/models/post_analyzer.rb b/app/models/post_analyzer.rb
index 09f7cd9932f..0b8d590b1cb 100644
--- a/app/models/post_analyzer.rb
+++ b/app/models/post_analyzer.rb
@@ -12,8 +12,34 @@ class PostAnalyzer
     @found_oneboxes
   end
 
+#to add margin between youtube links
+def newlinereplace(*args)
+    sp = args[0].split(/\n+/)
+    a = 0
+    x = 0
+    replacem = []
+ while a<sp.length do
+   if sp[a].length > 0
+    replacem[x] =sp[a]
+      x+=1
+   end
+   if a!= sp.length-1
+    replacem[x]="\n"
+      x+=1
+   end
+    a+=1
+ end
+   args[0]=replacem.join()
+   return *args
+end
+
   # What we use to cook posts
   def cook(*args)
+    yt_string = args[0]
+    if yt_string.include? "www.youtube"
+      *args = newlinereplace(*args)
+    end
+
     cooked = PrettyText.cook(*args)
 
     result = Oneboxer.apply(cooked, topic_id: @topic_id) do |url, _|
@@ -21,7 +47,6 @@ class PostAnalyzer
       Oneboxer.invalidate(url) if args.last[:invalidate_oneboxes]
       Oneboxer.cached_onebox(url)
     end
-
     cooked = result.to_html if result.changed?
     cooked
   end

From 29947f6e95d0d49297b37c410ade204270baf202 Mon Sep 17 00:00:00 2001
From: gotens1211 <nikeythe@gmail.com>
Date: Tue, 24 Jan 2017 22:27:37 +0530
Subject: [PATCH 2/3] Added margin to the video container in lazyYt plugin

---
 app/models/post_analyzer.rb                  | 26 --------------------
 plugins/lazyYT/assets/stylesheets/lazyYT.css |  1 +
 2 files changed, 1 insertion(+), 26 deletions(-)

diff --git a/app/models/post_analyzer.rb b/app/models/post_analyzer.rb
index 0b8d590b1cb..913b5a81ebe 100644
--- a/app/models/post_analyzer.rb
+++ b/app/models/post_analyzer.rb
@@ -12,36 +12,10 @@ class PostAnalyzer
     @found_oneboxes
   end
 
-#to add margin between youtube links
-def newlinereplace(*args)
-    sp = args[0].split(/\n+/)
-    a = 0
-    x = 0
-    replacem = []
- while a<sp.length do
-   if sp[a].length > 0
-    replacem[x] =sp[a]
-      x+=1
-   end
-   if a!= sp.length-1
-    replacem[x]="\n"
-      x+=1
-   end
-    a+=1
- end
-   args[0]=replacem.join()
-   return *args
-end
-
   # What we use to cook posts
   def cook(*args)
-    yt_string = args[0]
-    if yt_string.include? "www.youtube"
-      *args = newlinereplace(*args)
-    end
 
     cooked = PrettyText.cook(*args)
-
     result = Oneboxer.apply(cooked, topic_id: @topic_id) do |url, _|
       @found_oneboxes = true
       Oneboxer.invalidate(url) if args.last[:invalidate_oneboxes]
diff --git a/plugins/lazyYT/assets/stylesheets/lazyYT.css b/plugins/lazyYT/assets/stylesheets/lazyYT.css
index 732735138a0..38d6bbff693 100644
--- a/plugins/lazyYT/assets/stylesheets/lazyYT.css
+++ b/plugins/lazyYT/assets/stylesheets/lazyYT.css
@@ -13,6 +13,7 @@
   padding: 0 0 56.25% 0;
   overflow: hidden;
   background-color: #000000;
+  margin-bottom: 12px;
 }
 
 .lazyYT-container iframe {

From 7518854ac2730d1924614072d9c240460bef19b4 Mon Sep 17 00:00:00 2001
From: gotens1211 <nikeythe@gmail.com>
Date: Tue, 24 Jan 2017 23:22:10 +0530
Subject: [PATCH 3/3] Cosmetic chnages removed

---
 app/models/post_analyzer.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/models/post_analyzer.rb b/app/models/post_analyzer.rb
index 913b5a81ebe..09f7cd9932f 100644
--- a/app/models/post_analyzer.rb
+++ b/app/models/post_analyzer.rb
@@ -14,13 +14,14 @@ class PostAnalyzer
 
   # What we use to cook posts
   def cook(*args)
-
     cooked = PrettyText.cook(*args)
+
     result = Oneboxer.apply(cooked, topic_id: @topic_id) do |url, _|
       @found_oneboxes = true
       Oneboxer.invalidate(url) if args.last[:invalidate_oneboxes]
       Oneboxer.cached_onebox(url)
     end
+
     cooked = result.to_html if result.changed?
     cooked
   end