From 0cafd9ae61b92ab65a4d7911c44843aa828e5c05 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Mon, 16 Dec 2013 13:45:56 -0700 Subject: [PATCH] Merge @mahkoh's embedding fixes --- builds/4chan-X.user.js | 16 +++++++++++++--- builds/crx/script.js | 16 +++++++++++++--- src/Linkification/Linkify.coffee | 12 +++++++++--- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index e41de865b..adb8608ce 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -5682,9 +5682,15 @@ LiveLeak: { regExp: /.*(?:liveleak.com\/view.+i=)([0-9a-z_]+)/, el: function(a) { - return $.el('object', { - innerHTML: "" + var ret; + + ret = $.el('iframe', { + width: "640", + height: "360", + src: "http://www.liveleak.com/ll_embed?i=" + a.dataset.uid, + frameborder: "0" }); + return ret.setAttribute("allowfullscreen", "true"); } }, MediaCrush: { @@ -5844,9 +5850,13 @@ YouTube: { regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([^#\&\?]*)\??(t\=.*)?/, el: function(a) { - return $.el('iframe', { + var ret; + + ret = $.el('iframe', { src: "//www.youtube.com/embed/" + a.dataset.uid + (a.dataset.option ? '#' + a.dataset.option : '') + "?wmode=opaque" }); + ret.setAttribute("allowfullscreen", "true"); + return ret; }, title: { api: function(uid) { diff --git a/builds/crx/script.js b/builds/crx/script.js index b87b61307..9a495460c 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -5687,9 +5687,15 @@ LiveLeak: { regExp: /.*(?:liveleak.com\/view.+i=)([0-9a-z_]+)/, el: function(a) { - return $.el('object', { - innerHTML: "" + var ret; + + ret = $.el('iframe', { + width: "640", + height: "360", + src: "http://www.liveleak.com/ll_embed?i=" + a.dataset.uid, + frameborder: "0" }); + return ret.setAttribute("allowfullscreen", "true"); } }, MediaCrush: { @@ -5849,9 +5855,13 @@ YouTube: { regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([^#\&\?]*)\??(t\=.*)?/, el: function(a) { - return $.el('iframe', { + var ret; + + ret = $.el('iframe', { src: "//www.youtube.com/embed/" + a.dataset.uid + (a.dataset.option ? '#' + a.dataset.option : '') + "?wmode=opaque" }); + ret.setAttribute("allowfullscreen", "true"); + return ret; }, title: { api: function(uid) { diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index 164756d07..c128b161e 100755 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -288,8 +288,12 @@ Linkify = LiveLeak: regExp: /.*(?:liveleak.com\/view.+i=)([0-9a-z_]+)/ el: (a) -> - $.el 'object', - innerHTML: "" + ret = $.el 'iframe', + width: "640", + height: "360", + src: "http://www.liveleak.com/ll_embed?i=#{a.dataset.uid}", + frameborder: "0" + ret.setAttribute "allowfullscreen", "true" MediaCrush: regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i @@ -404,8 +408,10 @@ Linkify = YouTube: regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([^#\&\?]*)\??(t\=.*)?/ el: (a) -> - $.el 'iframe', + ret = $.el 'iframe', src: "//www.youtube.com/embed/#{a.dataset.uid}#{if a.dataset.option then '#' + a.dataset.option else ''}?wmode=opaque" + ret.setAttribute "allowfullscreen", "true" + ret title: api: (uid) -> "https://gdata.youtube.com/feeds/api/videos/#{uid}?alt=json&fields=title/text(),yt:noembed,app:control/yt:state/@reasonCode" text: (data) -> data.entry.title.$t