Fixed Twitch.tv embeds
VOD embeds were broken due to a new URL scheme (legacy support maintained) Clip embed support has been added
This commit is contained in:
parent
e6c1f5502b
commit
c8c95a3cf0
@ -422,12 +422,15 @@ Embedding =
|
|||||||
text: (_) -> _.title
|
text: (_) -> _.title
|
||||||
,
|
,
|
||||||
key: 'TwitchTV'
|
key: 'TwitchTV'
|
||||||
regExp: /^\w+:\/\/(?:www\.|secure\.)?twitch\.tv\/(\w[^#\&\?]*)/
|
regExp: /^\w+:\/\/(?:www\.|secure\.|clips\.)?twitch\.tv\/(\w[^#\&\?]*)/
|
||||||
el: (a) ->
|
el: (a) ->
|
||||||
m = a.dataset.uid.match /(\w+)(?:\/v\/(\d+))?/
|
if a.dataset.href.match(/^\w+:\/\/(www\.|secure\.|clips\.)?twitch\.tv/)[1] is 'clips.'
|
||||||
url = "//player.twitch.tv/?#{if m[2] then "video=v#{m[2]}" else "channel=#{m[1]}"}&autoplay=false&parent=#{location.hostname}"
|
url = "//clips.twitch.tv/embed?clip=#{a.dataset.uid}&parent=#{location.hostname}"
|
||||||
if (time = a.dataset.href.match /\bt=(\w+)/)
|
else
|
||||||
url += "&time=#{time[1]}"
|
m = a.dataset.uid.match /(\w+)(?:\/(?:v\/)?(\d+))?/
|
||||||
|
url = "//player.twitch.tv/?#{if m[2] then "video=v#{m[2]}" else "channel=#{m[1]}"}&autoplay=false&parent=#{location.hostname}"
|
||||||
|
if (time = a.dataset.href.match /\bt=(\w+)/)
|
||||||
|
url += "&time=#{time[1]}"
|
||||||
el = $.el 'iframe',
|
el = $.el 'iframe',
|
||||||
src: url
|
src: url
|
||||||
el.setAttribute "allowfullscreen", "true"
|
el.setAttribute "allowfullscreen", "true"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user