diff options
author | Mark Powers <markppowers0@gmail.com> | 2020-08-09 11:49:36 -0500 |
---|---|---|
committer | Mark Powers <markppowers0@gmail.com> | 2020-08-09 11:49:36 -0500 |
commit | ce1814387c9793e9553a525a44d218c50d7e255d (patch) | |
tree | 9ba7be3019f5802a13b6e25d90a9a6cb3a806676 /templates.js | |
parent | 96378c5db8da2d1e694fbe219595317ae3682f33 (diff) |
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>` + } +} |