複数タブを閉じる時の確認を完全に自前で行うように
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/
|
content treestyletab jar:chrome/treestyletab.jar!/content/treestyletab/
|
||||||
|
|
||||||
overlay chrome://browser/content/browser.xul chrome://treestyletab/content/treestyletab.xul
|
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
|
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
|
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>
|
@ -229,6 +229,14 @@ var TreeStyleTabService = {
|
|||||||
},
|
},
|
||||||
_stringbundle : null,
|
_stringbundle : null,
|
||||||
|
|
||||||
|
get tabbrowserBundle() {
|
||||||
|
if (!this._tabbrowserBundle) {
|
||||||
|
this._tabbrowserBundle = document.getElementById('treestyletab-tabbrowserBundle');
|
||||||
|
}
|
||||||
|
return this._tabbrowserBundle;
|
||||||
|
},
|
||||||
|
_tabbrowserBundle : null,
|
||||||
|
|
||||||
/* API */
|
/* API */
|
||||||
|
|
||||||
readyToOpenChildTab : function(aFrameOrTabBrowser, aMultiple, aInsertBefore) /* PUBLIC API */
|
readyToOpenChildTab : function(aFrameOrTabBrowser, aMultiple, aInsertBefore) /* PUBLIC API */
|
||||||
@ -2029,24 +2037,40 @@ catch(e) {
|
|||||||
else
|
else
|
||||||
tabs = this.cleanUpTabsArray(tabs.concat(descendant));
|
tabs = this.cleanUpTabsArray(tabs.concat(descendant));
|
||||||
|
|
||||||
var max = tabs.length;
|
if (!this.warnAboutClosingTabs(tabs.length))
|
||||||
if (!max) return;
|
|
||||||
|
|
||||||
b.__treestyletab__closedTabsNum = max;
|
|
||||||
if (
|
|
||||||
max > 1 &&
|
|
||||||
!b.warnAboutClosingTabs(true)
|
|
||||||
) {
|
|
||||||
b.__treestyletab__closedTabsNum = 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
b.__treestyletab__closedTabsNum = 0;
|
|
||||||
|
|
||||||
for (var i = tabs.length-1; i > -1; i--)
|
for (var i = tabs.length-1; i > -1; i--)
|
||||||
{
|
{
|
||||||
b.removeTab(tabs[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)
|
cleanUpTabsArray : function(aTabs)
|
||||||
{
|
{
|
||||||
|
@ -48,6 +48,8 @@
|
|||||||
<stringbundleset id="stringbundleset">
|
<stringbundleset id="stringbundleset">
|
||||||
<stringbundle id="treestyletab-stringbundle"
|
<stringbundle id="treestyletab-stringbundle"
|
||||||
src="chrome://treestyletab/locale/treestyletab.properties"/>
|
src="chrome://treestyletab/locale/treestyletab.properties"/>
|
||||||
|
<stringbundle id="treestyletab-tabbrowserBundle"
|
||||||
|
src="chrome://global/locale/tabbrowser.properties"/>
|
||||||
</stringbundleset>
|
</stringbundleset>
|
||||||
|
|
||||||
<popupset id="mainPopupSet">
|
<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) {
|
if ('_onDragEnd' in b) {
|
||||||
eval('b._onDragEnd = '+b._onDragEnd.toSource().replace(
|
eval('b._onDragEnd = '+b._onDragEnd.toSource().replace(
|
||||||
'this._replaceTabWithWindow(',
|
'this._replaceTabWithWindow(',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user