Sha256: 87db31a1142af700016e2094b1ad88e8016cb2509839223ea85522181bbef32e

Contents?: true

Size: 799 Bytes

Versions: 3

Compression:

Stored size: 799 Bytes

Contents

module Onebox
  module Engine
    class GfycatOnebox
      include Engine
      include StandardEmbed

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

      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

3 entries across 3 versions & 1 rubygems

Version Path
onebox-1.6.1 lib/onebox/engine/gfycat_onebox.rb
onebox-1.6.0 lib/onebox/engine/gfycat_onebox.rb
onebox-1.5.65 lib/onebox/engine/gfycat_onebox.rb