-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
42 lines (41 loc) · 1.1 KB
/
main.js
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
let templates = document.getElementById("templates")
const js = {
"cv":"change-val.js",
"fn":"function.js",
"hw":"hello-world.js",
"obj":"objects.js"
}
const c = {
"hw":"hello-world.c",
"struct":"struct.c",
}
const cs = {
"hw":"hello-world.cs",
"hw6":"net6.x-hw.cs",
}
const python = {
"cl":"class.py",
"fb":"foo-bar.py",
"hw":"hello-world.py",
"mn":"main.py",
"py2c":"py2compatibility.py",
}
const lua = {
"fb":"foo-bar.lua",
"hw":"hello-world.lua",
"tbls":"tables.lua",
}
const files = {js, c, cs, python, lua} //Hopefully last error fix? This better work >:(
for (dir in files) {
templates.innerHTML = templates.innerHTML + "\n<div class='" + dir.toString()+"' id='" + dir.toString() + "'>" + dir.toString()
for (fl in dir) {
let curr = document.getElementById(dir.toString())
let reader = new FileReader();
reader.addEventListener('load', function(e) {
let text = e.target.result;
document.querySelector("#file-contents").textContent = text;
});
let res = reader.readAsText("./" + dir.toString() + fl);
curr.innerHTML = curr.innerHTML + "\n" + res
}
}