diff --git a/chrome.manifest b/chrome.manifest index e0a3a6ea..8ce00935 100644 --- a/chrome.manifest +++ b/chrome.manifest @@ -1,7 +1,7 @@ content treestyletab jar:chrome/treestyletab.jar!/content/treestyletab/ overlay chrome://browser/content/browser.xul chrome://treestyletab/content/treestyletab.xul -overlay chrome://browser/content/bookmarks/bookmarksPanel.xul chrome://treestyletab/content/bookmarksOverlay.xul +overlay chrome://browser/content/browser.xul chrome://treestyletab/content/treestyletab-fx3.xul appversion>=3.0overlay chrome://browser/content/bookmarks/bookmarksPanel.xul chrome://treestyletab/content/bookmarksOverlay.xul overlay chrome://multipletab/content/config.xul chrome://treestyletab/content/multipletabConfigOverlay.xul style chrome://browser/content/browser.xul chrome://treestyletab/content/treestyletab-3.5.css appversion>=3.1b3pre diff --git a/content/treestyletab/treestyletab-fx3.xul b/content/treestyletab/treestyletab-fx3.xul new file mode 100644 index 00000000..6d5ac5b5 --- /dev/null +++ b/content/treestyletab/treestyletab-fx3.xul @@ -0,0 +1,5 @@ + + + + diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index da576a38..b37d65a9 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -228,6 +228,14 @@ var TreeStyleTabService = { return this._stringbundle; }, _stringbundle : null, + + get tabbrowserBundle() { + if (!this._tabbrowserBundle) { + this._tabbrowserBundle = document.getElementById('treestyletab-tabbrowserBundle'); + } + return this._tabbrowserBundle; + }, + _tabbrowserBundle : null, /* API */ @@ -2029,24 +2037,40 @@ catch(e) { else tabs = this.cleanUpTabsArray(tabs.concat(descendant)); - var max = tabs.length; - if (!max) return; - - b.__treestyletab__closedTabsNum = max; - if ( - max > 1 && - !b.warnAboutClosingTabs(true) - ) { - b.__treestyletab__closedTabsNum = 0; + if (!this.warnAboutClosingTabs(tabs.length)) return; - } - b.__treestyletab__closedTabsNum = 0; for (var i = tabs.length-1; i > -1; i--) { b.removeTab(tabs[i]); } }, + warnAboutClosingTabs : function(aTabsCount) + { + if ( + aTabsCount <= 1 || + this.getPref('browser.tabs.warnOnClose') + ) + return true; + var promptService = Components + .classes['@mozilla.org/embedcomp/prompt-service;1'] + .getService(Components.interfaces.nsIPromptService); + var checked = { value:true }; + window.focus(); + var shouldClose = promptService.confirmEx(window, + this.tabbrowserBundle.getString('tabs.closeWarningTitle'), + this.tabbrowserBundle.getFormattedString('tabs.closeWarningMultipleTabs', [aTabsCount]), + (promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0) + + (promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1), + this.tabbrowserBundle.getString('tabs.closeButtonMultiple'), + null, null, + this.tabbrowserBundle.getString('tabs.closeWarningPromptMe'), + checked + ) == 0; + if (shouldClose && !checked.value) + this.setPref('browser.tabs.warnOnClose', false); + return shouldClose; + }, cleanUpTabsArray : function(aTabs) { diff --git a/content/treestyletab/treestyletab.xul b/content/treestyletab/treestyletab.xul index 3749db35..016d6844 100644 --- a/content/treestyletab/treestyletab.xul +++ b/content/treestyletab/treestyletab.xul @@ -48,6 +48,8 @@ + diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 58f11390..450e5838 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -465,13 +465,6 @@ TreeStyleTabBrowser.prototype = { ) ); - eval('b.warnAboutClosingTabs = '+ - b.warnAboutClosingTabs.toSource().replace( - 'var numTabs = ', - 'var numTabs = this.__treestyletab__closedTabsNum || ' - ) - ); - if ('_onDragEnd' in b) { eval('b._onDragEnd = '+b._onDragEnd.toSource().replace( 'this._replaceTabWithWindow(',