A quick fix for extensions in uppercase.

This commit is contained in:
Alexander Andreev 2021-10-03 20:36:14 +04:00
parent 9e88e1be35
commit 69a27d1d6f
Signed by: Arav
GPG Key ID: 610DF2574456329F

View File

@ -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);