jekyll-wns 3.2.0 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce4a530aaa64925e4fe89a2318439175152879194a2a6d2b84d607937ddd0e29
4
- data.tar.gz: 3fea0f81407034716ae7b995907f270a36b372b22b7bd6b9530148a2b8decc4f
3
+ metadata.gz: d0351f261c69b6656bf1d298ce16dfb717d5c52986a5cf56ca7855346fb72dca
4
+ data.tar.gz: fb3675d3b79af34e0c5468e0713d42e673016fa6d6a143b4bbd41421222fdc54
5
5
  SHA512:
6
- metadata.gz: 5024b3b8ad0bdcfd5bf6d67e04bf3911b33e328d92cb12c3777c7aad6fc0d7cea0e05ef2e1f85325dcb444b7a1eb7dd4f5e4b718e53837e1eb9bca9f27e872f3
7
- data.tar.gz: 4907863579a24fbd276ec75efe74fe06e24edc518255eb397bff24dc3de712d12dc2db313fa93a5dd2542c14ce80c53cfaca61e9f37233e424db3e414cf192cc
6
+ metadata.gz: a836a9f9c7aa948d35ad2028488de9ab0cdc87b54b7d577891db98eadd85d01cbd7d54aa53f910d7c3a8c508de11085e08303f7f3d287c831b03f8e4dcd9d85b
7
+ data.tar.gz: 6e7f9eb5905b628a8686ecce3b6667f0ecddf3fca96b67c9dd4b6400088556d40659c872c2796927d6e12374e32560413c2886b28b2ca68de4ebdba382d6b049
data/README.md CHANGED
@@ -76,6 +76,44 @@ gems:
76
76
  <p style="text-align:center" data-mce-style="text-align:center">🙿🙾🙿🙾🙿🙾🙿🙾
77
77
  ```
78
78
 
79
+ #### YouTube Embed
80
+
81
+ The following snippet should be integrated into your site for the tag to properly work:
82
+
83
+ ```javascript
84
+ function loadYouTube() {
85
+ var videos = d.getElementsByClassName('youtube');
86
+ for (var i = 0; i < videos.length; i++) {
87
+ videos[i].innerHTML = d.getElementById(videos[i].getAttribute('data-videoid')).innerHTML;
88
+ }
89
+ }
90
+ ```
91
+
92
+ ```liquid
93
+ {% youtube U6xJfP7-HCc|Base 12 — Numberphile %}
94
+ ```
95
+
96
+ ```html
97
+ <div class="youtube" data-videoid="youtube-U6xJfP7-HCc">
98
+ <a class="btn btn-lg btn-block btn-primary" href="https://youtu.be/U6xJfP7-HCc" target="_blank" rel="noopener">
99
+ Watch “Base 12 — Numberphile” on YouTube
100
+ </a>
101
+ <a class="btn btn-lg btn-block btn-primary" href="javascript:loadYouTube();">
102
+ Load YouTube Video (3rd party script)
103
+ </a>
104
+ </div>
105
+ <script id="youtube-U6xJfP7-HCc" type="text/html">
106
+ <div style='position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;'>
107
+ <iframe
108
+ style='position: absolute; top: 0; left: 0; width: 100%; height: 100%;'
109
+ src='https://www.youtube-nocookie.com/embed/U6xJfP7-HCc?rel=0'
110
+ frameborder='0'
111
+ allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture'
112
+ allowfullscreen></iframe>
113
+ </div>
114
+ </script>
115
+ ```
116
+
79
117
  ### Hooks
80
118
 
81
119
  #### Automatic replacement of spaces to en quads after each sentence
data/jekyll-wns.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "jekyll-wns"
5
- spec.version = "3.2.0"
5
+ spec.version = "3.3.1"
6
6
  spec.authors = ["Thai Chung"]
7
7
  spec.email = ["mail@0xReki.de"]
8
8
  spec.summary = "Collection of Filters, Tags and Hooks I use."
data/js/youtube.js ADDED
@@ -0,0 +1,6 @@
1
+ function loadYouTube() {
2
+ var videos = d.getElementsByClassName('youtube');
3
+ for (var i = 0; i < videos.length; i++) {
4
+ videos[i].innerHTML = d.getElementById(videos[i].getAttribute('data-videoid')).innerHTML;
5
+ }
6
+ }
data/lib/jekyll-wns.rb CHANGED
@@ -8,6 +8,7 @@ require_relative 'jekyll-wns/assets/digest_filters'
8
8
  require_relative 'jekyll-wns/assets/file_properties_filter'
9
9
  require_relative 'jekyll-wns/assets/quads_filter'
10
10
  require_relative 'jekyll-wns/assets/scene_break_tag'
11
+ require_relative 'jekyll-wns/assets/youtube_tag'
11
12
 
12
13
  require_relative 'jekyll-wns/register_filters'
13
14
  require_relative 'jekyll-wns/register_hooks'
@@ -0,0 +1,30 @@
1
+ module WNS
2
+ class YoutubeTag < Liquid::Tag
3
+ def initialize(tag_name, text, tokens)
4
+ super
5
+ @text = text.strip!.split("|")
6
+ end
7
+
8
+ def render(context)
9
+ "<div class='youtube' data-videoid='youtube-" + @text[0] + "'>
10
+ <a class='btn btn-lg btn-block btn-primary' href='https://youtu.be/" + @text[0] + "' target='_blank' rel='noopener'>
11
+ Watch “" + @text[1] + "” on YouTube
12
+ </a>
13
+ <a class='btn btn-lg btn-block btn-primary'
14
+ href='javascript:loadYouTube();'>
15
+ Load YouTube Video (3rd party script)
16
+ </a>
17
+ </div>
18
+ <script id='youtube-" + @text[0] + "' type='text/html'>
19
+ <div style='position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;'>
20
+ <iframe
21
+ style='position: absolute; top: 0; left: 0; width: 100%; height: 100%;'
22
+ src='https://www.youtube-nocookie.com/embed/" + @text[0] + "?rel=0'
23
+ frameborder='0'
24
+ allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture'
25
+ allowfullscreen></iframe>
26
+ </div>
27
+ </script>"
28
+ end
29
+ end
30
+ end
@@ -1 +1,2 @@
1
1
  Liquid::Template.register_tag('scene_break', WNS::SceneBreakTag)
2
+ Liquid::Template.register_tag('youtube', WNS::YoutubeTag)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-wns
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thai Chung
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-08 00:00:00.000000000 Z
11
+ date: 2021-06-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -23,6 +23,7 @@ files:
23
23
  - LICENSE
24
24
  - README.md
25
25
  - jekyll-wns.gemspec
26
+ - js/youtube.js
26
27
  - lib/.ruby-version
27
28
  - lib/jekyll-wns.rb
28
29
  - lib/jekyll-wns/assets/abbreviations.rb
@@ -31,6 +32,7 @@ files:
31
32
  - lib/jekyll-wns/assets/quads.rb
32
33
  - lib/jekyll-wns/assets/quads_filter.rb
33
34
  - lib/jekyll-wns/assets/scene_break_tag.rb
35
+ - lib/jekyll-wns/assets/youtube_tag.rb
34
36
  - lib/jekyll-wns/register_filters.rb
35
37
  - lib/jekyll-wns/register_hooks.rb
36
38
  - lib/jekyll-wns/register_tags.rb