mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Support pausing GIFs for giphy/tenor oneboxes (#13194)
This commit is contained in:
@@ -171,7 +171,7 @@ require_relative "engine/imgur_onebox"
|
||||
require_relative "engine/pastebin_onebox"
|
||||
require_relative "engine/slides_onebox"
|
||||
require_relative "engine/xkcd_onebox"
|
||||
require_relative "engine/giphy_onebox"
|
||||
require_relative "engine/animated_image_onebox"
|
||||
require_relative "engine/gfycat_onebox"
|
||||
require_relative "engine/typeform_onebox"
|
||||
require_relative "engine/vimeo_onebox"
|
||||
|
||||
18
lib/onebox/engine/animated_image_onebox.rb
Normal file
18
lib/onebox/engine/animated_image_onebox.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Onebox
|
||||
module Engine
|
||||
class AnimatedImageOnebox
|
||||
include Engine
|
||||
include StandardEmbed
|
||||
|
||||
matches_regexp(/^https?:\/\/.*(giphy\.com|gph\.is|tenor\.com)\//)
|
||||
always_https
|
||||
|
||||
def to_html
|
||||
og = get_opengraph
|
||||
"<img src='#{og.image}' width='#{og.image_width}' height='#{og.image_height}' class='animated onebox' #{og.title_attr}>"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,23 +0,0 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user