ampize 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ampize.rb +8 -5
- data/lib/ampize/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c343cf7a73ddb313f695e3e204a0ed2127703eb8
|
4
|
+
data.tar.gz: 9b719175ee29e29ae3a8276f5d6b9ae58676b9f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d036c84bd28cc59e045b046fbbcbc46cf2f03e11a0d3402615ab459523f02831803af00a961d517f5119d2dde4eab6d1bd52700b0d538468860a6a49b82253d
|
7
|
+
data.tar.gz: ed716a34e674d93e4276153aa80ede54ce2c2bca155a2ca70d6f3472df57fbc55a49b8a9c0cfe074fe5a4c18a21cee843574144d2e1e6d58037ef3ac12d8ad94
|
data/lib/ampize.rb
CHANGED
@@ -13,7 +13,8 @@ module Ampize
|
|
13
13
|
@options = {
|
14
14
|
image_layout: 'responsive',
|
15
15
|
image_fetch_error_callback: default_error_callback,
|
16
|
-
iframe_layout: 'responsive'
|
16
|
+
iframe_layout: 'responsive',
|
17
|
+
iframe_sandbox: 'allow-scripts'
|
17
18
|
}
|
18
19
|
@options.merge!(options)
|
19
20
|
end
|
@@ -92,11 +93,13 @@ module Ampize
|
|
92
93
|
width = width.value.to_s
|
93
94
|
height = height.value.to_s
|
94
95
|
end
|
95
|
-
|
96
|
-
|
97
|
-
tag.
|
96
|
+
invalid = !(src.index('https') == 0)
|
97
|
+
if invalid
|
98
|
+
ch = '<div>' + tag.children.to_xml + '</div>'
|
99
|
+
tag.replace(ch)
|
98
100
|
else
|
99
|
-
|
101
|
+
aiframe = %Q|<amp-iframe src="#{src}" width="#{width}" height="#{height}" layout="#{@options[:iframe_layout]}" sandbox="#{@options[:iframe_sandbox]}"></amp-layout>|
|
102
|
+
tag.replace(aiframe)
|
100
103
|
end
|
101
104
|
end
|
102
105
|
end
|
data/lib/ampize/version.rb
CHANGED