diff --git a/content/treestyletab/res/stopRendering.js b/content/treestyletab/res/stopRendering.js index 5c97b622..32b58095 100644 --- a/content/treestyletab/res/stopRendering.js +++ b/content/treestyletab/res/stopRendering.js @@ -12,7 +12,7 @@ http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/stopRendering.js */ (function() { - const currentRevision = 1; + const currentRevision = 2; if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {}; @@ -30,7 +30,7 @@ get rootContentViewer() { - return window + return window.top .QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Components.interfaces.nsIDocShell) @@ -38,18 +38,32 @@ .QueryInterface(Components.interfaces.nsIMarkupDocumentViewer); }, + get isActive() + { + return window.top.document.documentElement.getAttribute('active') == 'true'; + }, + stop : function() { - if (!this._stopLevel) + if (!this._stopLevel) { this.rootContentViewer.hide(); + } this._stopLevel++; }, start : function() { this._stopLevel--; - if (!this._stopLevel) + if (!this._stopLevel) { this.rootContentViewer.show(); + if (this.isActive && !this.timer) { + this.timer = window.setTimeout(function(aSelf) { + aSelf.timer = null; + window.top.blur(); + window.top.focus(); + }, 0, this); + } + } } };