mirror of
https://github.com/TheGreyDiamond/open360viewer.git
synced 2025-07-17 20:33:48 +02:00
Fixed playbar + better minify
This commit is contained in:
@ -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",
|
||||
|
BIN
screenshots/videoLoaded.png
Normal file
BIN
screenshots/videoLoaded.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 793 KiB |
30
src/dropHandler.js
Normal file
30
src/dropHandler.js
Normal file
@ -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");
|
||||
});
|
@ -5,11 +5,7 @@
|
||||
<title>360 Viewer</title>
|
||||
<meta name="viewport"
|
||||
content="target-densitydpi=device-dpi, width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui" />
|
||||
<link rel="stylesheet" href="../../dist/videoPlayer.css">
|
||||
<link href="../output.css" rel="stylesheet">
|
||||
<link href="../../node_modules/@fortawesome/fontawesome-free/css/all.css" rel="stylesheet">
|
||||
<script src="../../node_modules/@themesberg/flowbite/dist/flowbite.bundle.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="dark:bg-gray-800">
|
||||
@ -85,7 +81,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
<link rel="stylesheet" href="../../dist/videoPlayer.css">
|
||||
<link href="../../node_modules/@fortawesome/fontawesome-free/css/all.css" rel="stylesheet">
|
||||
<script src="../../node_modules/@themesberg/flowbite/dist/flowbite.bundle.js"></script>
|
||||
<script src="../../node_modules/marzipano/dist/marzipano.js"></script>
|
||||
|
||||
<script src="../../node_modules/marzipano/demos/video-multi-res/VideoAsset.js"></script>
|
||||
@ -102,38 +102,9 @@
|
||||
document.getElementById("pano").style.display = "none";
|
||||
document.getElementById("pano2").style.display = "none";
|
||||
|
||||
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');
|
||||
});
|
||||
</script>
|
||||
<script src="../../dist/dropHandler.js"></script>
|
||||
<script>
|
||||
|
||||
function loadImageFromSource(path) {
|
||||
testImage(path,
|
||||
|
@ -55,7 +55,7 @@
|
||||
.time {
|
||||
position: absolute;
|
||||
left: 80px;
|
||||
right: 140px;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
/* Control button style (play, mute, options, resolution) */
|
||||
|
36
tooling/minifyAll/minifyAllSrcs.js
Normal file
36
tooling/minifyAll/minifyAllSrcs.js
Normal file
@ -0,0 +1,36 @@
|
||||
import {minify} from 'minify';
|
||||
import tryToCatch from 'try-to-catch';
|
||||
import fs from 'fs';
|
||||
import glob from 'glob';
|
||||
|
||||
const options = {
|
||||
|
||||
};
|
||||
|
||||
|
||||
var getDirectories = function (src, callback) {
|
||||
glob('src/**/*', callback);
|
||||
};
|
||||
getDirectories('test', function (err, res) {
|
||||
if (err) {
|
||||
console.log('Error', err);
|
||||
} else {
|
||||
for(const file in res){
|
||||
// console.log(minify(res[file], options));
|
||||
const myFile = res[file];
|
||||
const dst = myFile.replace("src", "dist");
|
||||
console.log(myFile, " -> ", dst);
|
||||
if(!fs.lstatSync(myFile).isDirectory() ){
|
||||
let data = minify(myFile, options).then(function(data) {
|
||||
fs.writeFileSync(dst, data);
|
||||
})
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
});
|
16
tooling/minifyAll/package.json
Normal file
16
tooling/minifyAll/package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "minifyall",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"type": "module",
|
||||
"exports": "./minifyAllSrcs.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "TheGreydiamond",
|
||||
"license": "GPL-3.0",
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0",
|
||||
"dependencies": {
|
||||
"glob": "^7.2.0"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user