2021-05-28 08:40:30 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Onebox
|
|
|
|
module Engine
|
|
|
|
class AnimatedImageOnebox
|
|
|
|
include Engine
|
|
|
|
include StandardEmbed
|
|
|
|
|
|
|
|
always_https
|
2024-12-19 11:01:54 -07:00
|
|
|
matches_domain("giphy.com", "gph.is", "tenor.com")
|
2021-05-28 08:40:30 -04:00
|
|
|
|
|
|
|
def to_html
|
|
|
|
og = get_opengraph
|
2021-05-28 15:10:32 -04:00
|
|
|
if og.image
|
|
|
|
"<img src='#{og.image}' width='#{og.image_width}' height='#{og.image_height}' class='animated onebox' #{og.title_attr}>"
|
|
|
|
else
|
|
|
|
escaped_url = ::Onebox::Helpers.normalize_url_for_output(@url)
|
|
|
|
"<img src='#{escaped_url}' class='animated onebox'>"
|
|
|
|
end
|
2021-05-28 08:40:30 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|