From 5e8239da422cbf313079db16fe4949fcd2a09e82 Mon Sep 17 00:00:00 2001 From: mDeflotte Date: Thu, 7 Jun 2012 11:51:28 +0000 Subject: [PATCH] // Avoid abort ajax query on changing the product name git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15916 b9a71923-0436-4b27-9f14-aed3839534dd --- js/productTabsManager.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/js/productTabsManager.js b/js/productTabsManager.js index 08d8c9ae9..1357c5e40 100644 --- a/js/productTabsManager.js +++ b/js/productTabsManager.js @@ -31,6 +31,7 @@ function ProductTabsManager(){ this.product_tabs = []; this.current_request; this.stack_error = []; + this.page_reloading = false; this.setTabs = function(tabs){ this.product_tabs = tabs; @@ -46,12 +47,25 @@ function ProductTabsManager(){ this.onLoad(tab_name, this.product_tabs[tab_name].onReady); } - $(document).bind('change', function(){ + // @see with tDidierjean + //$(document).bind('change', function(){ + // if (self.current_request) + // { + // self.current_request.abort(); + // } + //}); + + $('.shopList.chzn-done').bind('change', function(){ if (self.current_request) { + self.page_reloading = true; self.current_request.abort(); } }); + + $(window).bind('beforeunload', function() { + self.page_reloading = true; + }); } /** @@ -158,7 +172,7 @@ function ProductTabsManager(){ { self.displayBulk(stack); } - else if (self.stack_error.length !== 0) + else if (self.stack_error.length !== 0 && !self.page_reloading) { jConfirm(reload_tab_description, reload_tab_title, function(confirm) { if (confirm === true)