From 8f92df1a869ea7d33de209fd8a3ddb3570ba717f Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 13 May 2015 16:21:50 +0000 Subject: [PATCH] Escape from infinitive loadingDeferred if the diferred did not get resolved or rejected, and give user a chance to try other tabs --- phpgwapi/js/framework/fw_browser.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/phpgwapi/js/framework/fw_browser.js b/phpgwapi/js/framework/fw_browser.js index 5324e0590a..258f2573fa 100644 --- a/phpgwapi/js/framework/fw_browser.js +++ b/phpgwapi/js/framework/fw_browser.js @@ -155,14 +155,25 @@ var fw_browser = Class.extend({ var self = this; this.ajaxLoaderDiv = jQuery('
'+egw.lang('please wait...')+'
').insertBefore(this.baseDiv); this.loadingDeferred = new jQuery.Deferred(); + + // Try to escape from infinitive not resolved loadingDeferred + // At least user can close the broken tab and work with the others. + // Define a escape timeout for 5 sec + this.ajaxLoaderDivTimeout = setTimeout(function(){ + self.ajaxLoaderDiv.hide().remove(); + self.ajaxLoaderDiv = null; + },5000); + this.loadingDeferred.always(function() { if(self.ajaxLoaderDiv) { self.ajaxLoaderDiv.hide().remove(); self.ajaxLoaderDiv = null; + // Remove escape timeout + clearTimeout(self.ajaxLoaderDivTimeout); } }); - + // Check whether the given url is a pseudo url which should be executed // by calling the ajax_exec function // we now send whole url back to server, so apps can use $_GET['ajax']==='true'