From ead2ce2d69dcd5e89cba5b4bfc1887ecca08ab72 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 15 Feb 2015 15:23:37 -0800 Subject: [PATCH] Fix image/audio/video link embedding after (embed) link change. --- src/Linkification/Embedding.coffee | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Linkification/Embedding.coffee b/src/Linkification/Embedding.coffee index 46bedf9ab..e68fe1e9f 100644 --- a/src/Linkification/Embedding.coffee +++ b/src/Linkification/Embedding.coffee @@ -42,6 +42,7 @@ Embedding = embed: (data) -> {key, uid, options, link, post} = data + {href} = link $.addClass link, key.toLowerCase() if Embedding.types[key].httpOnly and location.protocol isnt 'http:' @@ -58,7 +59,7 @@ Embedding = href: 'javascript:;' textContent: '(embed)' - embed.dataset[name] = value for name, value of {key, uid, options} + embed.dataset[name] = value for name, value of {key, uid, options, href} $.on embed, 'click', Embedding.cb.toggle $.after link, [$.tn(' '), embed] @@ -177,7 +178,7 @@ Embedding = $.el 'audio', controls: true preload: 'auto' - src: a.href + src: a.dataset.href , key: 'Gist' regExp: /^\w+:\/\/gist\.github\.com\/(?:[\w\-]+\/)?(\w+)/ @@ -196,7 +197,7 @@ Embedding = regExp: /\.(?:gif|png|jpg|jpeg|bmp)(?:\?|$)/i style: '' el: (a) -> - $.el 'div', <%= html('') %> + $.el 'div', <%= html('') %> , key: 'InstallGentoo' regExp: /^\w+:\/\/paste\.installgentoo\.com\/view\/(?:raw\/|download\/|embed\/)?(\w+)/ @@ -245,7 +246,7 @@ Embedding = for ext, i in ['mp4', 'webm'] el.firstChild.children[i].src = "https://mediacru.sh/#{a.dataset.uid}.#{ext}" when 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg' - $.extend el, <%= html('') %> + $.extend el, <%= html('') %> when 'audio/mpeg', 'audio/ogg' $.extend el, <%= html('') %> else @@ -405,5 +406,5 @@ Embedding = $.el 'video', controls: true preload: 'auto' - src: a.href + src: a.dataset.href ]