diff --git a/CHANGELOG.md b/CHANGELOG.md index d94ea843c..c1721c916 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ seaweedchan: - External image embedding +- Account for time options in youtube links for embedding ### 1.1.6 - 2013-05-01 seaweedchan: diff --git a/builds/4chan-X.js b/builds/4chan-X.js index b3d35e86f..837b32d25 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -4224,10 +4224,10 @@ }, types: { YouTube: { - regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([^#\&\?]*).*/, + regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([^#\&\?]*)\??(t\=.*)?/, el: function() { return $.el('iframe', { - src: "//www.youtube.com/embed/" + this.name + src: "//www.youtube.com/embed/" + this.name + (this.option ? '#' + this.option : '') }); }, title: { @@ -4390,6 +4390,7 @@ } embed = $.el('a', { name: (a.name = match[1]), + option: match[2], className: 'embedder', href: 'javascript:;', textContent: '(embed)' diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index aaafd27bb..fa8040cbd 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -4220,10 +4220,10 @@ }, types: { YouTube: { - regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([^#\&\?]*).*/, + regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([^#\&\?]*)\??(t\=.*)?/, el: function() { return $.el('iframe', { - src: "//www.youtube.com/embed/" + this.name + src: "//www.youtube.com/embed/" + this.name + (this.option ? '#' + this.option : '') }); }, title: { @@ -4386,6 +4386,7 @@ } embed = $.el('a', { name: (a.name = match[1]), + option: match[2], className: 'embedder', href: 'javascript:;', textContent: '(embed)' diff --git a/builds/crx/script.js b/builds/crx/script.js index 0107724b2..a0e3ffc46 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -4222,10 +4222,10 @@ }, types: { YouTube: { - regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([^#\&\?]*).*/, + regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([^#\&\?]*)\??(t\=.*)?/, el: function() { return $.el('iframe', { - src: "//www.youtube.com/embed/" + this.name + src: "//www.youtube.com/embed/" + this.name + (this.option ? '#' + this.option : '') }); }, title: { @@ -4388,6 +4388,7 @@ } embed = $.el('a', { name: (a.name = match[1]), + option: match[2], className: 'embedder', href: 'javascript:;', textContent: '(embed)' diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index bcccc3f26..b3165ad06 100644 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -144,10 +144,10 @@ Linkify = types: YouTube: - regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([^#\&\?]*).*/ + regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([^#\&\?]*)\??(t\=.*)?/ el: -> $.el 'iframe', - src: "//www.youtube.com/embed/#{@name}" + src: "//www.youtube.com/embed/#{@name}#{if @option then '#' + @option else ''}" title: api: -> "https://gdata.youtube.com/feeds/api/videos/#{@name}?alt=json&fields=title/text(),yt:noembed,app:control/yt:state/@reasonCode" text: -> JSON.parse(@responseText).entry.title.$t @@ -249,6 +249,7 @@ Linkify = embed = $.el 'a', name: (a.name = match[1]) + option: match[2] className: 'embedder' href: 'javascript:;' textContent: '(embed)'