]> rtime.felk.cvut.cz Git - coffee/mt-apps.git/commitdiff
Replace tabs with spaces
authorMichal Sojka <michal.sojka@cvut.cz>
Thu, 16 Aug 2018 15:37:58 +0000 (17:37 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Thu, 16 Aug 2018 15:37:58 +0000 (17:37 +0200)
html/index.html

index afc244f2dfa71c97ab975ae8ec527e4da0f00441..9c77744f93363bffee035ed773849cf8ecf21c5a 100644 (file)
@@ -5,13 +5,13 @@
 <title>IID Coffee Terminal</title>
 <script>
     function loadServerScript() {
-       let script = document.createElement('script');
-       script.src = "http://localhost:5000/js";
-       document.head.append(script);
-       script.onerror = function() {
-           this.parentElement.removeChild(this);
-           setTimeout(loadServerScript, 10000);
-       };
+        let script = document.createElement('script');
+        script.src = "http://localhost:5000/js";
+        document.head.append(script);
+        script.onerror = function() {
+            this.parentElement.removeChild(this);
+            setTimeout(loadServerScript, 10000);
+        };
     }
 
     loadServerScript();
 
     function connect() {
         console.log("connecting...");
-       socket = new WebSocket(
+        socket = new WebSocket(
             "ws://" + document.domain + ':' + location.port,
             "merica-terminal-protocol"
-       );
+        );
 
-       socket.onopen = function() {
+        socket.onopen = function() {
             console.log("socket open");
             document.getElementById("inputStatus").innerHTML = "connected";
-       }
+        }
 
-       socket.onclose = function() {
+        socket.onclose = function() {
             console.log("socket closed");
             document.getElementById("inputStatus").innerHTML = "disconnected";
-           delete socket;
-           setTimeout(connect, 10000);
-       }
+            delete socket;
+            setTimeout(connect, 10000);
+        }
 
-       socket.onmessage = function(msg) {
+        socket.onmessage = function(msg) {
             updateJSONmsg(msg.data);
             if (typeof updateRemote === "function") {
-               updateRemote(msg.data);
+                updateRemote(msg.data);
             } else {
-               if (localStorage) {
+                if (localStorage) {
                     var now = Date.now();
                     localStorage.setItem(now, msg.data);
                     console.log(now + ": " + msg.data);
-               }
+                }
             }
-       }
+        }
     }
 
     connect();