Merge remote-tracking branch 'WastedMeerkat/master'

This commit is contained in:
ccd0 2022-05-23 00:46:04 -07:00
commit 127dd21ae4

View File

@ -422,12 +422,16 @@ Embedding =
text: (_) -> _.title text: (_) -> _.title
, ,
key: 'TwitchTV' key: 'TwitchTV'
regExp: /^\w+:\/\/(?:www\.|secure\.)?twitch\.tv\/(\w[^#\&\?]*)/ regExp: /^\w+:\/\/(?:www\.|secure\.|clips\.|m\.)?twitch\.tv\/(\w[^#\&\?]*)/
el: (a) -> el: (a) ->
m = a.dataset.uid.match /(\w+)(?:\/v\/(\d+))?/ m = a.dataset.href.match /^\w+:\/\/(?:(clips\.)|\w+\.)?twitch\.tv\/(?:\w+\/)?(clip\/)?(\w[^#\&\?]*)/;
url = "//player.twitch.tv/?#{if m[2] then "video=v#{m[2]}" else "channel=#{m[1]}"}&autoplay=false&parent=#{location.hostname}" if m[1] or m[2]
if (time = a.dataset.href.match /\bt=(\w+)/) url = "//clips.twitch.tv/embed?clip=#{m[3]}&parent=#{location.hostname}"
url += "&time=#{time[1]}" else
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"