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-21 14:27:51 +00:00
|
|
|
|
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')
|
2022-01-23 00:18:51 +00:00
|
|
|
.on('click', =>
|
2015-06-30 01:32:18 +00:00
|
|
|
super(data)
|
2015-06-21 14:27:51 +00:00
|
|
|
)
|
2015-06-30 01:32:18 +00:00
|
|
|
.appendTo(alert.find('.alert'))
|
|
|
|
removeOld(alert)
|