Sha256: a4ff672bec2eaeec62d9edc3ae2a2ff39fc07642015c0b4b55f86b644de917ce

Contents?: true

Size: 743 Bytes

Versions: 49

Compression:

Stored size: 743 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

      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

49 entries across 49 versions & 1 rubygems

Version Path
onebox-2.0.2 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.0.1 lib/onebox/engine/sketchfab_onebox.rb
onebox-2.0.0 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.30 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.29 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.28.4 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.28.3 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.28.2 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.28.1 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.28 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.27.2 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.27.1 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.26 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.25 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.24 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.23 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.22 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.21 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.20 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.9.19 lib/onebox/engine/sketchfab_onebox.rb