mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-13 07:56:23 +00:00
fix: always try to load file as image in info page
This commit is contained in:
parent
e55be5ee0a
commit
8cbdca4efc
@ -167,16 +167,15 @@ page.loadFileinfo = () => {
|
||||
page.downloadBtn.setAttribute('href', fileUrl)
|
||||
page.clipboardBtn.dataset.clipboardText = fileUrl
|
||||
|
||||
const isimage = page.file.type.startsWith('image/')
|
||||
const img = page.fileinfoContainer.querySelector('img')
|
||||
img.setAttribute('alt', page.file.name || '')
|
||||
img.src = `${page.uploadRoot}/${page.file.name}`
|
||||
img.parentNode.classList.remove('is-hidden')
|
||||
img.onerror = event => event.currentTarget.classList.add('is-hidden')
|
||||
|
||||
const isvideo = page.file.type.startsWith('video/')
|
||||
const isaudio = page.file.type.startsWith('audio/')
|
||||
if (isimage) {
|
||||
const img = page.fileinfoContainer.querySelector('img')
|
||||
img.setAttribute('alt', page.file.name || '')
|
||||
img.src = `${page.uploadRoot}/${page.file.name}`
|
||||
img.parentNode.classList.remove('is-hidden')
|
||||
img.onerror = event => event.currentTarget.classList.add('is-hidden')
|
||||
} else if (isvideo || isaudio) {
|
||||
if (isvideo || isaudio) {
|
||||
page.playerBtn.setAttribute('href', `../v/${page.file.name}`)
|
||||
page.playerBtn.parentNode.parentNode.classList.remove('is-hidden')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user