CyTube/player/twitchclip.coffee

22 lines
709 B
CoffeeScript
Raw Normal View History

2020-01-27 04:20:37 +00:00
window.TwitchClipPlayer = class TwitchClipPlayer extends EmbedPlayer
constructor: (data) ->
if not (this instanceof TwitchClipPlayer)
return new TwitchClipPlayer(data)
@load(data)
load: (data) ->
2020-06-23 02:39:00 +00:00
if location.hostname != location.host or location.protocol != 'https:'
alert = makeAlert(
'Twitch API Parameters',
window.TWITCH_PARAMS_ERROR,
'alert-danger'
).removeClass('col-md-12')
removeOld(alert)
return
2020-01-27 04:20:37 +00:00
data.meta.embed =
tag: 'iframe'
2020-06-23 02:39:00 +00:00
src: "https://clips.twitch.tv/embed?clip=#{data.id}&parent=#{location.host}"
2020-01-27 04:20:37 +00:00
super(data)