Sha256: 8509b2df28bf8b0701c76b751b66bb9026351f2bb108507de179b1b251cba3cb

Contents?: true

Size: 748 Bytes

Versions: 12

Compression:

Stored size: 748 Bytes

Contents

module Onebox
  module Engine
    class SketchFabOnebox
      include Engine
      include StandardEmbed

      matches_regexp(/^https?:\/\/sketchfab\.com\/models\/[a-z0-9]{32}/)
      always_https

      def to_html
        opengraph = get_opengraph

        src = opengraph[:video_url].gsub("?autostart=1", "")

        <<-HTML
          <iframe src="#{src}"
                  width="#{opengraph[:video_width]}"
                  height="#{opengraph[:video_height]}"
                  scrolling="no"
                  frameborder="0"
                  allowfullscreen>
          </iframe>
        HTML
      end

      def placeholder_html
        opengraph = get_opengraph
        "<img src='#{opengraph[:image]}'>"
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
onebox-1.7.3 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.7.2 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.7.1 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.7.0 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.6.9 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.6.8 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.6.7 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.6.6 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.6.5 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.6.4 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.6.3 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.6.2 lib/onebox/engine/sketchfab_onebox.rb