make (embed) link point to the URL
This commit is contained in:
parent
f6641ee54e
commit
246b43da74
@ -151,13 +151,12 @@ Linkify =
|
|||||||
|
|
||||||
embed: (data) ->
|
embed: (data) ->
|
||||||
[key, uid, options, link, post] = data
|
[key, uid, options, link, post] = data
|
||||||
href = link.href
|
|
||||||
embed = $.el 'a',
|
embed = $.el 'a',
|
||||||
className: 'embedder'
|
className: 'embedder'
|
||||||
href: 'javascript:;'
|
href: link.href
|
||||||
textContent: '(embed)'
|
textContent: '(embed)'
|
||||||
|
|
||||||
embed.dataset[name] = value for name, value of {key, href, uid, options}
|
embed.dataset[name] = value for name, value of {key, uid, options}
|
||||||
|
|
||||||
$.addClass link, "#{embed.dataset.key}"
|
$.addClass link, "#{embed.dataset.key}"
|
||||||
|
|
||||||
@ -181,7 +180,8 @@ Linkify =
|
|||||||
return
|
return
|
||||||
|
|
||||||
cb:
|
cb:
|
||||||
toggle: ->
|
toggle: (e) ->
|
||||||
|
e?.preventDefault()
|
||||||
if $.hasClass @, "embedded"
|
if $.hasClass @, "embedded"
|
||||||
$.rm @previousElementSibling
|
$.rm @previousElementSibling
|
||||||
@previousElementSibling.hidden = false
|
@previousElementSibling.hidden = false
|
||||||
@ -253,7 +253,7 @@ Linkify =
|
|||||||
el: (a) ->
|
el: (a) ->
|
||||||
el = $.el 'div'
|
el = $.el 'div'
|
||||||
el.innerHTML = '<a target="_blank"><img></a>'
|
el.innerHTML = '<a target="_blank"><img></a>'
|
||||||
el.firstChild.href = el.firstChild.firstChild.src = a.dataset.href
|
el.firstChild.href = el.firstChild.firstChild.src = a.href
|
||||||
el
|
el
|
||||||
,
|
,
|
||||||
key: 'InstallGentoo'
|
key: 'InstallGentoo'
|
||||||
@ -302,7 +302,7 @@ Linkify =
|
|||||||
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'
|
||||||
el.innerHTML = '<a target="_blank"><img></a>'
|
el.innerHTML = '<a target="_blank"><img></a>'
|
||||||
el.firstChild.href = a.dataset.href
|
el.firstChild.href = a.href
|
||||||
el.firstChild.firstChild.src = "https://mediacru.sh/#{file.file}"
|
el.firstChild.firstChild.src = "https://mediacru.sh/#{file.file}"
|
||||||
when 'audio/mpeg', 'audio/ogg'
|
when 'audio/mpeg', 'audio/ogg'
|
||||||
el.innerHTML = '<audio controls><source type="audio/ogg"><source type="audio/mpeg"></audio>'
|
el.innerHTML = '<audio controls><source type="audio/ogg"><source type="audio/mpeg"></audio>'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user