mirror of https://github.com/lumapu/ahoy.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.0 KiB
59 lines
2.0 KiB
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title>Save</title>
|
|
{#HTML_HEADER}
|
|
</head>
|
|
<body>
|
|
{#HTML_NAV}
|
|
<div id="wrapper">
|
|
<div id="content">
|
|
<div id="html" class="mt-3 mb-3">Saving 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 = "Settings successfully saved. Automatic page reload in 3 seconds.";
|
|
meta.content = 3;
|
|
} else {
|
|
html = "Settings successfully saved. Rebooting. Automatic redirect in 20 seconds.";
|
|
meta.content = 20 + "; URL=/";
|
|
}
|
|
document.getElementsByTagName('head')[0].appendChild(meta);
|
|
} else {
|
|
html = "Failed saving settings.";
|
|
}
|
|
}
|
|
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>
|
|
|