Embed youtube videos in bookmarks
This commit is contained in:
@@ -30,6 +30,16 @@ module Adamantium
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def youtube_embed
|
||||
pattern = /watch[?]v=(\w*)/i
|
||||
code = url.scan(pattern).flatten.first
|
||||
if code
|
||||
"<div class='video-container'><iframe width='100%' src='https://www.youtube.com/embed/#{code}' title='YouTube video player' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share' allowfullscreen></iframe></div>"
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user