-
-
Notifications
You must be signed in to change notification settings - Fork 230
/
Copy pathsave.html
59 lines (55 loc) · 1.91 KB
/
save.html
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
<!doctype html>
<html>
<head>
<title>{#NAV_SAVE}</title>
{#HTML_HEADER}
</head>
<body>
{#HTML_NAV}
<div id="wrapper">
<div id="content">
<div id="html" class="mt-3 mb-3">{#SAVE_SETTINGS}</div>
</div>
</div>
{#HTML_FOOTER}
<script type="text/javascript">
var intervalId = null;
function parseGeneric(obj) {
parseNav(obj);
parseESP(obj);
parseRssi(obj);
}
function parseHtml(obj) {
var html = "";
if(!obj.pending) {
if(intervalId != null) {
clearInterval(intervalId);
}
if(obj.success) {
var meta = document.createElement('meta');
meta.httpEquiv = "refresh"
if(!obj.reboot) {
html = "{#SUCCESS_SAVED_RELOAD}";
meta.content = "2; URL=/setup"
} else {
html = "{#SUCCESS_SAVED_REBOOT} " + obj.reload + " {#SECONDS}.";
meta.content = obj.reload + "; URL=/"
}
document.getElementsByTagName('head')[0].appendChild(meta);
} else {
html = "{#FAILED_SAVE}.";
}
}
document.getElementById("html").innerHTML = html;
}
function parse(obj) {
if(null != obj) {
parseGeneric(obj["generic"]);
parseHtml(obj);
}
}
intervalId = window.setInterval("getAjax('/api/html/save', parse)", 2500);
getAjax("/api/generic", parseGeneric);
</script>
</body>
</html>