Sha256: d73ce5fcbd8822d1642657d4314e213b521d74c20f71d39a99f1414af74789a6

Contents?: true

Size: 576 Bytes

Versions: 23

Compression:

Stored size: 576 Bytes

Contents

module Onebox
  module Engine
    class GiphyOnebox
      include Engine
      include StandardEmbed

      matches_regexp(/^https?:\/\/(giphy\.com\/gifs|gph\.is)\//)
      always_https

      def to_html
        oembed = get_oembed
        escaped_url = ::Onebox::Helpers.normalize_url_for_output(oembed[:url])

        <<-HTML
          <a href="#{escaped_url}" target="_blank" class="onebox">
            <img src="#{escaped_url}" width="#{oembed[:width]}" height="#{oembed[:height]}" #{Helpers.title_attr(oembed)}>
          </a>
        HTML
      end

    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

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