Sha256: 7320ad175c10cf5f8b29daf84d08b37bd875f60298ab376928669b063aa04202

Contents?: true

Size: 903 Bytes

Versions: 39

Compression:

Stored size: 903 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", "")
        escaped_src = ::Onebox::Helpers.normalize_url_for_output(src)

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

      def placeholder_html
        opengraph = get_opengraph
        escaped_src = ::Onebox::Helpers.normalize_url_for_output(opengraph[:image])
        "<img src='#{escaped_src}'>"
      end

    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
onebox-1.8.77 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.76 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.75 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.74 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.73 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.72 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.71 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.70 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.69 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.68 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.67 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.66 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.65 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.64 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.63 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.62 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.61 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.60 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.59 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.58 lib/onebox/engine/sketchfab_onebox.rb