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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d78fa02c77595aa578a6e136df7913ebdb603a7f
4
- data.tar.gz: f6589ad34edb17076fa4676c9d2293113537711a
3
+ metadata.gz: c343cf7a73ddb313f695e3e204a0ed2127703eb8
4
+ data.tar.gz: 9b719175ee29e29ae3a8276f5d6b9ae58676b9f1
5
5
  SHA512:
6
- metadata.gz: 226283dc64db161b903fa1bb972fc2e2ff19492ccbe7bb34b0aa6a7ae2124f928cf1b83480c1c2309f9c24eaf5a5e7b65aa70148421c016f960594ba56b7b471
7
- data.tar.gz: 081308bc38555d0b0ff90c69221ddb5ec4f080e4bdbedd01e640067dfc644ad9879b62849762271eb41c8dc6415126ec9c2f1088d76806fca170ce2593bc24e4
6
+ metadata.gz: 1d036c84bd28cc59e045b046fbbcbc46cf2f03e11a0d3402615ab459523f02831803af00a961d517f5119d2dde4eab6d1bd52700b0d538468860a6a49b82253d
7
+ data.tar.gz: ed716a34e674d93e4276153aa80ede54ce2c2bca155a2ca70d6f3472df57fbc55a49b8a9c0cfe074fe5a4c18a21cee843574144d2e1e6d58037ef3ac12d8ad94
@@ -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
- if width && height
96
- aiframe = %Q|<amp-iframe src="#{src}" width="#{width}" height="#{height}" layout="#{@options[:iframe_layout]}"></amp-layout>|
97
- tag.replace(aiframe)
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
- tag.replace(@options[:image_fetch_error_callback].call(src))
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
@@ -1,3 +1,3 @@
1
1
  module Ampize
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ampize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - devneko