From 69a27d1d6fd8194d8f70c372cdb94747650bb34c Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sun, 3 Oct 2021 20:36:14 +0400 Subject: [PATCH] A quick fix for extensions in uppercase. --- files/static/assets/js/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/static/assets/js/main.js b/files/static/assets/js/main.js index 7187b6a..b631885 100644 --- a/files/static/assets/js/main.js +++ b/files/static/assets/js/main.js @@ -20,7 +20,7 @@ document.getElementById("overlay").addEventListener("click", e => { const file_links = Array.from(document.getElementsByTagName('tr')).slice(2).filter((e) => e.lastChild.innerHTML != "DIR").map(v => v.firstChild.firstChild); file_links.forEach(f => f.addEventListener('click', e => { - if (video_formats.some(ext => e.target.pathname.endsWith(ext))) { + if (video_formats.some(ext => e.target.pathname.toLowerCase().endsWith(ext))) { e.preventDefault(); const video = document.createElement("video"); video.addEventListener('wheel', mousescroll); @@ -29,7 +29,7 @@ file_links.forEach(f => f.addEventListener('click', e => { video.src = e.target.pathname; document.getElementById("overlay").appendChild(video); document.getElementById("overlay").style.visibility = "visible"; - } else if (audio_formats.some(ext => e.target.pathname.endsWith(ext))) { + } else if (audio_formats.some(ext => e.target.pathname.toLowerCase().endsWith(ext))) { e.preventDefault(); const audio = document.createElement("audio"); audio.autoplay = true; @@ -37,7 +37,7 @@ file_links.forEach(f => f.addEventListener('click', e => { audio.src = e.target.pathname; document.getElementById("overlay").appendChild(audio); document.getElementById("overlay").style.visibility = "visible"; - } else if (image_formats.some(ext => e.target.pathname.endsWith(ext))) { + } else if (image_formats.some(ext => e.target.pathname.toLowerCase().endsWith(ext))) { e.preventDefault(); const image = document.createElement("img"); image.addEventListener('wheel', mousescroll);