From cf3f05d58b13cd6e32ba2ebcb1c710de078e70af Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Fri, 19 Oct 2012 11:10:52 +0530 Subject: [PATCH] [IMP]percentage in title. bzr revid: vme@tinyerp.com-20121019054052-valignwzrc4jao4v --- addons/web/static/src/js/chrome.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 3cb4437d1c3..62f55c439cf 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -236,6 +236,9 @@ instance.web.Loading = instance.web.Widget.extend({ this._super(parent); this.count = 0; this.blocked_ui = false; + this.old_title = document.title; + this.request_count = 0; + this.response_count = 0; this.session.on("request", this, this.request_call); this.session.on("response", this, this.response_call); this.session.on("response_failed", this, this.response_call); @@ -245,13 +248,19 @@ instance.web.Loading = instance.web.Widget.extend({ this._super(); }, request_call: function() { + this.request_count += 1; this.on_rpc_event(1); }, response_call: function() { + this.response_count += 1; this.on_rpc_event(-1); }, + loading_title:function(percentage){ + document.title = percentage + "% processed |" + this.old_title; + }, on_rpc_event : function(increment) { var self = this; + this.loading_title(parseInt(this.response_count * 100 / this.request_count)) if (!this.count && increment === 1) { // Block UI after 3s this.long_running_timer = setTimeout(function () { @@ -271,6 +280,7 @@ instance.web.Loading = instance.web.Widget.extend({ this.getParent().$el.addClass('oe_wait'); } else { this.count = 0; + document.title = this.old_title; clearTimeout(this.long_running_timer); // Don't unblock if blocked by somebody else if (self.blocked_ui) {