Sha256: 6dea93a413c07d4fdfda6fda2f586dbebd20b5a942a2273d0fb51da94ef0c6f7

Contents?: true

Size: 798 Bytes

Versions: 21

Compression:

Stored size: 798 Bytes

Contents

# frozen_string_literal: true

module Onebox
  module Engine
    class SketchFabOnebox
      include Engine
      include StandardEmbed

      matches_regexp(/^https?:\/\/sketchfab\.com\/(?:models\/|3d-models\/(?:[^\/\s]+-)?)([a-z0-9]{32})/)
      always_https
      requires_iframe_origins("https://sketchfab.com")

      def to_html
        og = get_opengraph
        src = og.video_url.gsub("autostart=1", "")

        <<-HTML
          <iframe src="#{src}"
                  width="#{og.video_width}"
                  height="#{og.video_height}"
                  scrolling="no"
                  frameborder="0"
                  allowfullscreen>
          </iframe>
        HTML
      end

      def placeholder_html
        "<img src='#{get_opengraph.image}'>"
      end

    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
onebox-2.2.12 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.2.11 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.2.10 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.2.9 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.2.8 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.2.6 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.2.5 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.2.4 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.2.2 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.2.1 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.2.0 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.1.9 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.1.8 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.1.7 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.1.6 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.1.5 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.1.4 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.1.3 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.1.2 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.1.1 lib/onebox/engine/sketchfab_onebox.rb