summaryrefslogtreecommitdiff
path: root/templates.js
blob: 10526ee4382d68c4b3ee37dff8714d55e1ffde6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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>`
    }
}