Class: WNS::YoutubeTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- WNS::YoutubeTag
- Defined in:
- lib/jekyll-wns/assets/youtube_tag.rb
Instance Method Summary collapse
-
#initialize(tag_name, text, tokens) ⇒ YoutubeTag
constructor
A new instance of YoutubeTag.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, text, tokens) ⇒ YoutubeTag
Returns a new instance of YoutubeTag.
3 4 5 6 |
# File 'lib/jekyll-wns/assets/youtube_tag.rb', line 3 def initialize(tag_name, text, tokens) super @text = text.strip!.split("|") end |
Instance Method Details
#render(context) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jekyll-wns/assets/youtube_tag.rb', line 8 def render(context) "<div class='youtube' id='" + @text[0] + "'> <a class='btn btn-lg btn-block btn-primary' href='https://youtu.be/" + @text[0] + "' target='_blank' rel='noopener'> Watch “" + @text[1] + "” on YouTube </a> <a class='btn btn-lg btn-block btn-primary youtube-load-btn' data-videoid='" + @text[0] + "'> Load YouTube Video (3rd party script) </a> </div> <script id='yt-" + @text[0] + "' type='text/html'> <div style='position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;'> <iframe style='position: absolute; top: 0; left: 0; width: 100%; height: 100%;' src='https://www.youtube-nocookie.com/embed/" + @text[0] + "?rel=0' frameborder='0' allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe> </div> </script>" end |