Sha256: 8d24bd7464e1ab9949c441e5ca140c97b0da7ca02332d5c4371f5bf9d1267021

Contents?: true

Size: 818 Bytes

Versions: 12

Compression:

Stored size: 818 Bytes

Contents

module Onebox
  module Engine
    class GfycatOnebox
      include Engine
      include StandardEmbed

      matches_regexp(/^https?:\/\/gfycat\.com\//)
      always_https

      def to_html
        oembed = get_oembed
        src = Nokogiri::HTML::fragment(oembed[:html]).at_css("iframe")["src"]

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

      def placeholder_html
        opengraph = get_opengraph

        <<-HTML
          <img src="#{opengraph[:image]}" width=""#{opengraph[:image_width]}" height=""#{opengraph[:image_height]}">
        HTML
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

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