allow start time for YouTube videos

This commit is contained in:
jomo
2015-02-08 02:03:42 +01:00
parent 61f51666fb
commit 19cf175050

View File

@@ -74,9 +74,9 @@ module ApplicationHelper
def render_youtube(content)
# TODO: render only in text blocks, not in code/quotes/etc
return content.gsub(
/\[yt:([a-zA-Z0-9\-_]+)\]/,
/\[yt:([a-zA-Z0-9\-_]+)(:(\d+))?\]/,
"<iframe class='youtube' allowfullscreen src='
https://www.youtube-nocookie.com/embed/\\1?theme=light&vq=hd720&hd=1&iv_load_policy=3&showinfo=1&showsearch=0&rel=0&modestbranding&hd=1&autohide=1&html5=1'>
https://www.youtube-nocookie.com/embed/\\1?theme=light&vq=hd720&hd=1&iv_load_policy=3&showinfo=1&showsearch=0&rel=0&modestbranding&hd=1&autohide=1&html5=1&start=\\3'>
</iframe>")
end
end