mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
24 lines
527 B
Ruby
24 lines
527 B
Ruby
![]() |
# frozen_string_literal: true
|
||
|
|
||
|
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
|
||
|
|
||
|
<<-HTML
|
||
|
<a href="#{oembed.url}" target="_blank" rel="noopener" class="onebox">
|
||
|
<img src="#{oembed.url}" width="#{oembed.width}" height="#{oembed.height}" #{oembed.title_attr}>
|
||
|
</a>
|
||
|
HTML
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|