diff --git a/package.json b/package.json index 02b9f7b..41528e9 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "test": "echo \"Error: no test specified\" && exit 1", "start": "electron .", "startDev": "npm run buildCss && npm run minify && electron .", - "minify": "minify src/main.js > dist/main.js && minify src/ui_templates/index.html > dist/ui_templates/index.html && minify src/videoPlayer.css > dist/videoPlayer.css && minify src/videoPlayHandler.js > dist/videoPlayHandler.js && minify src/ui_templates/videoPlayer.html > dist/ui_templates/videoPlayer.html && minify src/ui_templates/about.html > dist/ui_templates/about.html", + "minify": "node tooling/minifyAll/minifyAllSrcs.js", "buildCss": "npx tailwindcss -i ./src/main.css -o ./dist/output.css", "buildCssWatch": "npx tailwindcss -i ./src/main.css -o ./dist/output.css --watch", "package": "electron-forge package", diff --git a/screenshots/videoLoaded.png b/screenshots/videoLoaded.png new file mode 100644 index 0000000..0ad5d7d Binary files /dev/null and b/screenshots/videoLoaded.png differ diff --git a/src/dropHandler.js b/src/dropHandler.js new file mode 100644 index 0000000..2900a23 --- /dev/null +++ b/src/dropHandler.js @@ -0,0 +1,30 @@ +document.addEventListener("drop", (event) => { + event.preventDefault(); + event.stopPropagation(); + document.getElementById("fakeDropzone").style.display = "none"; + document.getElementById("loadingBig").style.display = "block"; + document.getElementById("state").innerHTML = + "Loading file. If this stays empty try another file."; + const superFile = event.dataTransfer.files[0].path; + FileType.fromFile(superFile).then((type) => { + type = type["mime"].split("/")[0]; + if (type == "image") { + loadImageFromSource(superFile); + } else if (type == "video") { + loadVideoFromSource(superFile); + } + }); +}); + +document.addEventListener("dragover", (e) => { + e.preventDefault(); + e.stopPropagation(); +}); + +document.addEventListener("dragenter", (event) => { + console.log("File is in the Drop Space"); +}); + +document.addEventListener("dragleave", (event) => { + console.log("File has left the Drop Space"); +}); diff --git a/src/ui_templates/index.html b/src/ui_templates/index.html index c9a560a..ae70d11 100644 --- a/src/ui_templates/index.html +++ b/src/ui_templates/index.html @@ -5,11 +5,7 @@