Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var isShowedDialog = false;
- function showDialog(dialog) {
- isShowedDialog = true;
- var ele = document.getElementById(dialog);
- ele.style.display = '';
- application.onPause();
- }
- function hideDialog(dialog) {
- isShowedDialog = false;
- var ele = document.getElementById(dialog);
- ele.style.display = 'none';
- }
- var InternetConnection = function(){
- this.CheckInternetState = null;
- this.connected = true;
- this.canConnectInternet = function(){
- return InternetConnection.connected;
- }
- this.scheduler = function(){
- if (typeof window.schedulerInterval == 'undefined'){
- window.schedulerInterval = setInterval(function(){
- if (InternetConnection.connected){
- clearInterval(window.schedulerInterval);
- window.schedulerInterval = undefined;
- }
- }, 200);
- }
- }
- this.check = function(){
- var img = new Image(1,1);
- img.onerror = function () {
- InternetConnection.connected = false;
- //InternetConnection.scheduler();
- showDialog('no_internet_popup');
- };
- img.onload = function() {
- if (!InternetConnection.connected){
- InternetConnection.connected = true;
- }
- img = null;
- };
- //img.src = _protocol + _domain_name + '/un/web/fullscreen/images/pixel.gif?time=' + new Date().getTime();
- if (typeof resource !== 'undefined')
- img.src = resource.get_src("assets/pixel.gif") + "?time=" + new Date().getTime();
- else
- img.src = "http://201205igp.gameloft.com//un/web/fullscreen/images/pixel.gif?time=" + new Date().getTime();
- }
- }
- var InternetConnection = new InternetConnection();
- function checkConnection() {
- if (!isShowedDialog)
- InternetConnection.check();
- }
- function no_internet_popup_close()
- {
- mraid.close();
- }
- function no_internet_popup_resume()
- {
- hideDialog('no_internet_popup');
- application.onResume();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement