*_formats consts were moved in-place.
This commit is contained in:
parent
9463774aee
commit
3589eb591e
@ -2,10 +2,6 @@ document.getElementById("instruction").classList.remove("hidden");
|
|||||||
|
|
||||||
//// OVERLAY FOR VIEWING MEDIA FILES
|
//// 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 = document.getElementById("overlay");
|
||||||
const overlay_content = overlay.children[1];
|
const overlay_content = overlay.children[1];
|
||||||
const overlay_label = overlay.children[2];
|
const overlay_label = overlay.children[2];
|
||||||
@ -61,11 +57,11 @@ overlay_content.addEventListener("mousemove", e => {
|
|||||||
|
|
||||||
function determineMediaElement(path) {
|
function determineMediaElement(path) {
|
||||||
path = path.toLowerCase();
|
path = path.toLowerCase();
|
||||||
if (video_formats.some(ext => path.endsWith(ext)))
|
if (["webm", "mp4", "mov"].some(ext => path.endsWith(ext)))
|
||||||
return "video";
|
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";
|
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 "img";
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user