update mediacru.sh filetypes
This commit is contained in:
parent
2a9f2cc196
commit
0110186caa
@ -303,7 +303,7 @@ Linkify =
|
|||||||
{status} = @
|
{status} = @
|
||||||
return el.textContent = "ERROR #{status}" unless status in [200, 304]
|
return el.textContent = "ERROR #{status}" unless status in [200, 304]
|
||||||
{files} = @response
|
{files} = @response
|
||||||
for type in ['video/mp4', 'video/ogv', 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg', 'image/svg', 'audio/mpeg']
|
for type in ['video/mp4', 'video/webm', 'video/ogv', 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg', 'audio/mpeg', 'audio/ogg']
|
||||||
for file in files
|
for file in files
|
||||||
if file.type is type
|
if file.type is type
|
||||||
embed = file
|
embed = file
|
||||||
@ -311,17 +311,18 @@ Linkify =
|
|||||||
break if embed
|
break if embed
|
||||||
return div.textContent = "ERROR: Not a valid filetype" unless embed
|
return div.textContent = "ERROR: Not a valid filetype" unless embed
|
||||||
switch embed.type
|
switch embed.type
|
||||||
when 'video/mp4', 'video/ogv'
|
when 'video/mp4', 'video/webm', 'video/ogv'
|
||||||
el.innerHTML = '<video autoplay loop><source type="video/mp4"><source type="video/ogg; codecs=\'theora, vorbis\'"></video>'
|
el.innerHTML = '<video autoplay loop><source type="video/mp4"><source type="video/webm"><source type="video/ogg"></video>'
|
||||||
el.firstChild.children[0].src = "https://mediacru.sh/#{a.dataset.uid}.mp4"
|
for ext, i in ['mp4', 'webm', 'ogv']
|
||||||
el.firstChild.children[1].src = "https://mediacru.sh/#{a.dataset.uid}.ogv"
|
el.firstChild.children[i].src = "https://mediacru.sh/#{a.dataset.uid}.#{ext}"
|
||||||
when 'image/png', 'image/gif', 'image/jpeg', 'image/svg', 'image/svg+xml'
|
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.dataset.href
|
||||||
el.firstChild.firstChild.src = "https://mediacru.sh/#{file.file}"
|
el.firstChild.firstChild.src = "https://mediacru.sh/#{file.file}"
|
||||||
when 'audio/mpeg'
|
when 'audio/mpeg', 'audio/ogg'
|
||||||
el.innerHTML = '<audio controls><source></audio>'
|
el.innerHTML = '<audio controls><source type="audio/mpeg"><source type="audio/ogg"></audio>'
|
||||||
el.firstChild.firstChild.src = "https://mediacru.sh/#{file.file}"
|
for ext, i in ['mp3', 'ogg']
|
||||||
|
el.firstChild.children[i].src = "https://mediacru.sh/#{a.dataset.uid}.#{ext}"
|
||||||
else
|
else
|
||||||
el.textContent = "ERROR: No valid filetype."
|
el.textContent = "ERROR: No valid filetype."
|
||||||
el
|
el
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user