From 0e23218646c94340acfa9f7f468a78c83ac6cd5b Mon Sep 17 00:00:00 2001 From: Urban Wallasch Date: Mon, 12 Aug 2019 12:34:45 +0200 Subject: [PATCH] * Replaced some magic numbers with suitably named constants. --- dash.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dash.html b/dash.html index 616e6bb..c840368 100644 --- 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. -- 2.30.2