sync/player/custom-embed.coffee

29 lines
1.0 KiB
CoffeeScript
Raw Normal View History

2015-06-30 01:32:18 +00:00
CUSTOM_EMBED_WARNING = 'This channel is embedding custom content from %link%.
Since this content is not trusted, you must click "Embed" below to allow
the content to be embedded.<hr>'
2015-06-30 01:32:18 +00:00
window.CustomEmbedPlayer = class CustomEmbedPlayer extends EmbedPlayer
2015-06-18 22:46:33 +00:00
constructor: (data) ->
if not (this instanceof CustomEmbedPlayer)
return new CustomEmbedPlayer(data)
@load(data)
load: (data) ->
2015-06-30 01:32:18 +00:00
if not data.meta.embed?
2015-06-18 22:46:33 +00:00
console.error('CustomEmbedPlayer::load(): missing meta.embed')
return
2015-06-30 01:32:18 +00:00
embedSrc = data.meta.embed.src
link = "<a href=\"#{embedSrc}\" target=\"_blank\"><strong>#{embedSrc}</strong></a>"
alert = makeAlert('Untrusted Content', CUSTOM_EMBED_WARNING.replace('%link%', link),
'alert-warning')
.removeClass('col-md-12')
$('<button/>').addClass('btn btn-default')
.text('Embed')
.click(=>
super(data)
)
2015-06-30 01:32:18 +00:00
.appendTo(alert.find('.alert'))
removeOld(alert)