Sha256: d73948a47ab6be3486808a57df0be2dbed4946b26287676ad42987636fc78a98

Contents?: true

Size: 904 Bytes

Versions: 43

Compression:

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

43 entries across 43 versions & 1 rubygems

Version Path
onebox-1.8.16 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.15 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.14 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.13 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.12 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.11 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.10 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.9 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.8 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.7 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.6 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.5 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.4 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.3 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.2 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.1 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.8.0 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.7.9 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.7.8 lib/onebox/engine/sketchfab_onebox.rb
onebox-1.7.7 lib/onebox/engine/sketchfab_onebox.rb