forked from acenturyandabit/polymorph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
filemanager.js
98 lines (97 loc) · 3.06 KB
/
filemanager.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
let fileList = [
"3pt/localforage.min.js",
"utils.js",
"core.js",
"core_modules/ui/core.tutorial.js",
"core_modules/core/core.docLoading.js",
"core_modules/ui/core.dialog.js",
"core_modules/ui/core.tutorial.js",
"core_modules/ui/core.loadSaveUI.js",
"core_modules/core/core.dataUtils.js",
"core_modules/core/core.container.js",
"core_modules/ui/core.contextMenu.js",
"core_modules/core/core.itemfx.js",
"core_modules/core/core.operator.js",
"core_modules/ui/core.dragdrop.js",
"core_modules/core/core.phone.rect.js",
"core_modules/core/core.rect.js",
"core_modules/ui/core.phone.main.js",
"core_modules/ui/core.main.js",
"core_modules/ui/ccleaner.js",
"operators/opSelect.js",
"genui/dateparser.js",
"operators/itemList.searchsort.js",
"operators/itemList.js",
"operators/itemList.phone.js",
"operators/descbox.js",
"genui/intervalParser.js",
"operators/terminal.js",
"operators/workflow.js",
"operators/textflow.js",
"operators/inspector.js",
"operators/inspectolist.js",
"operators/subframe.js",
"operators/deltaLogger.js",
"3pt/jquery.min.js",
"3pt/moment.min.js",
"3pt/fullcalendar.min.js",
"genui/quickNotify.js",
"operators/calendar.js",
"3pt/svg.min.js",
"3pt/svg.foreignobject.js",
"operators/itemcluster.svg.js",
"operators/itemcluster.contextmenu.js",
"operators/itemcluster.scalegrid.js",
"operators/itemcluster.rapidentry.js",
"operators/itemcluster.js",
"operators/welcome.js",
"operators/litem.js",
"operators/scriptrunner.js",
"operators/timer.js",
"saveSources/outputToText.js",
"saveSources/localforage2.js",
"saveSources/permalink.js",
"saveSources/lobby.js",
"saveSources/server.js",
"saveSources/gitlite.js",
];
try {
//we are working in the browser context
if (localStorage.getItem("__polymorph_debug_flag") == "true") {
let f = 0;
let loadNextFile = () => {
let s = document.createElement("script");
s.src = fileList[f];
f++;
if (f < fileList.length) {
s.onload = loadNextFile;
} else {
s.onload = polymorph_core.start;
}
document.body.appendChild(s);
}
loadNextFile();
} else {
let s = document.createElement("script");
s.src = "cat.js";
document.body.appendChild(s);
let start = () => {
try {
polymorph_core.start();
} catch (e) {
setTimeout(start);
}
}
setTimeout(start);
}
} catch (e) {
console.log(e); // in case it's actually a browser error.
let fs = require("fs");
//this is a compilation script
fs.writeFileSync("cat.js", fs.readFileSync(fileList[0]));
for (let i = 1; i < fileList.length; i++) {
fs.appendFileSync("cat.js", ";\n\n"); // #safe
fs.appendFileSync("cat.js", fs.readFileSync(fileList[i]));
console.log("adding file " + fileList[i] + "...");
}
}