Support twitch archive links

Also drop <param name=movie> which should only be needed for IE.
This commit is contained in:
ccd0 2014-05-09 20:31:56 -07:00
parent 2e3aa93ef2
commit 24db78a734

View File

@ -347,19 +347,20 @@ Linkify =
regExp: /.*(?:twitch.tv\/)([^#\&\?]*).*/ regExp: /.*(?:twitch.tv\/)([^#\&\?]*).*/
style: "border: none; width: 640px; height: 360px;" style: "border: none; width: 640px; height: 360px;"
el: (a) -> el: (a) ->
if result = /(\w+)\/(?:[a-z]\/)?(\d+)/i.exec a.dataset.uid if result = /(\w+)\/([bc])\/(\d+)/i.exec a.dataset.uid
[_, channel, chapter] = result [_, channel, type, id] = result
idparam = {'b': 'archive_id', 'c': 'chapter_id'}
obj = $.el 'object', obj = $.el 'object',
data: 'http://www.twitch.tv/widgets/archive_embed_player.swf' data: 'http://www.twitch.tv/widgets/archive_embed_player.swf'
obj.innerHTML = '<param name="allowFullScreen" value="true" /><param name="flashvars" />' obj.innerHTML = '<param name="allowFullScreen" value="true"><param name="flashvars">'
obj.children[1].value = "channel=#{channel}&start_volume=25&auto_play=false#{if chapter then "&chapter_id=" + chapter else ""}" obj.children[1].value = "channel=#{channel}&start_volume=25&auto_play=false&#{idparam[type]}=#{id}"
obj obj
else else
channel = (/(\w+)/.exec a.dataset.uid)[0] channel = (/(\w+)/.exec a.dataset.uid)[0]
obj = $.el 'object', obj = $.el 'object',
data: "http://www.twitch.tv/widgets/live_embed_player.swf?channel=#{channel}" data: "http://www.twitch.tv/widgets/live_embed_player.swf?channel=#{channel}"
obj.innerHTML = '<param name="allowFullScreen" value="true" /><param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" /><param name="flashvars" />' obj.innerHTML = '<param name="allowFullScreen" value="true"><param name="flashvars">'
obj.children[2].value = "hostname=www.twitch.tv&channel=#{channel}&auto_play=true&start_volume=25" obj.children[1].value = "hostname=www.twitch.tv&channel=#{channel}&auto_play=true&start_volume=25"
obj obj
, ,
key: 'Vocaroo' key: 'Vocaroo'