Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- document.addEventListener("offline", onOffline, false);
- document.addEventListener("online", onOnline, false);
- document.addEventListener("pause", onPause, false);
- document.addEventListener("resume", onResume, false);
- function onPause()
- {
- isPaused = true;
- }
- function onResume()
- {
- isPaused = false;
- onlineChecker();
- loadMsg();
- }
- function onOffline()
- {
- noInternetAlert();
- isInternetConnection = false;
- }
- function onOnline()
- {
- isInternetConnection = true;
- load_all_msg = 1;
- if(userName == null)
- loginUser(window.localStorage.getItem("userName"), window.localStorage.getItem("userPassword"), 0);
- else
- onlineChecker();
- menuChatHTML();
- switchMenu(currentMenu);
- }
- if(!isInternetConnection)
- {
- noInternetAlert();
- }
- function onlineChecker()
- {
- if(userName != null && userData["token"] != 0 && !isPaused && isInternetConnection)
- $.post("http://sarg.lt/app/online.php", {name: userName, code: "0ay3j5as1Zua55f9T9s2upo", token: userData["token"]});
- }
Add Comment
Please, Sign In to add comment