diff --git a/data/loader.js b/data/loader.js index 2603446..18bee61 100644 --- a/data/loader.js +++ b/data/loader.js @@ -1,4 +1,15 @@ (async function() { + const scripts = [ + "emulator.js", + "nipplejs.js", + "shaders.js", + "storage.js", + "gamepad.js", + "GameManager.js", + "socket.io.min.js" + ]; + + const folderPath = (path) => path.substring(0, path.length - path.split('/').pop().length); let scriptPath = (typeof window.EJS_pathtodata === "string") ? window.EJS_pathtodata : folderPath((new URL(document.currentScript.src)).pathname); if (!scriptPath.endsWith('/')) scriptPath+='/'; @@ -9,8 +20,10 @@ script.src = function() { if ('undefined' != typeof EJS_paths && typeof EJS_paths[file] === 'string') { return EJS_paths[file]; + } else if (file.endsWith(".min.js")) { + return scriptPath + file; } else { - return scriptPath+file; + return scriptPath + "src/" + file; } }(); script.onload = resolve; @@ -46,13 +59,9 @@ if (minifiedFailed) { console.log("Attempting to load non-minified files"); if (file === "emulator.min.js") { - await loadScript('emulator.js'); - await loadScript('nipplejs.js'); - await loadScript('shaders.js'); - await loadScript('storage.js'); - await loadScript('gamepad.js'); - await loadScript('GameManager.js'); - await loadScript('socket.io.min.js'); + for (let i=0; i -[NodeJS]: https://nodejs.org/en/download/ \ No newline at end of file +[NodeJS]: https://nodejs.org/en/download/ diff --git a/data/minify/index.js b/data/minify/index.js index 8432fa4..f27567a 100644 --- a/data/minify/index.js +++ b/data/minify/index.js @@ -2,18 +2,18 @@ const UglifyJS = require("uglify-js"); const fs = require('fs'); const uglifycss = require('uglifycss'); -let files = [ - 'nipplejs.js', - 'shaders.js', - 'storage.js', - 'gamepad.js', - 'GameManager.js', - 'socket.io.min.js', - 'emulator.js' -] +const scripts = [ + "emulator.js", + "nipplejs.js", + "shaders.js", + "storage.js", + "gamepad.js", + "GameManager.js", + "socket.io.min.js" +]; let code = "(function() {\n"; -for (let i=0; i