* Replaced some magic numbers with suitably named constants.
authorUrban Wallasch <urban.wallasch@freenet.de>
Mon, 12 Aug 2019 10:34:45 +0000 (12:34 +0200)
committerUrban Wallasch <urban.wallasch@freenet.de>
Mon, 12 Aug 2019 10:34:45 +0000 (12:34 +0200)
dash.html

index 616e6bb65d29de0742488c7c32ecfc11e40c1a86..c840368a5ff721d38e430cfd14abd3b088d0cfc5 100644 (file)
--- a/dash.html
+++ b/dash.html
@@ -308,6 +308,14 @@ function tnow() {
   return Math.floor(Date.now() / 1000);
 }
 
+////////////////////////////////////////////////////////////////
+// Begin display update code.
+////////////////////////////////////////////////////////////////
+
+// Version and flag constants:
+const TELE_VERSION = 1;
+const TELE_FLAG_ALIVE = 1;
+
 // Timestamp of last activity, used for NoSleep timeout:
 var last_active = tnow();
 
@@ -322,7 +330,7 @@ function update_cb() {
 
     //// pause and error bar status:
 
-    if ( !(tele.tele_flags & 1) ) {  // TELE_FLAG_ALIVE
+    if ( !(tele.tele_flags & TELE_FLAG_ALIVE) ) {
       if ( tnow() - last_active > 300 ) // 5 minutes NoSleep timeout
         disableNoSleep();
       pausebar.style.display = 'none';
@@ -330,7 +338,7 @@ function update_cb() {
       errbar.innerHTML = 'Game offline';
       return;
     }
-    else if ( tele.tele_version !== 1 ) {  // TELE_VERSION
+    else if ( tele.tele_version !== TELE_VERSION ) {
       errbar.style.display = 'block';
       errbar.innerHTML = 'Version mismatch';
     } else {
@@ -470,6 +478,9 @@ var xhttp = new XMLHttpRequest();
 xhttp.onreadystatechange = update_cb;
 window.setInterval(loadDoc, 333);
 
+////////////////////////////////////////////////////////////////
+// End display update code.
+////////////////////////////////////////////////////////////////
 
 ////////////////////////////////////////////////////////////////
 // Begin disable mobile sleep.