Index: core/admin_templates/js/ajax.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/admin_templates/js/ajax.js (revision 15805) +++ core/admin_templates/js/ajax.js (revision ) @@ -14,7 +14,7 @@ // Main AJAX classs function Request() {} -Request.timeout = 60000; //60 seconds +Request.timeout = 60 * 1000; // 60 seconds Request.method = 'GET'; Request.headers = {}; Request.params = null; @@ -239,7 +239,7 @@ this.BusyRequest = false; this.LastResponceTime = this.GetMicroTime(); this.ProgressPercent = 0; // progress percent - this.ProgressTime = new Array(); + this.ProgressTime = []; this.Query(); } @@ -253,38 +253,38 @@ } AjaxProgressBar.prototype.Query = function() { -// prompt('requestinng', this.URL); - Request.makeRequest(this.URL, this.BusyRequest, '', this.successCallback, this.errorCallback, '', this); -} + var $me = this; -// return time needed for progress to finish -AjaxProgressBar.prototype.GetEstimatedTime = function() { - return Math.ceil((100 - this.ProgressPercent) * Math.sum(this.ProgressTime) / this.ProgressPercent); -} + $.ajaxSetup({cache: false}); -AjaxProgressBar.prototype.successCallback = function($request, $params, $object) { - var $responce = $request.responseText; - var $match_redirect = new RegExp('^#redirect#(.*?)($|\\s.*)').exec($responce); + $.get( + this.URL, + function ($response) { + var $match_redirect = new RegExp('^#redirect#(.*?)($|\\s.*)').exec($response); + - if ($match_redirect != null) { + if ( $match_redirect != null ) { - $object.showProgress(100); + $me.showProgress(100); - // redirect to external template requested + // redirect to external template requested - window.location.href = $match_redirect[1]; - return false; + window.location.assign($match_redirect[1]); + return; - } + } - if (isNaN(parseFloat($responce))) { - // error message received, otherwise $responce should be number - alert($responce); + if ( isNaN(parseFloat($response)) ) { + // error message received, otherwise $response should be number + alert($response); - return ; + return; - } + } - if ($object.showProgress($responce)) { - $object.Query(); + if ( $me.showProgress($response) ) { + $me.Query(); - } -} + } + } + ); +} -AjaxProgressBar.prototype.errorCallback = function($request, $params, $object) { - alert('AJAX Error; class: AjaxProgressBar; ' + Request.getErrorHtml($request)); +// return time needed for progress to finish +AjaxProgressBar.prototype.GetEstimatedTime = function() { + return Math.ceil((100 - this.ProgressPercent) * Math.sum(this.ProgressTime) / this.ProgressPercent); } AjaxProgressBar.prototype.FormatTime = function ($seconds) { \ No newline at end of file