mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 00:51:03 +08:00
Merge pull request #3502 from techAPJ/patch-3
UX: allow youtube embed width and height to be passed as param
This commit is contained in:
commit
bdde331e7a
|
@ -17,8 +17,11 @@ class Onebox::Engine::YoutubeOnebox
|
|||
|
||||
def to_html
|
||||
if video_id
|
||||
video_width = (params['width'] && params['width'].to_i <= 695) ? params['width'] : 480 # embed width
|
||||
video_height = (params['height'] && params['height'].to_i <= 500) ? params['height'] : 270 # embed height
|
||||
|
||||
# Put in the LazyYT div instead of the iframe
|
||||
"<div class=\"lazyYT\" data-youtube-id=\"#{video_id}\" data-youtube-title=\"#{video_title}\" data-width=\"480\" data-height=\"270\" data-parameters=\"#{embed_params}\"></div>"
|
||||
"<div class=\"lazyYT\" data-youtube-id=\"#{video_id}\" data-youtube-title=\"#{video_title}\" data-width=\"#{video_width}\" data-height=\"#{video_height}\" data-parameters=\"#{embed_params}\"></div>"
|
||||
else
|
||||
super
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user