-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.js
42 lines (40 loc) · 896 Bytes
/
util.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
function loadScript(src, callback) {
var scrTag = document.createElement("script");
scrTag.src = src;
document.body.appendChild(scrTag);
scrTag.onload = scrTag.onreadystatechange = function() {
callback();
}
};
function Main(window) {
var params = window.location
.toString()
.split("?")[1]
.split("&");
var mapping = {};
params.forEach(function(param) {
var sp = param.split("=");
mapping[sp[0]] = sp[1];
});
console.log(mapping);
loadScript(mapping["datafile"], function(){
init();
render();
if (mapping["mode"] === "view") {
startViewMode();
var elemsArray = []
.slice
.call(
document.getElementsByClassName("editControl")
);
elemsArray
.forEach(function hideExtra(elem) {
elem.style.display = "none";
});
render();
}
if (mapping["mode"] === "edit") {
startAddMode();
}
});
}