From 24db78a7347fcfe36607108cb1e98f1cf53e0429 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 9 May 2014 20:31:56 -0700 Subject: [PATCH] Support twitch archive links Also drop which should only be needed for IE. --- src/Linkification/Linkify.coffee | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index 2f4374ef8..cd998f812 100755 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -347,19 +347,20 @@ Linkify = regExp: /.*(?:twitch.tv\/)([^#\&\?]*).*/ style: "border: none; width: 640px; height: 360px;" el: (a) -> - if result = /(\w+)\/(?:[a-z]\/)?(\d+)/i.exec a.dataset.uid - [_, channel, chapter] = result + if result = /(\w+)\/([bc])\/(\d+)/i.exec a.dataset.uid + [_, channel, type, id] = result + idparam = {'b': 'archive_id', 'c': 'chapter_id'} obj = $.el 'object', data: 'http://www.twitch.tv/widgets/archive_embed_player.swf' - obj.innerHTML = '' - obj.children[1].value = "channel=#{channel}&start_volume=25&auto_play=false#{if chapter then "&chapter_id=" + chapter else ""}" + obj.innerHTML = '' + obj.children[1].value = "channel=#{channel}&start_volume=25&auto_play=false&#{idparam[type]}=#{id}" obj else channel = (/(\w+)/.exec a.dataset.uid)[0] obj = $.el 'object', data: "http://www.twitch.tv/widgets/live_embed_player.swf?channel=#{channel}" - obj.innerHTML = '' - obj.children[2].value = "hostname=www.twitch.tv&channel=#{channel}&auto_play=true&start_volume=25" + obj.innerHTML = '' + obj.children[1].value = "hostname=www.twitch.tv&channel=#{channel}&auto_play=true&start_volume=25" obj , key: 'Vocaroo'