gembed 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gembed/loom.rb +3 -3
- data/lib/gembed/youtube.rb +11 -7
- data/lib/gembed.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4afaa678c73a728078b4bf3a42c51cc6966ddd91b7a466456006c6839d667c87
|
4
|
+
data.tar.gz: d4f2caf1e786db3cfcb20d1fd2f6ac40c2dae970ae89a9ece5af158d83121523
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c98ea7c684f858026f9fb7e1b64c248f57a09401b17cde6b20bbf0099e7c258fc4b6b54e95a6b97806d96b8c35614ecd376628a19741a9407f58ad374a1e32f
|
7
|
+
data.tar.gz: a3e0abd42a8199a00c20338b55a35079322bdcac10a6255d0b731095b9b635770bc99b02d54f75502da451ce5e0f98e51cd3b0d0ea43de98b7228cb42cf49587
|
data/lib/gembed/loom.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Gembed
|
2
2
|
class Loom
|
3
|
-
def self.embed(
|
4
|
-
result = "<div style='position: relative; padding-bottom: 62.5%; height: 0;'><iframe src='https://www.loom.com/embed/#{find_id(
|
3
|
+
def self.embed(url)
|
4
|
+
result = "<div style='position: relative; padding-bottom: 62.5%; height: 0;'><iframe src='https://www.loom.com/embed/#{find_id(url)}' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen style='position: absolute; top: 0; left: 0; width: 100%; height: 100%;'></iframe></div>"
|
5
5
|
result.respond_to?(:html_safe) ? result.html_safe : result
|
6
6
|
end
|
7
7
|
|
8
|
-
def self.find_id(
|
8
|
+
def self.find_id(url)
|
9
9
|
url.split("share/")[1]
|
10
10
|
end
|
11
11
|
end
|
data/lib/gembed/youtube.rb
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
module Gembed
|
2
2
|
class Youtube
|
3
|
-
def self.embed(
|
4
|
-
result = "<div style='position: relative; padding-bottom: 62.5%; height: 0;'><iframe width='100%' height='100%' src='https://www.youtube.com/embed/#{find_id(
|
3
|
+
def self.embed(url)
|
4
|
+
result = "<div style='position: relative; padding-bottom: 62.5%; height: 0;'><iframe width='100%' height='100%' src='https://www.youtube.com/embed/#{find_id(url)}' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen style='position: absolute; top: 0; left: 0; width: 100%; height: 100%;'></iframe></div>"
|
5
5
|
result.respond_to?(:html_safe) ? result.html_safe : result
|
6
6
|
end
|
7
7
|
|
8
|
-
def self.find_id(
|
9
|
-
|
10
|
-
|
8
|
+
def self.find_id(url)
|
9
|
+
id = ''
|
10
|
+
url = url.gsub(/(>|<)/i,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/)
|
11
|
+
if url[2] != nil
|
12
|
+
id = url[2].split(/[^0-9a-z_\-]/i)
|
13
|
+
id = id[0];
|
11
14
|
else
|
12
|
-
url
|
15
|
+
id = url;
|
13
16
|
end
|
17
|
+
id
|
14
18
|
end
|
15
19
|
end
|
16
|
-
end
|
20
|
+
end
|
data/lib/gembed.rb
CHANGED