Class: Onebox::Engine::GfycatOnebox
- Inherits:
-
Object
- Object
- Onebox::Engine::GfycatOnebox
- Includes:
- Onebox::Engine, JSON
- Defined in:
- lib/onebox/engine/gfycat_onebox.rb
Constant Summary
Constants included from Onebox::Engine
Instance Attribute Summary
Attributes included from Onebox::Engine
#errors, #options, #timeout, #uri, #url
Class Method Summary collapse
-
.priority ⇒ Object
This engine should have priority over AllowlistedGenericOnebox.
Instance Method Summary collapse
Methods included from Onebox::Engine
all_iframe_origins, engines, included, #initialize, origins_to_regexes
Class Method Details
.priority ⇒ Object
This engine should have priority over AllowlistedGenericOnebox.
13 14 15 |
# File 'lib/onebox/engine/gfycat_onebox.rb', line 13 def self.priority 1 end |
Instance Method Details
#placeholder_html ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/onebox/engine/gfycat_onebox.rb', line 51 def placeholder_html <<-HTML <a href="#{data[:url]}"> <img src="#{data[:posterUrl]}" width="#{data[:width]}" height="#{data[:height]}"><br/> #{data[:name]} </a> HTML end |
#to_html ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/onebox/engine/gfycat_onebox.rb', line 17 def to_html <<-HTML <aside class="onebox gfycat"> <header class="source"> <img src="https://gfycat.com/static/favicons/favicon-96x96.png" class="site-icon" width="64" height="64"> <a href="#{data[:url]}" target="_blank" rel="nofollow ugc noopener">Gfycat.com</a> </header> <article class="onebox-body"> <h4> #{data[:title]} by <a href="https://gfycat.com/@#{data[:]}" target="_blank" rel="nofollow ugc noopener"> <span>#{data[:]}</span> </a> </h4> <div class="video" style="--aspect-ratio: #{data[:width]}/#{data[:height]}"> <video controls loop muted poster="#{data[:posterUrl]}"> <source id="webmSource" src="#{data[:webmUrl]}" type="video/webm"> <source id="mp4Source" src="#{data[:mp4Url]}" type="video/mp4"> <img title="Sorry, your browser doesn't support HTML5 video." src="#{data[:posterUrl]}"> </video> </div> <p> <span class="label1">#{data[:keywords]}</span> </p> </article> <div style="clear: both"></div> </aside> HTML end |