diff options
Diffstat (limited to 'templates.js')
-rw-r--r-- | templates.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/templates.js b/templates.js new file mode 100644 index 0000000..10526ee --- /dev/null +++ b/templates.js @@ -0,0 +1,55 @@ +module.exports = { + "/": { + "pre": `<!doctype html> + <html lang="en"> + <head> + <title>Files</title> + <link rel="stylesheet" type="text/css" href="/main.css"> + <script> + function fetchOpen(index){ + fetch("/open/"+index) + .then(response => console.log("ok")) + .catch((error) => { + console.error('Error:', error); + }); + } + function fetchOpenDir(index){ + event.stopPropagation(); + console.log("test") + fetch("/openDir/"+index) + .then(response => console.log("ok")) + .catch((error) => { + console.error('Error:', error); + }); + } + </script> + </head> + <body> + <h1>Check out these files!</h1> + <ul>`, + "post": `</ul> + </body> + </html>` + }, + "/config": { + "pre": `<!doctype html> + <html lang="en"> + <head> + <title>Config</title> + <link rel="stylesheet" type="text/css" href="/main.css"> + <script> + function postConfig(){ + newDir = document.getElementById("inputPath") + newMax = document.getElementById("inputMax") + newType = document.getElementById("inputType") + newObj = { rootPath: newDir, maxFiles: newMax, type: newType} + fetch("/config", {method: "POST", body: JSON.stringify(newObj)}) + } + </script> + </head> + <body> + <h1>Config</h1>`, + "post": `</body> + </html>` + } +} |