Window reload time 3 sec -> 5 sec, some comments
This commit is contained in:
@@ -7,23 +7,27 @@
|
|||||||
var xhr=j();
|
var xhr=j();
|
||||||
|
|
||||||
function doReboot() {
|
function doReboot() {
|
||||||
|
//Grab the /flash/reboot url in order to reboot into the new firmware.
|
||||||
xhr.open("GET", "reboot");
|
xhr.open("GET", "reboot");
|
||||||
xhr.onreadystatechange=function() {
|
xhr.onreadystatechange=function() {
|
||||||
if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) {
|
if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) {
|
||||||
|
//Reload the window after 5 seconds.
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
location.reload(true);
|
location.reload(true);
|
||||||
}, 3000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//ToDo: set timer to
|
|
||||||
xhr.send();
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Sets the progress bar to a specific level. Amt is between 0 and 1.
|
||||||
function setProgress(amt) {
|
function setProgress(amt) {
|
||||||
$("#progressbarinner").style.width=String(amt*200)+"px";
|
$("#progressbarinner").style.width=String(amt*200)+"px";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Called when the submit button is called.
|
||||||
function doUpgrade() {
|
function doUpgrade() {
|
||||||
|
//Grab the file, see if it's a real file.
|
||||||
var f=$("#file").files[0];
|
var f=$("#file").files[0];
|
||||||
if (typeof f=='undefined') {
|
if (typeof f=='undefined') {
|
||||||
$("#remark").innerHTML="Can't read file!";
|
$("#remark").innerHTML="Can't read file!";
|
||||||
@@ -41,17 +45,20 @@ function doUpgrade() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//If the webbrowser enables it, make progress bar show progress.
|
||||||
if (typeof xhr.upload.onprogress != 'undefined') {
|
if (typeof xhr.upload.onprogress != 'undefined') {
|
||||||
xhr.upload.onprogress=function(e) {
|
xhr.upload.onprogress=function(e) {
|
||||||
setProgress(e.loaded / e.total);
|
setProgress(e.loaded / e.total);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Upload the file
|
||||||
xhr.send(f);
|
xhr.send(f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
window.onload=function(e) {
|
window.onload=function(e) {
|
||||||
|
//Grab the initial remark telling user which userx.bin file to upload.
|
||||||
xhr.open("GET", "next");
|
xhr.open("GET", "next");
|
||||||
xhr.onreadystatechange=function() {
|
xhr.onreadystatechange=function() {
|
||||||
if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) {
|
if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) {
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ been loaded <b>%counter%</b> times.
|
|||||||
<ul>
|
<ul>
|
||||||
<li>If you haven't connected this device to your WLAN network now, you can <a href="/wifi">do so.</a></li>
|
<li>If you haven't connected this device to your WLAN network now, you can <a href="/wifi">do so.</a></li>
|
||||||
<li>You can also control the <a href="led.tpl">LED</a>.</li>
|
<li>You can also control the <a href="led.tpl">LED</a>.</li>
|
||||||
|
<li>If you have a firmware upgrade file and the module is compiled for firmware upgrades, you
|
||||||
|
can <a href="flash/index.html">upgrade the firmware</a> of this module.</li>
|
||||||
<li>You can download the raw <a href="flash.bin">contents</a> of the SPI flash rom</li>
|
<li>You can download the raw <a href="flash.bin">contents</a> of the SPI flash rom</li>
|
||||||
<li>Esphttpd now also supports <a href="websocket/index.html">websockets</a>.</li>
|
<li>Esphttpd now also supports <a href="websocket/index.html">websockets</a>.</li>
|
||||||
<li>And because I can, here's a link to my <a href="http://spritesmods.com/?f=esphttpd">website</a></ul>
|
<li>And because I can, here's a link to my <a href="http://spritesmods.com/?f=esphttpd">website</a></ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user