screensaver.js 638 B

1234567891011121314151617181920212223242526272829
  1. var t, s, timer = 16;
  2. $(document).ready(function() {
  3. window.onload = resetTimer;
  4. s = setInterval(function() {
  5. --timer;
  6. }, 60000);
  7. // DOM Events
  8. document.onmousemove = resetTimer;
  9. document.onkeypress = resetTimer;
  10. document.onclick = resetTimer;
  11. });
  12. function logout() {
  13. timed_out = true;
  14. $('main').fadeOut();
  15. $('footer').fadeOut();
  16. $('#screensaver').fadeIn();
  17. }
  18. function resetTimer() {
  19. clearTimeout(t);
  20. timer = 16;
  21. $('main').fadeIn();
  22. $('footer').fadeIn();
  23. $('#screensaver').fadeOut();
  24. timed_out = false;
  25. t = setTimeout(logout, 60000);
  26. }