From 3589eb591e16340a6a30d7c55ff4e2748085f4b4 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Tue, 10 Dec 2024 23:28:50 +0400 Subject: [PATCH] *_formats consts were moved in-place. --- web/assets/js/main.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/web/assets/js/main.js b/web/assets/js/main.js index 8993b26..ab635a6 100644 --- a/web/assets/js/main.js +++ b/web/assets/js/main.js @@ -2,10 +2,6 @@ document.getElementById("instruction").classList.remove("hidden"); //// OVERLAY FOR VIEWING MEDIA FILES -const video_formats = ["webm", "mp4", "mov"]; -const audio_formats = ["mp3", "flac", "opus", "ogg", "m4a"]; -const image_formats = ["jpg", "jpeg", "gif", "png", "bmp", "webp"]; - const overlay = document.getElementById("overlay"); const overlay_content = overlay.children[1]; const overlay_label = overlay.children[2]; @@ -61,11 +57,11 @@ overlay_content.addEventListener("mousemove", e => { function determineMediaElement(path) { path = path.toLowerCase(); - if (video_formats.some(ext => path.endsWith(ext))) + if (["webm", "mp4", "mov"].some(ext => path.endsWith(ext))) return "video"; - else if (audio_formats.some(ext => path.endsWith(ext))) + else if (["mp3", "flac", "opus", "ogg", "m4a"].some(ext => path.endsWith(ext))) return "audio"; - else if (image_formats.some(ext => path.endsWith(ext))) + else if (["jpg", "jpeg", "gif", "png", "bmp", "webp"].some(ext => path.endsWith(ext))) return "img"; return undefined; }