Commits

jp  committed 378cbd6

Reset the skilift update delay whenever the user interacts with the page

  • Participants
  • Parent commits fdc2e2f

Comments (0)

Files changed (1)

File templates/welcome/homeswitch.html

     }
     schedule_check();
   });
+  schedule_check.fired_once = true;
 }
 function schedule_check() {
+  if (check_for_updates.interval) {
+    clearTimeout(check_for_updates.interval);
+  }
   check_for_updates.interval = setTimeout(check_for_updates, schedule_check.delay);
   // back off by 10% each time
   schedule_check.delay *= 1.1;
 }
+schedule_check.delay = 5000;
+schedule_check.fired_once = false;
 function schedule_check_reset() {
+  if ( ! schedule_check.fired_once ) {
+    return;
+  }
+  schedule_check.fired_once = false;
   schedule_check.delay = 5000;
+  schedule_check();
 }
-schedule_check_reset();
+
+// Reset the delay whenever the user interacts with the window
+$(document).keypress(schedule_check_reset);
+$(document).mousemove(schedule_check_reset);
+$(document).mousedown(schedule_check_reset);
+$(document).focus(schedule_check_reset);
+
 </script>
 {% endblock %}