複数タブを閉じる時の確認を完全に自前で行うように
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4524 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
eeb11c5680
commit
2459ccd4f3
@ -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
|
||||
|
5
content/treestyletab/treestyletab-fx3.xul
Normal file
5
content/treestyletab/treestyletab-fx3.xul
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<stringbundle id="treestyletab-tabbrowserBundle"
|
||||
src="chrome://browser/locale/tabbrowser.properties"/>
|
||||
</overlay>
|
@ -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)
|
||||
{
|
||||
|
@ -48,6 +48,8 @@
|
||||
<stringbundleset id="stringbundleset">
|
||||
<stringbundle id="treestyletab-stringbundle"
|
||||
src="chrome://treestyletab/locale/treestyletab.properties"/>
|
||||
<stringbundle id="treestyletab-tabbrowserBundle"
|
||||
src="chrome://global/locale/tabbrowser.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<popupset id="mainPopupSet">
|
||||
|
@ -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(',
|
||||
|
Loading…
Reference in New Issue
Block a user