document.getElementById("local").style.display = !offline ? "none" : "block";
document.getElementById("remote").style.display = offline ? "none" : "block";
- if (offline) {
- loadRemote(); // Try to contact the server periodically
+ if (offline)
return;
- }
if (id_user !== undefined) {
document.getElementById("nextStep").innerHTML = "Now select a beverage on the coffee machineā¦";
updateUI();
clearTimeout(reloadTimer);
} else {
+ // Cancel current timer for the case when loadRemote()
+ // was called multiple times (e.g. multiple ajax()
+ // calls failed simultaneously).
+ clearTimeout(reloadTimer);
reloadTimer = setTimeout(loadRemote, 1000);
}
}
} else {
updateRemote = undefined;
updateUI();
+ loadRemote(); // Try to contact the server periodically
if (localStorage) {
var ajax_failure = JSON.stringify({