fix youtube start time, make youtube embedding more robust against garbage appended to URLs

This commit is contained in:
ccd0 2014-06-08 01:16:08 -07:00
parent f9982023c0
commit f708da1240

View File

@ -386,10 +386,11 @@ Linkify =
src: "https://vine.co/#{a.dataset.uid}/card"
,
key: 'YouTube'
regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([^#\&\?]*)\??(t\=.*)?/
regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([\w-]{11})[^#\&\?]?(.*)/
el: (a) ->
start = a.dataset.options.match /\b(?:star)?t\=(\w+)/
el = $.el 'iframe',
src: "//www.youtube.com/embed/#{a.dataset.uid}#{if a.dataset.option then '#' + a.dataset.option else ''}?wmode=opaque"
src: "//www.youtube.com/embed/#{a.dataset.uid}?wmode=opaque#{if start then '&start=' + start[1] else ''}"
el.setAttribute "allowfullscreen", "true"
el
title: