Andrew Boyson / web

Dependents:   oldheating gps motorhome heating

Revision:
110:8ab752842d25
Parent:
109:3e82f62c7e1f
Child:
111:aaa858678e34
--- a/firmware/web-firmware-script.js	Mon Apr 29 14:45:30 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-'use strict';
-
-var file;
-var xhr;
-
-function logUpload(text)
-{
-    document.getElementById('uploadresult').textContent = text;
-}
-function xhrUploadResponse()
-{
-    var topics = xhr.responseText.split('\f');
-    logUpload(topics[0]);
-    if (topics.length > 1) document.getElementById('list').textContent = topics[1];
-}
-function xhrUploadOnLoad()
-{
-    if (xhr.status == 200) xhrUploadResponse();
-    else                   logUpload('Upload failed');
-}
-function xhrUploadOnError()
-{
-    logUpload('Upload error');
-}
-function xhrUploadStart()
-{
-    logUpload('Uploading...');
-    
-    xhr = new XMLHttpRequest();
-
-    xhr.onload  = xhrUploadOnLoad;
-    xhr.onerror = xhrUploadOnError;
-
-    xhr.open('POST', '/firmware-ajax'); //Defaults to async=true
-    xhr.send(file);
-}
-
-function startUpload()
-{
-    var fileInput = document.getElementById('fileInput');
-
-    if (fileInput.files.length == 0)
-    {
-        logUpload('Please choose a file');
-        return;
-    }
-
-    if (fileInput.files.length > 1)
-    {
-        logUpload('Please choose just one file');
-        return;
-    }
-    
-    file = fileInput.files[0];
-    
-    xhrUploadStart();
-}
-function logRestart(text)
-{
-    document.getElementById('restartresult').textContent = text;
-}
-function redirect()
-{
-    location.href = '/firmware';
-}
-function xhrRestartOnLoad()
-{
-    if (xhr.status == 200) logRestart('Restart should never have returned');
-    else                   logRestart('Restart failed');
-}
-function xhrRestartStart()
-{
-    logRestart('Restarting...');
-    
-    xhr = new XMLHttpRequest();
-
-    xhr.onload  = xhrRestartOnLoad;
-
-    xhr.open('GET', '/firmware-ajax?restart='); //Defaults to async=true
-    xhr.send();
-    
-    setTimeout(redirect, 2000);
-}
-function restart()
-{
-    xhrRestartStart();
-}