Guest User

Untitled

a guest
Feb 17th, 2017
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. document.addEventListener("offline", onOffline, false);
  2. document.addEventListener("online", onOnline, false);
  3. document.addEventListener("pause", onPause, false);
  4. document.addEventListener("resume", onResume, false);
  5.  
  6. function onPause()
  7. {
  8. isPaused = true;
  9. }
  10. function onResume()
  11. {
  12. isPaused = false;
  13. onlineChecker();
  14. loadMsg();
  15. }
  16. function onOffline()
  17. {
  18. noInternetAlert();
  19. isInternetConnection = false;
  20. }
  21. function onOnline()
  22. {
  23. isInternetConnection = true;
  24. load_all_msg = 1;
  25. if(userName == null)
  26. loginUser(window.localStorage.getItem("userName"), window.localStorage.getItem("userPassword"), 0);
  27. else
  28. onlineChecker();
  29. menuChatHTML();
  30. switchMenu(currentMenu);
  31.  
  32. }
  33.  
  34. if(!isInternetConnection)
  35. {
  36. noInternetAlert();
  37. }
  38.  
  39. function onlineChecker()
  40. {
  41. if(userName != null && userData["token"] != 0 && !isPaused && isInternetConnection)
  42. $.post("http://sarg.lt/app/online.php", {name: userName, code: "0ay3j5as1Zua55f9T9s2upo", token: userData["token"]});
  43. }
Add Comment
Please, Sign In to add comment