Class: Onebox::Engine::TiktokOnebox
- Inherits:
-
Object
- Object
- Onebox::Engine::TiktokOnebox
- Includes:
- Onebox::Engine, StandardEmbed
- Defined in:
- lib/onebox/engine/tiktok_onebox.rb
Instance Attribute Summary
Attributes included from Onebox::Engine
#errors, #options, #timeout, #uri, #url
Instance Method Summary collapse
Methods included from StandardEmbed
add_oembed_provider, add_opengraph_provider, #always_https?, oembed_providers, opengraph_providers, #raw
Methods included from Onebox::Engine
all_iframe_origins, engines, included, #initialize, origins_to_regexes
Instance Method Details
#placeholder_html ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/onebox/engine/tiktok_onebox.rb', line 13 def placeholder_html <<-HTML <img src="#{.thumbnail_url}" title="#{.title}" style=" max-width: #{.thumbnail_width / 2}px; max-height: #{.thumbnail_height / 2}px;" > HTML end |
#to_html ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/onebox/engine/tiktok_onebox.rb', line 25 def to_html video_height = .thumbnail_height < 1024 ? 998 : .thumbnail_height height = (323.0 / 576) * video_height <<-HTML <iframe class="tiktok-onebox" src="https://www.tiktok.com/embed/v2/#{.}" sandbox="allow-popups allow-popups-to-escape-sandbox allow-scripts allow-top-navigation allow-same-origin" frameborder="0" seamless="seamless" scrolling="no" style=" min-width: 323px; height: #{height}px; border: 4px solid #fff; border-top: 3px solid #fff; background-color: #fff; border-radius: 9px; " ></iframe> HTML end |