Fix image/audio/video link embedding after (embed) link change.
This commit is contained in:
parent
597ea05030
commit
ead2ce2d69
@ -42,6 +42,7 @@ Embedding =
|
|||||||
|
|
||||||
embed: (data) ->
|
embed: (data) ->
|
||||||
{key, uid, options, link, post} = data
|
{key, uid, options, link, post} = data
|
||||||
|
{href} = link
|
||||||
$.addClass link, key.toLowerCase()
|
$.addClass link, key.toLowerCase()
|
||||||
|
|
||||||
if Embedding.types[key].httpOnly and location.protocol isnt 'http:'
|
if Embedding.types[key].httpOnly and location.protocol isnt 'http:'
|
||||||
@ -58,7 +59,7 @@ Embedding =
|
|||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
textContent: '(embed)'
|
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
|
$.on embed, 'click', Embedding.cb.toggle
|
||||||
$.after link, [$.tn(' '), embed]
|
$.after link, [$.tn(' '), embed]
|
||||||
@ -177,7 +178,7 @@ Embedding =
|
|||||||
$.el 'audio',
|
$.el 'audio',
|
||||||
controls: true
|
controls: true
|
||||||
preload: 'auto'
|
preload: 'auto'
|
||||||
src: a.href
|
src: a.dataset.href
|
||||||
,
|
,
|
||||||
key: 'Gist'
|
key: 'Gist'
|
||||||
regExp: /^\w+:\/\/gist\.github\.com\/(?:[\w\-]+\/)?(\w+)/
|
regExp: /^\w+:\/\/gist\.github\.com\/(?:[\w\-]+\/)?(\w+)/
|
||||||
@ -196,7 +197,7 @@ Embedding =
|
|||||||
regExp: /\.(?:gif|png|jpg|jpeg|bmp)(?:\?|$)/i
|
regExp: /\.(?:gif|png|jpg|jpeg|bmp)(?:\?|$)/i
|
||||||
style: ''
|
style: ''
|
||||||
el: (a) ->
|
el: (a) ->
|
||||||
$.el 'div', <%= html('<a target="_blank" href="${a.href}"><img src="${a.href}" style="max-width: 80vw; max-height: 80vh;"></a>') %>
|
$.el 'div', <%= html('<a target="_blank" href="${a.dataset.href}"><img src="${a.dataset.href}" style="max-width: 80vw; max-height: 80vh;"></a>') %>
|
||||||
,
|
,
|
||||||
key: 'InstallGentoo'
|
key: 'InstallGentoo'
|
||||||
regExp: /^\w+:\/\/paste\.installgentoo\.com\/view\/(?:raw\/|download\/|embed\/)?(\w+)/
|
regExp: /^\w+:\/\/paste\.installgentoo\.com\/view\/(?:raw\/|download\/|embed\/)?(\w+)/
|
||||||
@ -245,7 +246,7 @@ Embedding =
|
|||||||
for ext, i in ['mp4', 'webm']
|
for ext, i in ['mp4', 'webm']
|
||||||
el.firstChild.children[i].src = "https://mediacru.sh/#{a.dataset.uid}.#{ext}"
|
el.firstChild.children[i].src = "https://mediacru.sh/#{a.dataset.uid}.#{ext}"
|
||||||
when 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg'
|
when 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg'
|
||||||
$.extend el, <%= html('<a target="_blank" href="${a.href}"><img src="https://mediacru.sh/${file.file}" style="max-width: 80vw; max-height: 80vh;"></a>') %>
|
$.extend el, <%= html('<a target="_blank" href="${a.dataset.href}"><img src="https://mediacru.sh/${file.file}" style="max-width: 80vw; max-height: 80vh;"></a>') %>
|
||||||
when 'audio/mpeg', 'audio/ogg'
|
when 'audio/mpeg', 'audio/ogg'
|
||||||
$.extend el, <%= html('<audio controls><source type="audio/ogg" src="https://mediacru.sh/${a.dataset.uid}.ogg"></audio>') %>
|
$.extend el, <%= html('<audio controls><source type="audio/ogg" src="https://mediacru.sh/${a.dataset.uid}.ogg"></audio>') %>
|
||||||
else
|
else
|
||||||
@ -405,5 +406,5 @@ Embedding =
|
|||||||
$.el 'video',
|
$.el 'video',
|
||||||
controls: true
|
controls: true
|
||||||
preload: 'auto'
|
preload: 'auto'
|
||||||
src: a.href
|
src: a.dataset.href
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user