Embed youtube videos in bookmarks

This commit is contained in:
2023-10-28 20:59:52 +11:00
parent 88885e8876
commit 6195f3b947
10 changed files with 2722 additions and 25 deletions

View File

@@ -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