use Iterator instead of forEach (for performance optimization)
This commit is contained in:
parent
35d1bfce99
commit
59444c68a6
@ -52,41 +52,43 @@ var TreeStyleTabBookmarksService = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aBookarmks.forEach(function(aItem) {
|
for (let [, item] in Iterator(aBookarmks))
|
||||||
aItem.position = this.BookmarksService.getItemIndex(aItem.id);
|
{
|
||||||
},this);
|
item.position = this.BookmarksService.getItemIndex(item.id);
|
||||||
|
}
|
||||||
aBookarmks.sort(function(aA, aB) {
|
aBookarmks.sort(function(aA, aB) {
|
||||||
return aA.position - aB.position;
|
return aA.position - aB.position;
|
||||||
});
|
});
|
||||||
|
|
||||||
aBookarmks.forEach(function(aItem, aIndex) {
|
for (let [i, item] in Iterator(aBookarmks))
|
||||||
if (this.BookmarksService.getItemType(aItem.id) != this.BookmarksService.TYPE_BOOKMARK)
|
{
|
||||||
return;
|
if (this.BookmarksService.getItemType(item.id) != this.BookmarksService.TYPE_BOOKMARK)
|
||||||
|
continue;
|
||||||
|
|
||||||
let uri = this.BookmarksService.getBookmarkURI(aItem.id);
|
let uri = this.BookmarksService.getBookmarkURI(item.id);
|
||||||
if (/^about:treestyletab-group\b/.test(uri.spec)) {
|
if (/^about:treestyletab-group\b/.test(uri.spec)) {
|
||||||
let title = this.BookmarksService.getItemTitle(aItem.id);
|
let title = this.BookmarksService.getItemTitle(item.id);
|
||||||
let folderId = this.BookmarksService.createFolder(aItem.parent, title, aItem.position);
|
let folderId = this.BookmarksService.createFolder(item.parent, title, item.position);
|
||||||
this.BookmarksService.removeItem(aItem.id);
|
this.BookmarksService.removeItem(item.id);
|
||||||
aItem.id = folderId;
|
item.id = folderId;
|
||||||
aItem.isFolder = true;
|
item.isFolder = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let index = aTreeStructure[aIndex];
|
let index = aTreeStructure[i];
|
||||||
let parent = index > -1 ? aBookarmks[index] : null ;
|
let parent = index > -1 ? aBookarmks[index] : null ;
|
||||||
if (parent && (parent.folder || parent).isFolder) {
|
if (parent && (parent.folder || parent).isFolder) {
|
||||||
let folder = parent.folder || parent;
|
let folder = parent.folder || parent;
|
||||||
this.BookmarksService.moveItem(aItem.id, folder.id, -1);
|
this.BookmarksService.moveItem(item.id, folder.id, -1);
|
||||||
aItem.folder = folder;
|
item.folder = folder;
|
||||||
}
|
}
|
||||||
if (parent && !parent.isFolder) {
|
if (parent && !parent.isFolder) {
|
||||||
PlacesUtils.setAnnotationsForItem(aItem.id, [{
|
PlacesUtils.setAnnotationsForItem(item.id, [{
|
||||||
name : this.kPARENT,
|
name : this.kPARENT,
|
||||||
value : parent ? parent.id : -1,
|
value : parent ? parent.id : -1,
|
||||||
expires : PlacesUtils.annotations.EXPIRE_NEVER
|
expires : PlacesUtils.annotations.EXPIRE_NEVER
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
}, this);
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
bookmarkTabSubtree : function TSTBMService_bookmarkTabSubtree(aTabOrTabs)
|
bookmarkTabSubtree : function TSTBMService_bookmarkTabSubtree(aTabOrTabs)
|
||||||
@ -102,10 +104,11 @@ var TreeStyleTabBookmarksService = {
|
|||||||
|
|
||||||
var b = this.getTabBrowserFromChild(tabs[0]);
|
var b = this.getTabBrowserFromChild(tabs[0]);
|
||||||
var bookmarkedTabs = [];
|
var bookmarkedTabs = [];
|
||||||
tabs.forEach(function(aTab, aIndex) {
|
for (let [i, tab] in Iterator(tabs))
|
||||||
if (!this.isGroupTab(aTab, aIndex == 0)) bookmarkedTabs.push(aTab);
|
{
|
||||||
bookmarkedTabs = bookmarkedTabs.concat(b.treeStyleTab.getDescendantTabs(aTab));
|
if (!this.isGroupTab(tab, i == 0)) bookmarkedTabs.push(tab);
|
||||||
}, this);
|
bookmarkedTabs = bookmarkedTabs.concat(b.treeStyleTab.getDescendantTabs(tab));
|
||||||
|
}
|
||||||
|
|
||||||
this.beginAddBookmarksFromTabs(bookmarkedTabs);
|
this.beginAddBookmarksFromTabs(bookmarkedTabs);
|
||||||
try {
|
try {
|
||||||
@ -357,12 +360,13 @@ var TreeStyleTabBookmarksService = {
|
|||||||
TreeStyleTabBookmarksService.beginAddBookmarksFromTabs((function() {
|
TreeStyleTabBookmarksService.beginAddBookmarksFromTabs((function() {
|
||||||
var tabs = [];
|
var tabs = [];
|
||||||
var seen = {};
|
var seen = {};
|
||||||
Array.forEach(getBrowser().mTabContainer.childNodes, function(aTab) {
|
for (let [, tab] in Iterator(getBrowser().mTabContainer.childNodes))
|
||||||
let uri = aTab.linkedBrowser.currentURI.spec;
|
{
|
||||||
if (uri in seen) return;
|
let uri = tab.linkedBrowser.currentURI.spec;
|
||||||
|
if (uri in seen) continue;
|
||||||
seen[uri] = true;
|
seen[uri] = true;
|
||||||
tabs.push(aTab);
|
tabs.push(tab);
|
||||||
});
|
}
|
||||||
return tabs;
|
return tabs;
|
||||||
})());
|
})());
|
||||||
try {
|
try {
|
||||||
|
@ -155,12 +155,13 @@ var TreeStyleTabBookmarksServiceEditable = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fragment = document.createDocumentFragment();
|
var fragment = document.createDocumentFragment();
|
||||||
items.forEach(function(aId, aIndex) {
|
for (let [i, id] in Iterator(items))
|
||||||
let label = PlacesUtils.bookmarks.getItemTitle(aId);
|
{
|
||||||
|
let label = PlacesUtils.bookmarks.getItemTitle(id);
|
||||||
let item = document.createElement('menuitem');
|
let item = document.createElement('menuitem');
|
||||||
item.setAttribute('value', aId);
|
item.setAttribute('value', id);
|
||||||
|
|
||||||
let parent = aIndex;
|
let parent = i;
|
||||||
let nest = 0;
|
let nest = 0;
|
||||||
let disabled = false;
|
let disabled = false;
|
||||||
while ((parent = treeStructure[parent]) != -1)
|
while ((parent = treeStructure[parent]) != -1)
|
||||||
@ -170,17 +171,17 @@ var TreeStyleTabBookmarksServiceEditable = {
|
|||||||
}
|
}
|
||||||
if (nest) item.setAttribute('style', 'padding-left:'+nest+'em');
|
if (nest) item.setAttribute('style', 'padding-left:'+nest+'em');
|
||||||
|
|
||||||
if (disabled || aId == aCurrentItem) {
|
if (disabled || id == aCurrentItem) {
|
||||||
item.setAttribute('disabled', true);
|
item.setAttribute('disabled', true);
|
||||||
if (aId == aCurrentItem)
|
if (id == aCurrentItem)
|
||||||
label = this.treeBundle.getFormattedString('bookmarkProperty.parent.current.label', [label]);
|
label = this.treeBundle.getFormattedString('bookmarkProperty.parent.current.label', [label]);
|
||||||
}
|
}
|
||||||
if (aId == selected) item.setAttribute('selected', true);
|
if (id == selected) item.setAttribute('selected', true);
|
||||||
|
|
||||||
item.setAttribute('label', label);
|
item.setAttribute('label', label);
|
||||||
|
|
||||||
fragment.appendChild(item);
|
fragment.appendChild(item);
|
||||||
}, this);
|
}
|
||||||
return fragment;
|
return fragment;
|
||||||
},
|
},
|
||||||
_getItemsInFolder : function TSTBMEditable__getItemsInFolder(aId)
|
_getItemsInFolder : function TSTBMEditable__getItemsInFolder(aId)
|
||||||
|
@ -89,15 +89,14 @@ function initAppearancePane()
|
|||||||
document.getElementById('extensions.treestyletab.tabbar.style-arrowscrollbox'),
|
document.getElementById('extensions.treestyletab.tabbar.style-arrowscrollbox'),
|
||||||
document.getElementById('extensions.treestyletab.twisty.style-arrowscrollbox')
|
document.getElementById('extensions.treestyletab.twisty.style-arrowscrollbox')
|
||||||
];
|
];
|
||||||
Array.slice(boxes[0].childNodes).concat(Array.slice(boxes[1].childNodes))
|
Array.slice(boxes[0].childNodes).concat(Array.slice(boxes[1].childNodes)).forEach(function(aItem) {
|
||||||
.forEach(function(aItem) {
|
let start = 0;
|
||||||
var start = 0;
|
let delta = 200;
|
||||||
var delta = 200;
|
let radian = 90 * Math.PI / 180;
|
||||||
var radian = 90 * Math.PI / 180;
|
|
||||||
aItem.style.overflow = 'hidden';
|
aItem.style.overflow = 'hidden';
|
||||||
aItem.width = 0;
|
aItem.width = 0;
|
||||||
aItem.style.maxWidth = 0;
|
aItem.style.maxWidth = 0;
|
||||||
var task = function(aTime, aBeginning, aChange, aDuration) {
|
let task = function(aTime, aBeginning, aChange, aDuration) {
|
||||||
var width;
|
var width;
|
||||||
if (aTime >= aDuration) {
|
if (aTime >= aDuration) {
|
||||||
width = start + delta;
|
width = start + delta;
|
||||||
@ -186,17 +185,18 @@ function onSyncGroupBookmarkUIToPref()
|
|||||||
if (gGroupBookmarkUnderParent.checked) behavior |= 256;
|
if (gGroupBookmarkUnderParent.checked) behavior |= 256;
|
||||||
if (gGroupBookmarkType.value == 'true') behavior |= 512;
|
if (gGroupBookmarkType.value == 'true') behavior |= 512;
|
||||||
|
|
||||||
[
|
for (let [, node] in Iterator([
|
||||||
gGroupBookmarkUnderParent,
|
gGroupBookmarkUnderParent,
|
||||||
gGroupBookmarkType,
|
gGroupBookmarkType,
|
||||||
gGroupBookmarkType.previousSibling,
|
gGroupBookmarkType.previousSibling,
|
||||||
gGroupBookmarkType.nextSibling
|
gGroupBookmarkType.nextSibling
|
||||||
].forEach(function(aNode) {
|
]))
|
||||||
|
{
|
||||||
if (behavior & 1)
|
if (behavior & 1)
|
||||||
aNode.removeAttribute('disabled');
|
node.removeAttribute('disabled');
|
||||||
else
|
else
|
||||||
aNode.setAttribute('disabled', true);
|
node.setAttribute('disabled', true);
|
||||||
});
|
}
|
||||||
|
|
||||||
return behavior;
|
return behavior;
|
||||||
}
|
}
|
||||||
|
@ -201,24 +201,24 @@ var TreeStyleTabWindowHelper = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._splitFunctionNames(<![CDATA[
|
for (let [, func] in Iterator(this._splitFunctionNames(<![CDATA[
|
||||||
window.duplicateTab.handleLinkClick
|
window.duplicateTab.handleLinkClick
|
||||||
window.duplicatethistab.handleLinkClick
|
window.duplicatethistab.handleLinkClick
|
||||||
window.__treestyletab__highlander__origHandleLinkClick
|
window.__treestyletab__highlander__origHandleLinkClick
|
||||||
window.__splitbrowser__handleLinkClick
|
window.__splitbrowser__handleLinkClick
|
||||||
window.__ctxextensions__handleLinkClick
|
window.__ctxextensions__handleLinkClick
|
||||||
window.handleLinkClick
|
window.handleLinkClick
|
||||||
]]>).some(function(aFunc) {
|
]]>)))
|
||||||
let source = this._getFunctionSource(aFunc);
|
{
|
||||||
|
let source = this._getFunctionSource(func);
|
||||||
if (!source || !/^\(?function handleLinkClick/.test(source))
|
if (!source || !/^\(?function handleLinkClick/.test(source))
|
||||||
return false;
|
continue;
|
||||||
eval(aFunc+' = '+source.replace(
|
eval(func+' = '+source.replace(
|
||||||
/(charset\s*:\s*doc\.characterSet\s*)/,
|
/(charset\s*:\s*doc\.characterSet\s*)/,
|
||||||
'$1, event : event, linkNode : linkNode'
|
'$1, event : event, linkNode : linkNode'
|
||||||
));
|
));
|
||||||
source = null;
|
break;
|
||||||
return true;
|
}
|
||||||
}, this);
|
|
||||||
|
|
||||||
if ('openLinkIn' in window) {
|
if ('openLinkIn' in window) {
|
||||||
eval('window.openLinkIn = '+
|
eval('window.openLinkIn = '+
|
||||||
@ -233,16 +233,17 @@ var TreeStyleTabWindowHelper = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._splitFunctionNames(<![CDATA[
|
for (let [, func] in Iterator(this._splitFunctionNames(<![CDATA[
|
||||||
window.permaTabs.utils.wrappedFunctions["window.contentAreaClick"]
|
window.permaTabs.utils.wrappedFunctions["window.contentAreaClick"]
|
||||||
window.__contentAreaClick
|
window.__contentAreaClick
|
||||||
window.__ctxextensions__contentAreaClick
|
window.__ctxextensions__contentAreaClick
|
||||||
window.contentAreaClick
|
window.contentAreaClick
|
||||||
]]>).forEach(function(aFunc) {
|
]]>)))
|
||||||
let source = this._getFunctionSource(aFunc);
|
{
|
||||||
|
let source = this._getFunctionSource(func);
|
||||||
if (!source || !/^\(?function contentAreaClick/.test(source))
|
if (!source || !/^\(?function contentAreaClick/.test(source))
|
||||||
return;
|
continue;
|
||||||
eval(aFunc+' = '+source.replace(
|
eval(func+' = '+source.replace(
|
||||||
// for Tab Utilities, etc. Some addons insert openNewTabWith() to the function.
|
// for Tab Utilities, etc. Some addons insert openNewTabWith() to the function.
|
||||||
// (calls for the function is not included by Firefox default.)
|
// (calls for the function is not included by Firefox default.)
|
||||||
/(openNewTabWith\()/g,
|
/(openNewTabWith\()/g,
|
||||||
@ -250,10 +251,9 @@ var TreeStyleTabWindowHelper = {
|
|||||||
if (!TreeStyleTabService.checkToOpenChildTab(event.target.ownerDocument.defaultView)) TreeStyleTabService.readyToOpenChildTab(event.target.ownerDocument.defaultView);
|
if (!TreeStyleTabService.checkToOpenChildTab(event.target.ownerDocument.defaultView)) TreeStyleTabService.readyToOpenChildTab(event.target.ownerDocument.defaultView);
|
||||||
$1]]>
|
$1]]>
|
||||||
));
|
));
|
||||||
source = null;
|
}
|
||||||
}, this);
|
|
||||||
|
|
||||||
this._splitFunctionNames(<![CDATA[
|
for (let [, func] in Iterator(this._splitFunctionNames(<![CDATA[
|
||||||
window.duplicateTab.gotoHistoryIndex
|
window.duplicateTab.gotoHistoryIndex
|
||||||
window.duplicateTab.BrowserBack
|
window.duplicateTab.BrowserBack
|
||||||
window.duplicateTab.BrowserForward
|
window.duplicateTab.BrowserForward
|
||||||
@ -265,52 +265,52 @@ var TreeStyleTabWindowHelper = {
|
|||||||
window.gotoHistoryIndex
|
window.gotoHistoryIndex
|
||||||
window.BrowserForward
|
window.BrowserForward
|
||||||
window.BrowserBack
|
window.BrowserBack
|
||||||
]]>).forEach(function(aFunc) {
|
]]>)))
|
||||||
let source = this._getFunctionSource(aFunc);
|
{
|
||||||
|
let source = this._getFunctionSource(func);
|
||||||
if (!source || !/^\(?function (gotoHistoryIndex|BrowserForward|BrowserBack)/.test(source))
|
if (!source || !/^\(?function (gotoHistoryIndex|BrowserForward|BrowserBack)/.test(source))
|
||||||
return;
|
continue;
|
||||||
eval(aFunc+' = '+source.replace(
|
eval(func+' = '+source.replace(
|
||||||
/((?:openUILinkIn|duplicateTabIn)\()/g,
|
/((?:openUILinkIn|duplicateTabIn)\()/g,
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
if (where == 'tab' || where == 'tabshifted')
|
if (where == 'tab' || where == 'tabshifted')
|
||||||
TreeStyleTabService.readyToOpenChildTab();
|
TreeStyleTabService.readyToOpenChildTab();
|
||||||
$1]]>
|
$1]]>
|
||||||
));
|
));
|
||||||
source = null;
|
}
|
||||||
}, this);
|
|
||||||
|
|
||||||
this._splitFunctionNames(<![CDATA[
|
for (let [, func] in Iterator(this._splitFunctionNames(<![CDATA[
|
||||||
window.BrowserReloadOrDuplicate
|
window.BrowserReloadOrDuplicate
|
||||||
]]>).forEach(function(aFunc) {
|
]]>)))
|
||||||
let source = this._getFunctionSource(aFunc);
|
{
|
||||||
|
let source = this._getFunctionSource(func);
|
||||||
if (!source || !/^\(?function (BrowserReloadOrDuplicate)/.test(source))
|
if (!source || !/^\(?function (BrowserReloadOrDuplicate)/.test(source))
|
||||||
return;
|
continue;
|
||||||
eval(aFunc+' = '+source.replace(
|
eval(func+' = '+source.replace(
|
||||||
/((?:openUILinkIn|duplicateTabIn)\()/g,
|
/((?:openUILinkIn|duplicateTabIn)\()/g,
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
if (where == 'tab' || where == 'tabshifted')
|
if (where == 'tab' || where == 'tabshifted')
|
||||||
TreeStyleTabService.onBeforeTabDuplicate(null);
|
TreeStyleTabService.onBeforeTabDuplicate(null);
|
||||||
$&]]>
|
$&]]>
|
||||||
));
|
));
|
||||||
source = null;
|
}
|
||||||
}, this);
|
|
||||||
|
|
||||||
this._splitFunctionNames(<![CDATA[
|
for (let [, func] in Iterator(this._splitFunctionNames(<![CDATA[
|
||||||
permaTabs.utils.wrappedFunctions["window.BrowserHomeClick"]
|
permaTabs.utils.wrappedFunctions["window.BrowserHomeClick"]
|
||||||
window.BrowserHomeClick
|
window.BrowserHomeClick
|
||||||
window.BrowserGoHome
|
window.BrowserGoHome
|
||||||
]]>).forEach(function(aFunc) {
|
]]>)))
|
||||||
let source = this._getFunctionSource(aFunc);
|
{
|
||||||
|
let source = this._getFunctionSource(func);
|
||||||
if (!source || !/^\(?function (BrowserHomeClick|BrowserGoHome)/.test(source))
|
if (!source || !/^\(?function (BrowserHomeClick|BrowserGoHome)/.test(source))
|
||||||
return;
|
continue;
|
||||||
eval(aFunc+' = '+source.replace(
|
eval(func+' = '+source.replace(
|
||||||
'gBrowser.loadTabs(',
|
'gBrowser.loadTabs(',
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
TreeStyleTabService.readyToOpenNewTabGroup(gBrowser);
|
TreeStyleTabService.readyToOpenNewTabGroup(gBrowser);
|
||||||
$&]]>
|
$&]]>
|
||||||
));
|
));
|
||||||
source = null;
|
}
|
||||||
}, this);
|
|
||||||
|
|
||||||
eval('FeedHandler.loadFeed = '+
|
eval('FeedHandler.loadFeed = '+
|
||||||
FeedHandler.loadFeed.toSource().replace(
|
FeedHandler.loadFeed.toSource().replace(
|
||||||
|
@ -86,16 +86,17 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
|
|||||||
(function() {
|
(function() {
|
||||||
var tabsInfo = {};
|
var tabsInfo = {};
|
||||||
var TST = TreeStyleTabService;
|
var TST = TreeStyleTabService;
|
||||||
Array.slice(getBrowser().mTabContainer.childNodes)
|
for (let [, tab] in Iterator(getBrowser().mTabContainer.childNodes))
|
||||||
.forEach(function(aTab) {
|
{
|
||||||
var index = this.getPermaTabLocalIndex(aTab);
|
let index = this.getPermaTabLocalIndex(tab);
|
||||||
if (index < 0) return;
|
if (index < 0) continue;
|
||||||
var info = {};
|
let info = {};
|
||||||
TST.extraProperties.forEach(function(aProperty) {
|
for (let [, property] in Iterator(TST.extraProperties))
|
||||||
info[aProperty] = TST.getTabValue(aTab, aProperty);
|
{
|
||||||
});
|
info[property] = TST.getTabValue(tab, property);
|
||||||
|
}
|
||||||
tabsInfo[this.permaTabs[index].id] = info;
|
tabsInfo[this.permaTabs[index].id] = info;
|
||||||
}, this);
|
}
|
||||||
TST.setTreePref('permaTabsInfo', tabsInfo.toSource());
|
TST.setTreePref('permaTabsInfo', tabsInfo.toSource());
|
||||||
}).call(this);
|
}).call(this);
|
||||||
]]>
|
]]>
|
||||||
@ -124,9 +125,10 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
|
|||||||
sessionData.getTabProperties.toSource().replace(
|
sessionData.getTabProperties.toSource().replace(
|
||||||
'return tabProperties;',
|
'return tabProperties;',
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
this.tabTSTProperties.forEach(function(aProp) {
|
for (let [, property] in Iterator(this.tabTSTProperties))
|
||||||
tabProperties += '|' + aProp + '=' + encodeURIComponent(aTab.getAttribute(aProp));
|
{
|
||||||
});
|
tabProperties += '|' + property + '=' + encodeURIComponent(aTab.getAttribute(property));
|
||||||
|
}
|
||||||
$&]]>
|
$&]]>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -136,13 +138,14 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
|
|||||||
<![CDATA[$&
|
<![CDATA[$&
|
||||||
var TSTProps = tabProperties.split('|');
|
var TSTProps = tabProperties.split('|');
|
||||||
tabProperties = TSTProps.shift();
|
tabProperties = TSTProps.shift();
|
||||||
TSTProps.forEach(function(aSet) {
|
for (let [, property] in Iterator(TSTProps))
|
||||||
var index = aSet.indexOf('=');
|
{
|
||||||
var name = aSet.substring(0, index);
|
let index = property.indexOf('=');
|
||||||
var value = decodeURIComponent(aSet.substring(index+1));
|
let name = property.substring(0, index);
|
||||||
|
let value = decodeURIComponent(property.substring(index+1));
|
||||||
if (name && value)
|
if (name && value)
|
||||||
aTab.setAttribute(name, value);
|
aTab.setAttribute(name, value);
|
||||||
});
|
}
|
||||||
]]>
|
]]>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -197,12 +200,10 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
|
|||||||
'var tabcount = ',
|
'var tabcount = ',
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
gBrowser.treeStyleTab.collapseExpandAllSubtree(false, true);
|
gBrowser.treeStyleTab.collapseExpandAllSubtree(false, true);
|
||||||
gBrowser.treeStyleTab.getTabsArray(gBrowser)
|
for (let [, tab] in Iterator(gBrowser.treeStyleTab.getTabsArray(gBrowser).slice(1).reverse()))
|
||||||
.slice(1)
|
{
|
||||||
.reverse()
|
gBrowser.removeTab(tab);
|
||||||
.forEach(function(aTab, aIndex) {
|
}
|
||||||
gBrowser.removeTab(aTab);
|
|
||||||
});
|
|
||||||
TreeStyleTabService.restoringTree = true;
|
TreeStyleTabService.restoringTree = true;
|
||||||
$&]]>
|
$&]]>
|
||||||
));
|
));
|
||||||
@ -213,13 +214,14 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
|
|||||||
// https://addons.mozilla.org/firefox/addon/4650
|
// https://addons.mozilla.org/firefox/addon/4650
|
||||||
if ('FS_onFullerScreen' in window &&
|
if ('FS_onFullerScreen' in window &&
|
||||||
sv.getTreePref('compatibility.FullerScreen')) {
|
sv.getTreePref('compatibility.FullerScreen')) {
|
||||||
'CheckIfFullScreen,FS_onFullerScreen,FS_onMouseMove'.split(',').forEach(function(aFunc) {
|
for (let [, func] in Iterator('CheckIfFullScreen,FS_onFullerScreen,FS_onMouseMove'.split(',')))
|
||||||
if (!(aFunc in window)) return;
|
{
|
||||||
eval('window.'+aFunc+' = '+window[aFunc].toSource().replace(
|
if (!(func in window)) continue;
|
||||||
|
eval('window.'+func+' = '+window[func].toSource().replace(
|
||||||
/FS_data.mTabs.(removeAttribute\("moz-collapsed"\)|setAttribute\("moz-collapsed", "true"\));/g,
|
/FS_data.mTabs.(removeAttribute\("moz-collapsed"\)|setAttribute\("moz-collapsed", "true"\));/g,
|
||||||
'if (gBrowser.treeStyleTab.currentTabbarPosition == "top") { $& }'
|
'if (gBrowser.treeStyleTab.currentTabbarPosition == "top") { $& }'
|
||||||
));
|
));
|
||||||
}, this);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TooManyTabs
|
// TooManyTabs
|
||||||
@ -815,11 +817,11 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
|
|||||||
if ('LinkyContext' in window &&
|
if ('LinkyContext' in window &&
|
||||||
'prototype' in LinkyContext &&
|
'prototype' in LinkyContext &&
|
||||||
sv.getTreePref('compatibility.Linky')) {
|
sv.getTreePref('compatibility.Linky')) {
|
||||||
'doSelected,doSelectedText,doImages,doAll,doAllPics,doValidateAll,doValidateSelected'
|
for (let [, method] in Iterator('doSelected,doSelectedText,doImages,doAll,doAllPics,doValidateAll,doValidateSelected'.split(',')))
|
||||||
.split(',').forEach(function(aMethod) {
|
{
|
||||||
if (!(aMethod in LinkyContext.prototype)) return;
|
if (!(method in LinkyContext.prototype)) continue;
|
||||||
eval('LinkyContext.prototype.'+aMethod+' = '+
|
eval('LinkyContext.prototype.'+method+' = '+
|
||||||
LinkyContext.prototype[aMethod].toSource().replace(
|
LinkyContext.prototype[method].toSource().replace(
|
||||||
'{',
|
'{',
|
||||||
'{ TreeStyleTabService.readyToOpenChildTab(null, true);'
|
'{ TreeStyleTabService.readyToOpenChildTab(null, true);'
|
||||||
).replace(
|
).replace(
|
||||||
@ -827,7 +829,7 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
|
|||||||
'TreeStyleTabService.stopToOpenChildTab(); $1'
|
'TreeStyleTabService.stopToOpenChildTab(); $1'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// QuickDrag
|
// QuickDrag
|
||||||
@ -1322,16 +1324,18 @@ TreeStyleTabWindowHelper.overrideExtensionsDelayed = function TSTWH_overrideExte
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION:
|
case sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION:
|
||||||
tabbarToolboxes.forEach(function(aToolbox) {
|
for (let [, toolbox] in Iterator(tabbarToolboxes))
|
||||||
aToolbox.removeAttribute('collapsed');
|
{
|
||||||
});
|
toolbox.removeAttribute('collapsed');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION:
|
case sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION:
|
||||||
tabbarToolboxes.forEach(function(aToolbox) {
|
for (let [, toolbox] in Iterator(tabbarToolboxes))
|
||||||
if (!aToolbox.firstChild.hasChildNodes())
|
{
|
||||||
aToolbox.setAttribute('collapsed', true);
|
if (!toolbox.firstChild.hasChildNodes())
|
||||||
});
|
toolbox.setAttribute('collapsed', true);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'unload':
|
case 'unload':
|
||||||
@ -1348,10 +1352,11 @@ TreeStyleTabWindowHelper.overrideExtensionsDelayed = function TSTWH_overrideExte
|
|||||||
document.addEventListener(sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION, listener, false);
|
document.addEventListener(sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION, listener, false);
|
||||||
document.addEventListener(sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION, listener, false);
|
document.addEventListener(sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION, listener, false);
|
||||||
document.addEventListener('unload', listener, false);
|
document.addEventListener('unload', listener, false);
|
||||||
tabbarToolboxes.forEach(function(aToolbox) {
|
for (let [, toolbox] in Iterator(tabbarToolboxes))
|
||||||
if (!aToolbox.firstChild.hasChildNodes())
|
{
|
||||||
aToolbox.setAttribute('collapsed', true);
|
if (!toolbox.firstChild.hasChildNodes())
|
||||||
});
|
toolbox.setAttribute('collapsed', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,15 +523,13 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
{
|
{
|
||||||
var tabs = this.getTabsArray(this.mTabBrowser);
|
var tabs = this.getTabsArray(this.mTabBrowser);
|
||||||
var count = tabs.length;
|
var count = tabs.length;
|
||||||
tabs.forEach(
|
for (let [i, tab] in Iterator(tabs))
|
||||||
aStacked ?
|
{
|
||||||
function(aTab, aIndex) {
|
if (aStacked)
|
||||||
aTab.style.zIndex = count * 1000 - aIndex;
|
tab.style.zIndex = count * 1000 - index;
|
||||||
} :
|
else
|
||||||
function(aTab, aIndex) {
|
tab.style.zIndex = '';
|
||||||
aTab.style.zIndex = '';
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
fixTooNarrowTabbar : function TSTBrowser_fixTooNarrowTabbar()
|
fixTooNarrowTabbar : function TSTBrowser_fixTooNarrowTabbar()
|
||||||
@ -723,7 +721,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (!('MultipleTabService' in w)) {
|
if (!('MultipleTabService' in w)) {
|
||||||
w.setTimeout(function(aSelf, aTabBrowser, aPopup) {
|
w.setTimeout(function(aSelf, aTabBrowser, aPopup) {
|
||||||
let suffix = '-tabbrowser-'+(aTabBrowser.id || 'instance-'+parseInt(Math.random() * 65000));
|
let suffix = '-tabbrowser-'+(aTabBrowser.id || 'instance-'+parseInt(Math.random() * 65000));
|
||||||
[
|
for (let [, id] in Iterator([
|
||||||
aSelf.kMENUITEM_RELOADSUBTREE,
|
aSelf.kMENUITEM_RELOADSUBTREE,
|
||||||
aSelf.kMENUITEM_RELOADCHILDREN,
|
aSelf.kMENUITEM_RELOADCHILDREN,
|
||||||
aSelf.kMENUITEM_REMOVESUBTREE,
|
aSelf.kMENUITEM_REMOVESUBTREE,
|
||||||
@ -736,8 +734,9 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
aSelf.kMENUITEM_AUTOHIDE,
|
aSelf.kMENUITEM_AUTOHIDE,
|
||||||
aSelf.kMENUITEM_FIXED,
|
aSelf.kMENUITEM_FIXED,
|
||||||
aSelf.kMENUITEM_BOOKMARKSUBTREE
|
aSelf.kMENUITEM_BOOKMARKSUBTREE
|
||||||
].forEach(function(aID) {
|
]))
|
||||||
let item = d.getElementById(aID).cloneNode(true);
|
{
|
||||||
|
let item = d.getElementById(id).cloneNode(true);
|
||||||
item.setAttribute('id', item.getAttribute('id')+suffix);
|
item.setAttribute('id', item.getAttribute('id')+suffix);
|
||||||
|
|
||||||
let refNode = void(0);
|
let refNode = void(0);
|
||||||
@ -758,7 +757,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
aPopup.insertBefore(item, refNode || null);
|
aPopup.insertBefore(item, refNode || null);
|
||||||
});
|
}
|
||||||
tabContextMenu = null;
|
tabContextMenu = null;
|
||||||
}, 0, this, b, tabContextMenu);
|
}, 0, this, b, tabContextMenu);
|
||||||
}
|
}
|
||||||
@ -974,16 +973,15 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
namedNodes.counterAnchor = namedNodes.label;
|
namedNodes.counterAnchor = namedNodes.label;
|
||||||
|
|
||||||
var foundContainers = [];
|
var foundContainers = [];
|
||||||
var containers = [
|
for (let [, container] in Iterator([
|
||||||
namedNodes.twistyAnchor.parentNode,
|
namedNodes.twistyAnchor.parentNode,
|
||||||
namedNodes.label.parentNode,
|
namedNodes.label.parentNode,
|
||||||
namedNodes.counter.parentNode,
|
namedNodes.counter.parentNode,
|
||||||
namedNodes.closeAnchor.parentNode
|
namedNodes.closeAnchor.parentNode
|
||||||
];
|
]))
|
||||||
for (let [, container] in Iterator(containers))
|
|
||||||
{
|
{
|
||||||
if (foundContainers.indexOf(container) > -1)
|
if (foundContainers.indexOf(container) > -1)
|
||||||
return;
|
continue;
|
||||||
this.initTabContentsOrderInternal(container, namedNodes, aForce);
|
this.initTabContentsOrderInternal(container, namedNodes, aForce);
|
||||||
foundContainers.push(container);
|
foundContainers.push(container);
|
||||||
}
|
}
|
||||||
@ -1070,9 +1068,10 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
(typeof aTarget == 'object' && 'length' in aTarget) ?
|
(typeof aTarget == 'object' && 'length' in aTarget) ?
|
||||||
Array.slice(aTarget) :
|
Array.slice(aTarget) :
|
||||||
self.getAllTabsArray(b);
|
self.getAllTabsArray(b);
|
||||||
tabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(tabs))
|
||||||
this.initTabContentsOrder(aTab);
|
{
|
||||||
}, self);
|
this.initTabContentsOrder(tab);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1186,13 +1185,14 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
b.mPanelContainer.removeAttribute('height');
|
b.mPanelContainer.removeAttribute('height');
|
||||||
|
|
||||||
if (strip.localName == 'toolbar') {
|
if (strip.localName == 'toolbar') {
|
||||||
Array.forEach(strip.childNodes, function(aNode) {
|
for (let [, node] in Iterator(strip.childNodes))
|
||||||
if (aNode.localName == 'tabs')
|
{
|
||||||
return;
|
if (node.localName == 'tabs')
|
||||||
if (aNode.hasAttribute('flex'))
|
continue;
|
||||||
aNode.setAttribute('treestyletab-backup-flex', aNode.getAttribute('flex'));
|
if (node.hasAttribute('flex'))
|
||||||
aNode.removeAttribute('flex');
|
node.setAttribute('treestyletab-backup-flex', node.getAttribute('flex'));
|
||||||
}, this);
|
node.removeAttribute('flex');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos == this.kTABBAR_RIGHT) {
|
if (pos == this.kTABBAR_RIGHT) {
|
||||||
@ -1265,15 +1265,16 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.removeTabbrowserAttribute(this.kTAB_INVERTED);
|
this.removeTabbrowserAttribute(this.kTAB_INVERTED);
|
||||||
|
|
||||||
if (strip.localName == 'toolbar') {
|
if (strip.localName == 'toolbar') {
|
||||||
Array.forEach(strip.childNodes, function(aNode) {
|
for (let [, node] in Iterator(strip.childNodes))
|
||||||
if (aNode.localName == 'tabs')
|
{
|
||||||
return;
|
if (node.localName == 'tabs')
|
||||||
var flex = aNode.hasAttribute('treestyletab-backup-flex');
|
continue;
|
||||||
|
let flex = node.hasAttribute('treestyletab-backup-flex');
|
||||||
if (!flex)
|
if (!flex)
|
||||||
return;
|
continue;
|
||||||
aNode.setAttribute('flex', flex);
|
node.setAttribute('flex', flex);
|
||||||
aNode.removeAttribute('treestyletab-backup-flex');
|
node.removeAttribute('treestyletab-backup-flex');
|
||||||
}, this);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos == this.kTABBAR_BOTTOM) {
|
if (pos == this.kTABBAR_BOTTOM) {
|
||||||
@ -1299,18 +1300,20 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var tabs = this.getAllTabsArray(b);
|
var tabs = this.getAllTabsArray(b);
|
||||||
tabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(tabs))
|
||||||
aTab.style.removeProperty(this.indentCSSProp);
|
{
|
||||||
aTab.style.removeProperty(this.collapseCSSProp);
|
tab.style.removeProperty(this.indentCSSProp);
|
||||||
}, this);
|
tab.style.removeProperty(this.collapseCSSProp);
|
||||||
|
}
|
||||||
|
|
||||||
this.indentProp = this.getTreePref('indent.property');
|
this.indentProp = this.getTreePref('indent.property');
|
||||||
this.indentCSSProp = this.indentProp+'-'+this.indentTarget;
|
this.indentCSSProp = this.indentProp+'-'+this.indentTarget;
|
||||||
this.collapseCSSProp = 'margin-'+this.collapseTarget;
|
this.collapseCSSProp = 'margin-'+this.collapseTarget;
|
||||||
|
|
||||||
tabs.forEach(function(aTab) {
|
for (let [i, tab] in Iterator(tabs))
|
||||||
this.updateTabCollapsed(aTab, aTab.getAttribute(this.kCOLLAPSED) == 'true', true);
|
{
|
||||||
}, this);
|
this.updateTabCollapsed(tab, tab.getAttribute(this.kCOLLAPSED) == 'true', true);
|
||||||
|
}
|
||||||
|
|
||||||
// for updateTabbarOverflow(), we should reset the "overflow" now.
|
// for updateTabbarOverflow(), we should reset the "overflow" now.
|
||||||
b.mTabContainer.removeAttribute('overflow');
|
b.mTabContainer.removeAttribute('overflow');
|
||||||
@ -1800,13 +1803,13 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
reinitAllTabs : function TSTBrowser_reinitAllTabs(aSouldUpdateCount)
|
reinitAllTabs : function TSTBrowser_reinitAllTabs(aSouldUpdateCount)
|
||||||
{
|
{
|
||||||
var tabs = this.getAllTabsArray(this.mTabBrowser);
|
for (let [, tab] in Iterator(this.getAllTabsArray(this.mTabBrowser)))
|
||||||
tabs.forEach(function(aTab) {
|
{
|
||||||
this.initTabAttributes(aTab);
|
this.initTabAttributes(tab);
|
||||||
this.initTabContents(aTab);
|
this.initTabContents(tab);
|
||||||
if (aSouldUpdateCount)
|
if (aSouldUpdateCount)
|
||||||
this.updateTabsCount(aTab);
|
this.updateTabsCount(tab);
|
||||||
}, this);
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy : function TSTBrowser_destroy()
|
destroy : function TSTBrowser_destroy()
|
||||||
@ -1832,11 +1835,12 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
var b = this.mTabBrowser;
|
var b = this.mTabBrowser;
|
||||||
delete b.tabContainer.treeStyleTab;
|
delete b.tabContainer.treeStyleTab;
|
||||||
|
|
||||||
this.getAllTabsArray(b).forEach(function(aTab) {
|
for (let [, tab] in Iterator(this.getAllTabsArray(b)))
|
||||||
this.stopTabIndentAnimation(aTab);
|
{
|
||||||
this.stopTabCollapseAnimation(aTab);
|
this.stopTabIndentAnimation(tab);
|
||||||
this.destroyTab(aTab);
|
this.stopTabCollapseAnimation(tab);
|
||||||
}, this);
|
this.destroyTab(tab);
|
||||||
|
}
|
||||||
|
|
||||||
this._endListenTabbarEvents();
|
this._endListenTabbarEvents();
|
||||||
|
|
||||||
@ -2002,9 +2006,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.ownerToolbar.classList.add(this.kTABBAR_TOOLBAR);
|
this.ownerToolbar.classList.add(this.kTABBAR_TOOLBAR);
|
||||||
this.ownerToolbar.classList.remove(this.kTABBAR_TOOLBAR_READY);
|
this.ownerToolbar.classList.remove(this.kTABBAR_TOOLBAR_READY);
|
||||||
Array.slice(this.document.querySelectorAll('.'+this.kTABBAR_TOOLBAR_READY_POPUP))
|
Array.slice(this.document.querySelectorAll('.'+this.kTABBAR_TOOLBAR_READY_POPUP))
|
||||||
.forEach(function(aPanel) {
|
.forEach(this.safeRemovePopup, this);
|
||||||
this.safeRemovePopup(aPanel);
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
var position = this._lastTabbarPositionBeforeDestroyed || this.position;
|
var position = this._lastTabbarPositionBeforeDestroyed || this.position;
|
||||||
delete this._lastTabbarPositionBeforeDestroyed;
|
delete this._lastTabbarPositionBeforeDestroyed;
|
||||||
@ -2146,22 +2148,25 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
case 'extensions.treestyletab.tabbar.multirow':
|
case 'extensions.treestyletab.tabbar.multirow':
|
||||||
this.initTabbar();
|
this.initTabbar();
|
||||||
this.updateAllTabsIndent();
|
this.updateAllTabsIndent();
|
||||||
tabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(tabs))
|
||||||
this.initTabContents(aTab);
|
{
|
||||||
}, this);
|
this.initTabContents(tab);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case 'extensions.treestyletab.tabbar.invertTabContents':
|
case 'extensions.treestyletab.tabbar.invertTabContents':
|
||||||
this.setTabbrowserAttribute(this.kTAB_CONTENTS_INVERTED, value);
|
this.setTabbrowserAttribute(this.kTAB_CONTENTS_INVERTED, value);
|
||||||
tabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(tabs))
|
||||||
this.initTabContents(aTab);
|
{
|
||||||
}, this);
|
this.initTabContents(tab);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 'extensions.treestyletab.tabbar.invertClosebox':
|
case 'extensions.treestyletab.tabbar.invertClosebox':
|
||||||
this.setTabbrowserAttribute(this.kCLOSEBOX_INVERTED, value);
|
this.setTabbrowserAttribute(this.kCLOSEBOX_INVERTED, value);
|
||||||
tabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(tabs))
|
||||||
this.initTabContents(aTab);
|
{
|
||||||
}, this);
|
this.initTabContents(tab);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 'extensions.treestyletab.tabbar.style':
|
case 'extensions.treestyletab.tabbar.style':
|
||||||
@ -2707,9 +2712,10 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
this.markAsClosedSet([tab].concat(tabs));
|
this.markAsClosedSet([tab].concat(tabs));
|
||||||
|
|
||||||
tabs.reverse().forEach(function(aTab) {
|
for (let [, tab] in Iterator(tabs.reverse()))
|
||||||
b.removeTab(aTab, { animate : true });
|
{
|
||||||
}, this);
|
b.removeTab(tab, { animate : true });
|
||||||
|
}
|
||||||
|
|
||||||
this.fireTabSubtreeClosedEvent(b, tab, tabs);
|
this.fireTabSubtreeClosedEvent(b, tab, tabs);
|
||||||
|
|
||||||
@ -2862,9 +2868,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
var parent = this.getParentTab(aTab);
|
var parent = this.getParentTab(aTab);
|
||||||
var siblings = this.getSiblingTabs(aTab);
|
var siblings = this.getSiblingTabs(aTab);
|
||||||
var groupTabs = siblings.filter(function(aTab) {
|
var groupTabs = siblings.filter(this.isGroupTab, this);
|
||||||
return this.isGroupTab(aTab);
|
|
||||||
}, this);
|
|
||||||
var groupTab = (
|
var groupTab = (
|
||||||
groupTabs.length == 1 &&
|
groupTabs.length == 1 &&
|
||||||
siblings.length == 1 &&
|
siblings.length == 1 &&
|
||||||
@ -2893,15 +2897,14 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
}, this))
|
}, this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
trees.forEach(function(aTabs) {
|
trees.forEach(this.markAsClosedSet, this);
|
||||||
this.markAsClosedSet(aTabs);
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.Deferred.next(function() {
|
this.Deferred.next(function() {
|
||||||
trees.forEach(function(aTabs) {
|
for (let [, tabs] in Iterator(trees))
|
||||||
self.fireTabSubtreeClosedEvent(b, aTabs[0], aTabs);
|
{
|
||||||
});
|
self.fireTabSubtreeClosedEvent(b, tabs[0], tabs);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -3113,7 +3116,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// restore tree from bottom safely
|
// restore tree from bottom safely
|
||||||
tabs.filter(function(aChanged) {
|
var restoreTabs = tabs.filter(function(aChanged) {
|
||||||
return aChanged.type == 'TabShow' &&
|
return aChanged.type == 'TabShow' &&
|
||||||
aChanged.tab.__treestyletab__restoreState == aSelf.RESTORE_STATE_READY_TO_RESTORE;
|
aChanged.tab.__treestyletab__restoreState == aSelf.RESTORE_STATE_READY_TO_RESTORE;
|
||||||
})
|
})
|
||||||
@ -3123,11 +3126,12 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
.sort(function(aA, aB) {
|
.sort(function(aA, aB) {
|
||||||
return aB._tPos - aA._tPos;
|
return aB._tPos - aA._tPos;
|
||||||
})
|
})
|
||||||
.filter(aSelf.restoreOneTab, aSelf)
|
.filter(aSelf.restoreOneTab, aSelf);
|
||||||
.forEach(function(aTab) {
|
for (let [, tab] in Iterator(restoreTabs))
|
||||||
aSelf.updateInsertionPositionInfo(aTab);
|
{
|
||||||
delete aTab.__treestyletab__restoreState;
|
aSelf.updateInsertionPositionInfo(tab);
|
||||||
}, aSelf);
|
delete tab.__treestyletab__restoreState;
|
||||||
|
}
|
||||||
|
|
||||||
var currentGroupId = aSelf.getTabViewGroupId();
|
var currentGroupId = aSelf.getTabViewGroupId();
|
||||||
if (aSelf.lastTabViewGroup && currentGroupId != aSelf.lastTabViewGroup) {
|
if (aSelf.lastTabViewGroup && currentGroupId != aSelf.lastTabViewGroup) {
|
||||||
@ -3183,7 +3187,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
var lastIndex = allTabs.length - 1;
|
var lastIndex = allTabs.length - 1;
|
||||||
var lastMovedTab;
|
var lastMovedTab;
|
||||||
normalTabs = normalTabs.slice(0).reverse();
|
normalTabs = normalTabs.slice(0).reverse();
|
||||||
for each (let tab in normalTabs)
|
for (let [, tab] in Iterator(normalTabs))
|
||||||
{
|
{
|
||||||
let parent = this.getParentTab(tab);
|
let parent = this.getParentTab(tab);
|
||||||
let attached = false;
|
let attached = false;
|
||||||
@ -3251,10 +3255,11 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.detachTab(aParent);
|
this.detachTab(aParent);
|
||||||
b.moveTabTo(aParent, lastCount);
|
b.moveTabTo(aParent, lastCount);
|
||||||
var descendantTabs = this.getDescendantTabs(aParent);
|
var descendantTabs = this.getDescendantTabs(aParent);
|
||||||
descendantTabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(descendantTabs))
|
||||||
w.TabView.moveTabTo(aTab, id);
|
{
|
||||||
b.moveTabTo(aTab, lastCount);
|
w.TabView.moveTabTo(tab, id);
|
||||||
});
|
b.moveTabTo(tab, lastCount);
|
||||||
|
}
|
||||||
this.internallyTabMovingCount--;
|
this.internallyTabMovingCount--;
|
||||||
this.tabViewTreeIsMoving = false;
|
this.tabViewTreeIsMoving = false;
|
||||||
},
|
},
|
||||||
@ -3446,14 +3451,15 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
* For failsafe, we must override actual attributes by stored
|
* For failsafe, we must override actual attributes by stored
|
||||||
* values.
|
* values.
|
||||||
*/
|
*/
|
||||||
[
|
for (let [, key] in Iterator([
|
||||||
this.kINSERT_BEFORE,
|
this.kINSERT_BEFORE,
|
||||||
this.kINSERT_AFTER
|
this.kINSERT_AFTER
|
||||||
].forEach(function(aKey) {
|
]))
|
||||||
var tab = this.getTabValue(aTab, aKey);
|
{
|
||||||
|
let tab = this.getTabValue(aTab, key);
|
||||||
if (this.getTabById(tab))
|
if (this.getTabById(tab))
|
||||||
this.setTabValue(aTab, aKey, tab);
|
this.setTabValue(aTab, aKey, tab);
|
||||||
}, this);
|
}
|
||||||
|
|
||||||
let parentId = this.getTabValue(aTab, this.kPARENT);
|
let parentId = this.getTabValue(aTab, this.kPARENT);
|
||||||
let parentTab = this.getTabById(parentId);
|
let parentTab = this.getTabById(parentId);
|
||||||
@ -3508,15 +3514,16 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
return this.redirectId(aChild);
|
return this.redirectId(aChild);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
aChildrenList.forEach(function(aChildTab) {
|
for (let [, childTab] in Iterator(aChildrenList))
|
||||||
if (aChildTab && (aChildTab = this.getTabById(aChildTab))) {
|
{
|
||||||
|
if (childTab && (childTab = this.getTabById(childTab))) {
|
||||||
let options = aOptions;
|
let options = aOptions;
|
||||||
if (options && typeof options == 'function')
|
if (options && typeof options == 'function')
|
||||||
options = options(aChildTab);
|
options = options(childTab);
|
||||||
this.attachTabTo(aChildTab, aTab, options);
|
this.attachTabTo(childTab, aTab, options);
|
||||||
childTabs.push(aChildTab);
|
childTabs.push(childTab);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, this);
|
|
||||||
aChildrenList = aChildrenList.join('|');
|
aChildrenList = aChildrenList.join('|');
|
||||||
if (aTab.getAttribute(this.kCHILDREN) == aChildrenList)
|
if (aTab.getAttribute(this.kCHILDREN) == aChildrenList)
|
||||||
aTab.removeAttribute(this.kCHILDREN_RESTORING);
|
aTab.removeAttribute(this.kCHILDREN_RESTORING);
|
||||||
@ -3639,23 +3646,24 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
var children = aTab.getAttribute(this.kCHILDREN);
|
var children = aTab.getAttribute(this.kCHILDREN);
|
||||||
if (restoringChildren != children) {
|
if (restoringChildren != children) {
|
||||||
var restoringChildrenIDs = restoringChildren.split('|');
|
var restoringChildrenIDs = restoringChildren.split('|');
|
||||||
restoringChildrenIDs.reverse().forEach(function(aChild, aIndex) {
|
for (let [i, child] in Iterator(restoringChildrenIDs.reverse()))
|
||||||
aChild = this.getTabById(aChild);
|
{
|
||||||
if (!aChild) return;
|
child = this.getTabById(child);
|
||||||
|
if (!child) continue;
|
||||||
|
|
||||||
let nextTab = aIndex > 0 ?
|
let nextTab = i > 0 ?
|
||||||
this.getTabById(restoringChildrenIDs[aIndex-1]) :
|
this.getTabById(restoringChildrenIDs[i-1]) :
|
||||||
this.getNextSiblingTab(aTab) ;
|
this.getNextSiblingTab(aTab) ;
|
||||||
if (nextTab == this.getNextSiblingTab(aChild)) return;
|
if (nextTab == this.getNextSiblingTab(child)) continue;
|
||||||
|
|
||||||
let newPos = -1;
|
let newPos = -1;
|
||||||
if (nextTab) {
|
if (nextTab) {
|
||||||
newPos = nextTab._tPos;
|
newPos = nextTab._tPos;
|
||||||
if (newPos > aChild._tPos) newPos--;
|
if (newPos > child._tPos) newPos--;
|
||||||
}
|
}
|
||||||
if (newPos > -1)
|
if (newPos > -1)
|
||||||
this.moveTabSubtreeTo(aChild, newPos);
|
this.moveTabSubtreeTo(child, newPos);
|
||||||
}, this);
|
}
|
||||||
children = aTab.getAttribute(this.kCHILDREN);
|
children = aTab.getAttribute(this.kCHILDREN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3697,14 +3705,14 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var items = this.evalInSandbox('('+this.SessionStore.getClosedTabData(this.window)+')');
|
|
||||||
var indexes = [];
|
var indexes = [];
|
||||||
items.forEach(function(aItem, aIndex) {
|
for (let [i, item] in Iterator(this.evalInSandbox('('+this.SessionStore.getClosedTabData(this.window)+')')))
|
||||||
if (aItem.state.extData &&
|
{
|
||||||
aItem.state.extData[this.kCLOSED_SET_ID] &&
|
if (item.state.extData &&
|
||||||
aItem.state.extData[this.kCLOSED_SET_ID] == aId)
|
item.state.extData[this.kCLOSED_SET_ID] &&
|
||||||
indexes.push(aIndex);
|
item.state.extData[this.kCLOSED_SET_ID] == aId)
|
||||||
}, this);
|
indexes.push(i);
|
||||||
|
}
|
||||||
|
|
||||||
var count = parseInt(aId.split('::')[1]);
|
var count = parseInt(aId.split('::')[1]);
|
||||||
|
|
||||||
@ -3744,9 +3752,10 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.windowService.restoringTree = true;
|
this.windowService.restoringTree = true;
|
||||||
|
|
||||||
var offset = 0;
|
var offset = 0;
|
||||||
aIndexes.forEach(function(aIndex) {
|
for (let [, index] in Iterator(aIndexes))
|
||||||
this.window.undoCloseTab(aIndex - (offset++));
|
{
|
||||||
}, this);
|
this.window.undoCloseTab(index - (offset++));
|
||||||
|
}
|
||||||
|
|
||||||
this.window.setTimeout(function(aSelf, aNextFocused) {
|
this.window.setTimeout(function(aSelf, aNextFocused) {
|
||||||
aSelf.windowService.restoringTree = false;
|
aSelf.windowService.restoringTree = false;
|
||||||
@ -3780,10 +3789,11 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
*/
|
*/
|
||||||
let b = this.browser;
|
let b = this.browser;
|
||||||
this.internallyTabMovingCount++;
|
this.internallyTabMovingCount++;
|
||||||
this.getDescendantTabs(aTab).reverse().forEach(function(aChildTab) {
|
for (let [, childTab] in Iterator(this.getDescendantTabs(aTab).reverse()))
|
||||||
if (aChildTab.__treestyletab__previousPosition > aChildTab._tPos)
|
{
|
||||||
b.moveTabTo(aChildTab, aChildTab.__treestyletab__previousPosition);
|
if (childTab.__treestyletab__previousPosition > childTab._tPos)
|
||||||
}, this);
|
b.moveTabTo(childTab, childTab.__treestyletab__previousPosition);
|
||||||
|
}
|
||||||
this.internallyTabMovingCount--;
|
this.internallyTabMovingCount--;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -3794,10 +3804,11 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
*/
|
*/
|
||||||
let b = this.browser;
|
let b = this.browser;
|
||||||
this.internallyTabMovingCount++;
|
this.internallyTabMovingCount++;
|
||||||
this.getChildTabs(aTab).reverse().forEach(function(aChildTab) {
|
for (let [, childTab] in Iterator(this.getChildTabs(aTab).reverse()))
|
||||||
if (aChildTab._tPos < parentTab._tPos)
|
{
|
||||||
b.moveTabTo(aChildTab, parentTab._tPos);
|
if (childTab._tPos < parentTab._tPos)
|
||||||
}, this);
|
b.moveTabTo(childTab, parentTab._tPos);
|
||||||
|
}
|
||||||
this.internallyTabMovingCount--;
|
this.internallyTabMovingCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4182,7 +4193,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
var b = this.mTabBrowser;
|
var b = this.mTabBrowser;
|
||||||
var sep, items = {};
|
var sep, items = {};
|
||||||
|
|
||||||
[
|
for (let [, id] in Iterator([
|
||||||
this.kMENUITEM_RELOADSUBTREE,
|
this.kMENUITEM_RELOADSUBTREE,
|
||||||
this.kMENUITEM_RELOADCHILDREN,
|
this.kMENUITEM_RELOADCHILDREN,
|
||||||
this.kMENUITEM_REMOVESUBTREE,
|
this.kMENUITEM_REMOVESUBTREE,
|
||||||
@ -4193,19 +4204,20 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.kMENUITEM_AUTOHIDE,
|
this.kMENUITEM_AUTOHIDE,
|
||||||
this.kMENUITEM_FIXED,
|
this.kMENUITEM_FIXED,
|
||||||
this.kMENUITEM_BOOKMARKSUBTREE
|
this.kMENUITEM_BOOKMARKSUBTREE
|
||||||
].forEach(function(aID) {
|
]))
|
||||||
|
{
|
||||||
let item = this.evaluateXPath(
|
let item = this.evaluateXPath(
|
||||||
'descendant::xul:*[starts-with(@id, "'+aID+'")]',
|
'descendant::xul:*[starts-with(@id, "'+id+'")]',
|
||||||
aEvent.currentTarget,
|
aEvent.currentTarget,
|
||||||
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE
|
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE
|
||||||
).singleNodeValue;
|
).singleNodeValue;
|
||||||
if (!item) return;
|
if (!item) continue;
|
||||||
items[aID] = item;
|
items[id] = item;
|
||||||
if (this.getTreePref('show.'+aID))
|
if (this.getTreePref('show.'+id))
|
||||||
item.removeAttribute('hidden');
|
item.removeAttribute('hidden');
|
||||||
else
|
else
|
||||||
item.setAttribute('hidden', true);
|
item.setAttribute('hidden', true);
|
||||||
switch (aID)
|
switch (id)
|
||||||
{
|
{
|
||||||
case this.kMENUITEM_RELOADSUBTREE:
|
case this.kMENUITEM_RELOADSUBTREE:
|
||||||
case this.kMENUITEM_RELOADCHILDREN:
|
case this.kMENUITEM_RELOADCHILDREN:
|
||||||
@ -4216,11 +4228,11 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
case this.kMENUITEM_EXPAND:
|
case this.kMENUITEM_EXPAND:
|
||||||
case this.kMENUITEM_BOOKMARKSUBTREE:
|
case this.kMENUITEM_BOOKMARKSUBTREE:
|
||||||
this.showHideSubtreeMenuItem(item, [b.mContextTab]);
|
this.showHideSubtreeMenuItem(item, [b.mContextTab]);
|
||||||
break;
|
continue;
|
||||||
default:
|
default:
|
||||||
break;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, this);
|
|
||||||
|
|
||||||
// collapse/expand all
|
// collapse/expand all
|
||||||
sep = this.evaluateXPath(
|
sep = this.evaluateXPath(
|
||||||
@ -4391,9 +4403,10 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
resetAllTabs : function TSTBrowser_resetAllTabs(aDetachAllChildren)
|
resetAllTabs : function TSTBrowser_resetAllTabs(aDetachAllChildren)
|
||||||
{
|
{
|
||||||
this.getAllTabsArray(this.mTabBrowser).forEach(function(aTab) {
|
for (let [, tab] in Iterator(this.getAllTabsArray(this.mTabBrowser)))
|
||||||
this.resetTab(aTab, aDetachAllChildren);
|
{
|
||||||
}, this);
|
this.resetTab(tab, aDetachAllChildren);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
resetTabbarSize : function TSTBrowser_resetTabbarSize()
|
resetTabbarSize : function TSTBrowser_resetTabbarSize()
|
||||||
@ -4427,24 +4440,26 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.allowSubtreeCollapseExpand = true;
|
this.allowSubtreeCollapseExpand = true;
|
||||||
delete this._lastAllowSubtreeCollapseExpand;
|
delete this._lastAllowSubtreeCollapseExpand;
|
||||||
|
|
||||||
this.getAllTabsArray(this.browser).forEach(function(aTab) {
|
for (let [, tab] in Iterator(this.getAllTabsArray(this.browser)))
|
||||||
if (aTab._TSTLastSubtreeCollapsed)
|
{
|
||||||
this.collapseExpandSubtree(aTab, true, true);
|
if (tab._TSTLastSubtreeCollapsed)
|
||||||
if (aTab._TSTLastSubtreeExpandedManually)
|
this.collapseExpandSubtree(tab, true, true);
|
||||||
this.setTabValue(aTab, this.kSUBTREE_EXPANDED_MANUALLY, true);
|
if (tab._TSTLastSubtreeExpandedManually)
|
||||||
delete aTab._TSTLastSubtreeCollapsed;
|
this.setTabValue(tab, this.kSUBTREE_EXPANDED_MANUALLY, true);
|
||||||
delete aTab._TSTLastSubtreeExpandedManually;
|
delete tab._TSTLastSubtreeCollapsed;
|
||||||
this.updateTabIndent(aTab, 0, true);
|
delete tab._TSTLastSubtreeExpandedManually;
|
||||||
}, this);
|
this.updateTabIndent(tab, 0, true);
|
||||||
|
}
|
||||||
this.updateTabsIndent(this.rootTabs, undefined, true);
|
this.updateTabsIndent(this.rootTabs, undefined, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.getAllTabsArray(this.browser).forEach(function(aTab) {
|
for (let [, tab] in Iterator(this.getAllTabsArray(this.browser)))
|
||||||
this.updateTabIndent(aTab, 0, true);
|
{
|
||||||
aTab._TSTLastSubtreeCollapsed = this.isSubtreeCollapsed(aTab);
|
this.updateTabIndent(tab, 0, true);
|
||||||
aTab._TSTLastSubtreeExpandedManually = this.getTabValue(aTab, this.kSUBTREE_EXPANDED_MANUALLY) == 'true';
|
tab._TSTLastSubtreeCollapsed = this.isSubtreeCollapsed(tab);
|
||||||
this.collapseExpandSubtree(aTab, false, true);
|
tab._TSTLastSubtreeExpandedManually = this.getTabValue(tab, this.kSUBTREE_EXPANDED_MANUALLY) == 'true';
|
||||||
}, this);
|
this.collapseExpandSubtree(tab, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
this._lastAllowSubtreeCollapseExpand = this.allowSubtreeCollapseExpand;
|
this._lastAllowSubtreeCollapseExpand = this.allowSubtreeCollapseExpand;
|
||||||
this.allowSubtreeCollapseExpand = false;
|
this.allowSubtreeCollapseExpand = false;
|
||||||
@ -4700,47 +4715,44 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
!this.getTreePref('closeParentBehavior.moveDetachedTabsToBottom')) {
|
!this.getTreePref('closeParentBehavior.moveDetachedTabsToBottom')) {
|
||||||
insertBefore = this.getNextSiblingTab(this.getRootTab(aTab));
|
insertBefore = this.getNextSiblingTab(this.getRootTab(aTab));
|
||||||
}
|
}
|
||||||
children.forEach((
|
for (let [i, tab] in Iterator(children))
|
||||||
aInfo.behavior == this.kCLOSE_PARENT_BEHAVIOR_DETACH_ALL_CHILDREN ?
|
{
|
||||||
function(aTab) {
|
if (aInfo.behavior == this.kCLOSE_PARENT_BEHAVIOR_DETACH_ALL_CHILDREN) {
|
||||||
this.detachTab(aTab, aInfo);
|
this.detachTab(tab, aInfo);
|
||||||
this.moveTabSubtreeTo(aTab, insertBefore ? insertBefore._tPos - 1 : this.getLastTab(b)._tPos );
|
this.moveTabSubtreeTo(tab, insertBefore ? insertBefore._tPos - 1 : this.getLastTab(b)._tPos );
|
||||||
} :
|
}
|
||||||
aInfo.behavior == this.kCLOSE_PARENT_BEHAVIOR_PROMOTE_FIRST_CHILD ?
|
else if (aInfo.behavior == this.kCLOSE_PARENT_BEHAVIOR_PROMOTE_FIRST_CHILD) {
|
||||||
function(aTab, aIndex) {
|
this.detachTab(tab, aInfo);
|
||||||
this.detachTab(aTab, aInfo);
|
if (i == 0) {
|
||||||
if (aIndex == 0) {
|
|
||||||
if (parentTab) {
|
if (parentTab) {
|
||||||
this.attachTabTo(aTab, parentTab, {
|
this.attachTabTo(tab, parentTab, {
|
||||||
__proto__ : aInfo,
|
__proto__ : aInfo,
|
||||||
dontExpand : true,
|
dontExpand : true,
|
||||||
dontMove : true
|
dontMove : true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.collapseExpandSubtree(aTab, false);
|
this.collapseExpandSubtree(tab, false);
|
||||||
this.deleteTabValue(aTab, this.kSUBTREE_COLLAPSED);
|
this.deleteTabValue(tab, this.kSUBTREE_COLLAPSED);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.attachTabTo(aTab, children[0], {
|
this.attachTabTo(tab, children[0], {
|
||||||
__proto__ : aInfo,
|
__proto__ : aInfo,
|
||||||
dontExpand : true,
|
dontExpand : true,
|
||||||
dontMove : true
|
dontMove : true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} :
|
}
|
||||||
aInfo.behavior == this.kCLOSE_PARENT_BEHAVIOR_PROMOTE_ALL_CHILDREN && parentTab ?
|
else if (aInfo.behavior == this.kCLOSE_PARENT_BEHAVIOR_PROMOTE_ALL_CHILDREN && parentTab) {
|
||||||
function(aTab) {
|
this.attachTabTo(tab, parentTab, {
|
||||||
this.attachTabTo(aTab, parentTab, {
|
|
||||||
__proto__ : aInfo,
|
__proto__ : aInfo,
|
||||||
dontExpand : true,
|
dontExpand : true,
|
||||||
dontMove : true
|
dontMove : true
|
||||||
});
|
});
|
||||||
} :
|
|
||||||
// aInfo.behavior == this.kCLOSE_PARENT_BEHAVIOR_SIMPLY_DETACH_ALL_CHILDREN ?
|
|
||||||
function(aTab) {
|
|
||||||
this.detachTab(aTab, aInfo);
|
|
||||||
}
|
}
|
||||||
), this);
|
else { // aInfo.behavior == this.kCLOSE_PARENT_BEHAVIOR_SIMPLY_DETACH_ALL_CHILDREN
|
||||||
|
this.detachTab(tab, aInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
partAllChildren : function TSTBrowser_partAllChildren(aTab, aInfo) /* for backward compatibility */
|
partAllChildren : function TSTBrowser_partAllChildren(aTab, aInfo) /* for backward compatibility */
|
||||||
{
|
{
|
||||||
@ -4749,8 +4761,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
detachTabs : function TSTBrowser_detachTabs(aTabs)
|
detachTabs : function TSTBrowser_detachTabs(aTabs)
|
||||||
{
|
{
|
||||||
var aTabs = Array.slice(aTabs);
|
for (let [, tab] in Iterator(aTabs))
|
||||||
for each (let tab in aTabs)
|
|
||||||
{
|
{
|
||||||
if (aTabs.indexOf(this.getParentTab(tab)) > -1)
|
if (aTabs.indexOf(this.getParentTab(tab)) > -1)
|
||||||
continue;
|
continue;
|
||||||
@ -4803,13 +4814,14 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
indent = Math.min(aLevel * 3, maxIndent);
|
indent = Math.min(aLevel * 3, maxIndent);
|
||||||
}
|
}
|
||||||
|
|
||||||
Array.slice(aTabs).forEach(function(aTab) {
|
for (let [, tab] in Iterator(aTabs))
|
||||||
if (!aTab.parentNode) return; // ignore removed tabs
|
{
|
||||||
this.updateTabIndent(aTab, indent, aJustNow);
|
if (!tab.parentNode) continue; // ignore removed tabs
|
||||||
aTab.setAttribute(this.kNEST, aLevel);
|
this.updateTabIndent(tab, indent, aJustNow);
|
||||||
this.updateCanCollapseSubtree(aTab, aLevel);
|
tab.setAttribute(this.kNEST, aLevel);
|
||||||
this.updateTabsIndent(this.getChildTabs(aTab), aLevel+1, aJustNow);
|
this.updateCanCollapseSubtree(tab, aLevel);
|
||||||
}, this);
|
this.updateTabsIndent(this.getChildTabs(tab), aLevel+1, aJustNow);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
updateTabsIndentWithDelay : function TSTBrowser_updateTabsIndentWithDelay(aTabs)
|
updateTabsIndentWithDelay : function TSTBrowser_updateTabsIndentWithDelay(aTabs)
|
||||||
{
|
{
|
||||||
@ -4819,9 +4831,10 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.updateTabsIndentWithDelayTabs = this.updateTabsIndentWithDelayTabs.concat(aTabs);
|
this.updateTabsIndentWithDelayTabs = this.updateTabsIndentWithDelayTabs.concat(aTabs);
|
||||||
this.updateTabsIndentWithDelayTimer = this.window.setTimeout(function(aSelf) {
|
this.updateTabsIndentWithDelayTimer = this.window.setTimeout(function(aSelf) {
|
||||||
var tabs = [];
|
var tabs = [];
|
||||||
aSelf.updateTabsIndentWithDelayTabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(aSelf.updateTabsIndentWithDelayTabs))
|
||||||
if (tabs.indexOf(aTab) < 0 && aTab.parentNode) tabs.push(aTab);
|
{
|
||||||
});
|
if (tabs.indexOf(tab) < 0 && tab.parentNode) tabs.push(tab);
|
||||||
|
}
|
||||||
aSelf.updateTabsIndentWithDelayTabs = [];
|
aSelf.updateTabsIndentWithDelayTabs = [];
|
||||||
aSelf.updateTabsIndent(tabs);
|
aSelf.updateTabsIndent(tabs);
|
||||||
aSelf.window.clearTimeout(aSelf.updateTabsIndentWithDelayTimer);
|
aSelf.window.clearTimeout(aSelf.updateTabsIndentWithDelayTimer);
|
||||||
@ -4851,15 +4864,16 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
retVal.push('ThreeDShadow');
|
retVal.push('ThreeDShadow');
|
||||||
return retVal.length == 1 ? 'none' : retVal.join(' ') ;
|
return retVal.length == 1 ? 'none' : retVal.join(' ') ;
|
||||||
})()+' !important;';
|
})()+' !important;';
|
||||||
Array.slice(this.document.getAnonymousNodes(aTab)).forEach(function(aBox) {
|
for (let [, box] in Iterator(this.document.getAnonymousNodes(aTab)))
|
||||||
if (aBox.nodeType != Node.ELEMENT_NODE) return;
|
{
|
||||||
aBox.setAttribute(
|
if (box.nodeType != Node.ELEMENT_NODE) continue;
|
||||||
|
box.setAttribute(
|
||||||
'style',
|
'style',
|
||||||
aBox.getAttribute('style').replace(/(-moz-)?border-(top|bottom)(-[^:]*)?.*:[^;]+;?/g, '') +
|
box.getAttribute('style')
|
||||||
|
.replace(/(-moz-)?border-(top|bottom)(-[^:]*)?.*:[^;]+;?/g, '') +
|
||||||
'; border-'+this.indentTarget+': solid transparent '+aIndent+'px !important;'+colors
|
'; border-'+this.indentTarget+': solid transparent '+aIndent+'px !important;'+colors
|
||||||
);
|
);
|
||||||
}, this);
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5035,9 +5049,10 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
updateAllTabsCount : function TSTBrowser_updateAllTabsCount()
|
updateAllTabsCount : function TSTBrowser_updateAllTabsCount()
|
||||||
{
|
{
|
||||||
this.rootTabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(this.rootTabs))
|
||||||
this.updateTabsCount(aTab, this);
|
{
|
||||||
}, this);
|
this.updateTabsCount(tab, this);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
promoteTooDeepLevelTabs : function TSTBrowser_promoteTooDeepLevelTabs(aParent)
|
promoteTooDeepLevelTabs : function TSTBrowser_promoteTooDeepLevelTabs(aParent)
|
||||||
@ -5045,25 +5060,25 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (this.maxTreeLevel < 0 || !this.maxTreeLevelPhisical)
|
if (this.maxTreeLevel < 0 || !this.maxTreeLevelPhisical)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var tabs = aParent ? this.getDescendantTabs(aParent) : this.getAllTabsArray(this.mTabBrowser) ;
|
for (let [, tab] in Iterator(aParent ? this.getDescendantTabs(aParent) : this.getAllTabsArray(this.mTabBrowser) ))
|
||||||
tabs.forEach(function(aTab) {
|
{
|
||||||
var level = parseInt(aTab.getAttribute(this.kNEST) || 0);
|
let level = parseInt(tab.getAttribute(this.kNEST) || 0);
|
||||||
if (level <= this.maxTreeLevel)
|
if (level <= this.maxTreeLevel)
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
var parent = this.getParentTab(aTab);
|
let parent = this.getParentTab(tab);
|
||||||
var newParent = this.getParentTab(parent);
|
let newParent = this.getParentTab(parent);
|
||||||
if (this.maxTreeLevel == 0 || !newParent) {
|
if (this.maxTreeLevel == 0 || !newParent) {
|
||||||
this.detachTab(aTab);
|
this.detachTab(aTab);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let nextSibling = this.getNextTab(aTab);
|
let nextSibling = this.getNextTab(tab);
|
||||||
this.attachTabTo(aTab, newParent, {
|
this.attachTabTo(tab, newParent, {
|
||||||
dontMove : true,
|
dontMove : true,
|
||||||
insertBefore : nextSibling
|
insertBefore : nextSibling
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, this);
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/* move */
|
/* move */
|
||||||
@ -5081,9 +5096,10 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
this.subTreeChildrenMovingCount++;
|
this.subTreeChildrenMovingCount++;
|
||||||
this.internallyTabMovingCount++;
|
this.internallyTabMovingCount++;
|
||||||
this.getDescendantTabs(aTab).forEach(function(aDescendantTab, aIndex) {
|
for (let [i, descendantTab] in Iterator(this.getDescendantTabs(aTab)))
|
||||||
b.moveTabTo(aDescendantTab, aTab._tPos + aIndex + (aTab._tPos < aDescendantTab._tPos ? 1 : 0 ));
|
{
|
||||||
}, this);
|
b.moveTabTo(descendantTab, aTab._tPos + i + (aTab._tPos < descendantTab._tPos ? 1 : 0 ));
|
||||||
|
}
|
||||||
this.internallyTabMovingCount--;
|
this.internallyTabMovingCount--;
|
||||||
this.subTreeChildrenMovingCount--;
|
this.subTreeChildrenMovingCount--;
|
||||||
|
|
||||||
@ -5294,16 +5310,17 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
var expandedTabs = this.getChildTabs(aTab);
|
var expandedTabs = this.getChildTabs(aTab);
|
||||||
var lastExpandedTabIndex = expandedTabs.length - 1;
|
var lastExpandedTabIndex = expandedTabs.length - 1;
|
||||||
expandedTabs.forEach(function(aChildTab, aIndex) {
|
for (let [i, childTab] in Iterator(expandedTabs))
|
||||||
if (!aCollapse && !aJustNow && aIndex == lastExpandedTabIndex) {
|
{
|
||||||
|
if (!aCollapse && !aJustNow && i == lastExpandedTabIndex) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this.collapseExpandTab(aChildTab, aCollapse, aJustNow, function() {
|
this.collapseExpandTab(childTab, aCollapse, aJustNow, function() {
|
||||||
self.scrollToTabSubtree(aTab);
|
self.scrollToTabSubtree(aTab);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.collapseExpandTab(aChildTab, aCollapse, aJustNow);
|
this.collapseExpandTab(childTab, aCollapse, aJustNow);
|
||||||
}, this);
|
}
|
||||||
|
|
||||||
if (aCollapse)
|
if (aCollapse)
|
||||||
this.deleteTabValue(aTab, this.kSUBTREE_EXPANDED_MANUALLY);
|
this.deleteTabValue(aTab, this.kSUBTREE_EXPANDED_MANUALLY);
|
||||||
@ -5347,9 +5364,10 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isSubtreeCollapsed(aTab)) {
|
if (!this.isSubtreeCollapsed(aTab)) {
|
||||||
this.getChildTabs(aTab).forEach(function(aTab) {
|
for (let [, tab] in Iterator(this.getChildTabs(aTab)))
|
||||||
this.collapseExpandTab(aTab, aCollapse, aJustNow);
|
{
|
||||||
}, this);
|
this.collapseExpandTab(tab, aCollapse, aJustNow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateTabCollapsed : function TSTBrowser_updateTabCollapsed(aTab, aCollapsed, aJustNow, aCallbackToRunOnStartAnimation)
|
updateTabCollapsed : function TSTBrowser_updateTabCollapsed(aTab, aCollapsed, aJustNow, aCallbackToRunOnStartAnimation)
|
||||||
@ -5861,22 +5879,23 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (tabs.length <= 1)
|
if (tabs.length <= 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(tabs))
|
||||||
var currentId = aTab.getAttribute(this.kID);
|
{
|
||||||
if (this.tabsHash[currentId] == aTab)
|
let currentId = tab.getAttribute(this.kID);
|
||||||
|
if (this.tabsHash[currentId] == tab)
|
||||||
delete this.tabsHash[currentId];
|
delete this.tabsHash[currentId];
|
||||||
|
|
||||||
this.resetTabState(aTab);
|
this.resetTabState(tab);
|
||||||
|
|
||||||
aTab.setAttribute(this.kID, currentId); // to fallback to it
|
tab.setAttribute(this.kID, currentId); // to fallback to it
|
||||||
var [id, duplicated] = this._restoreTabId(aTab);
|
let [id, duplicated] = this._restoreTabId(tab);
|
||||||
|
|
||||||
this.setTabValue(aTab, this.kID, id);
|
this.setTabValue(tab, this.kID, id);
|
||||||
this.tabsHash[id] = aTab;
|
this.tabsHash[id] = tab;
|
||||||
|
|
||||||
aTab.__treestyletab__restoreState = this.RESTORE_STATE_READY_TO_RESTORE;
|
tab.__treestyletab__restoreState = this.RESTORE_STATE_READY_TO_RESTORE;
|
||||||
aTab.__treestyletab__duplicated = duplicated;
|
tab.__treestyletab__duplicated = duplicated;
|
||||||
}, this);
|
}
|
||||||
|
|
||||||
this.updateAllTabsIndent(true);
|
this.updateAllTabsIndent(true);
|
||||||
|
|
||||||
|
@ -413,13 +413,14 @@ FullTooltipManager.prototype = {
|
|||||||
if (aExtraLabels) {
|
if (aExtraLabels) {
|
||||||
if (typeof aExtraLabels == 'string')
|
if (typeof aExtraLabels == 'string')
|
||||||
aExtraLabels = [aExtraLabels];
|
aExtraLabels = [aExtraLabels];
|
||||||
aExtraLabels.forEach(function(aLabel) {
|
for (let [, label] in Iterator(aExtraLabels))
|
||||||
aLabel = aLabel.replace(/^\s+|\s+$/g, '');
|
{
|
||||||
if (!aLabel)
|
label = label.replace(/^\s+|\s+$/g, '');
|
||||||
return;
|
if (!label)
|
||||||
|
continue;
|
||||||
root.appendChild(this.document.createElement('description'))
|
root.appendChild(this.document.createElement('description'))
|
||||||
.appendChild(this.document.createTextNode(aLabel));
|
.appendChild(this.document.createTextNode(label));
|
||||||
}, this);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
root.insertBefore(tree, root.firstChild && root.firstChild.nextSibling);
|
root.insertBefore(tree, root.firstChild && root.firstChild.nextSibling);
|
||||||
|
@ -127,9 +127,10 @@ var PseudoTreeBuilder = {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
var container = doc.createElement('vbox');
|
var container = doc.createElement('vbox');
|
||||||
children.forEach(function(aChild) {
|
for (let [, child] in Iterator(children))
|
||||||
container.appendChild(this.createTabItem(aChild));
|
{
|
||||||
}, this);
|
container.appendChild(this.createTabItem(child));
|
||||||
|
}
|
||||||
container.setAttribute('class', this.kTREECHILDREN);
|
container.setAttribute('class', this.kTREECHILDREN);
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
@ -414,10 +414,10 @@ catch(e) {
|
|||||||
var tabs = sv.getTabsArray(targetBrowser);
|
var tabs = sv.getTabsArray(targetBrowser);
|
||||||
|
|
||||||
var draggedWholeTree = [].concat(draggedRoots);
|
var draggedWholeTree = [].concat(draggedRoots);
|
||||||
for each (let root in draggedRoots)
|
for (let [, root] in Iterator(draggedRoots))
|
||||||
{
|
{
|
||||||
let tabs = sourceService.getDescendantTabs(root);
|
let tabs = sourceService.getDescendantTabs(root);
|
||||||
for each (let tab in tabs)
|
for (let [, tab] in Iterator(tabs))
|
||||||
{
|
{
|
||||||
if (draggedWholeTree.indexOf(tab) < 0)
|
if (draggedWholeTree.indexOf(tab) < 0)
|
||||||
draggedWholeTree.push(tab);
|
draggedWholeTree.push(tab);
|
||||||
@ -515,14 +515,15 @@ catch(e) {
|
|||||||
var sv = b.treeStyleTab;
|
var sv = b.treeStyleTab;
|
||||||
|
|
||||||
b.movingSelectedTabs = true; // Multiple Tab Handler
|
b.movingSelectedTabs = true; // Multiple Tab Handler
|
||||||
aTabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(aTabs))
|
||||||
if (!aTab.parentNode) return; // ignore removed tabs
|
{
|
||||||
|
if (!tab.parentNode) continue; // ignore removed tabs
|
||||||
if (aParent)
|
if (aParent)
|
||||||
sv.attachTabTo(aTab, aParent);
|
sv.attachTabTo(tab, aParent);
|
||||||
else
|
else
|
||||||
sv.detachTab(aTab);
|
sv.detachTab(tab);
|
||||||
sv.collapseExpandTab(aTab, false);
|
sv.collapseExpandTab(tab, false);
|
||||||
}, sv);
|
}
|
||||||
b.movingSelectedTabs = false; // Multiple Tab Handler
|
b.movingSelectedTabs = false; // Multiple Tab Handler
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -532,11 +533,12 @@ catch(e) {
|
|||||||
var sv = b.treeStyleTab;
|
var sv = b.treeStyleTab;
|
||||||
|
|
||||||
b.movingSelectedTabs = true; // Multiple Tab Handler
|
b.movingSelectedTabs = true; // Multiple Tab Handler
|
||||||
aTabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(aTabs))
|
||||||
if (!aTab.parentNode) return; // ignore removed tabs
|
{
|
||||||
sv.detachTab(aTab);
|
if (!tab.parentNode) continue; // ignore removed tabs
|
||||||
sv.collapseExpandTab(aTab, false);
|
sv.detachTab(tab);
|
||||||
}, sv);
|
sv.collapseExpandTab(tab, false);
|
||||||
|
}
|
||||||
b.movingSelectedTabs = false; // Multiple Tab Handler
|
b.movingSelectedTabs = false; // Multiple Tab Handler
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -861,9 +863,10 @@ catch(e) {
|
|||||||
var sv = this.treeStyleTab;
|
var sv = this.treeStyleTab;
|
||||||
if (this.mAutoExpandedTabs.length) {
|
if (this.mAutoExpandedTabs.length) {
|
||||||
if (sv.getTreePref('autoExpand.collapseFinally')) {
|
if (sv.getTreePref('autoExpand.collapseFinally')) {
|
||||||
this.mAutoExpandedTabs.forEach(function(aTarget) {
|
for (let [, target] in Iterator(this.mAutoExpandedTabs))
|
||||||
this.collapseExpandSubtree(this.getTabById(aTarget), true, true);
|
{
|
||||||
}, sv);
|
sv.collapseExpandSubtree(sv.getTabById(target), true, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.mAutoExpandedTabs = [];
|
this.mAutoExpandedTabs = [];
|
||||||
}
|
}
|
||||||
|
@ -53,10 +53,12 @@ TreeStyleTabThemeManager.prototype = {
|
|||||||
|
|
||||||
set : function(aStyle, aPosition)
|
set : function(aStyle, aPosition)
|
||||||
{
|
{
|
||||||
if (this._lastStyles)
|
if (this._lastStyles) {
|
||||||
this._lastStyles.forEach(function(aStyle) {
|
for (let [, style] in Iterator(this._lastStyles))
|
||||||
aStyle.parentNode.removeChild(aStyle);
|
{
|
||||||
});
|
style.parentNode.removeChild(style);
|
||||||
|
}
|
||||||
|
}
|
||||||
this._lastStyles = null;
|
this._lastStyles = null;
|
||||||
|
|
||||||
var styles = [];
|
var styles = [];
|
||||||
@ -128,13 +130,14 @@ TreeStyleTabThemeManager.prototype = {
|
|||||||
null ;
|
null ;
|
||||||
if (!images) return;
|
if (!images) return;
|
||||||
|
|
||||||
images.forEach(function(aImage) {
|
for (let [, image] in Iterator(images))
|
||||||
if (this._preLoadImagesForStyleDoneImages.indexOf(aImage) > -1)
|
{
|
||||||
return;
|
if (this._preLoadImagesForStyleDoneImages.indexOf(image) > -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
(new this.window.Image()).src = aImage;
|
(new this.window.Image()).src = image;
|
||||||
this._preLoadImagesForStyleDoneImages.push(aImage);
|
this._preLoadImagesForStyleDoneImages.push(image);
|
||||||
}, this);
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_preLoadImages : {
|
_preLoadImages : {
|
||||||
|
203
modules/utils.js
203
modules/utils.js
@ -394,16 +394,18 @@ var TreeStyleTabUtils = {
|
|||||||
{
|
{
|
||||||
var OS = this.XULAppInfo.OS;
|
var OS = this.XULAppInfo.OS;
|
||||||
var processed = {};
|
var processed = {};
|
||||||
this.getDescendant('extensions.treestyletab.platform.'+OS).forEach(function(aKey) {
|
for (let [, originalKey] in Iterator(this.getDescendant('extensions.treestyletab.platform.'+OS)))
|
||||||
var key = aKey.replace('platform.'+OS+'.', '');
|
{
|
||||||
this.setDefaultPref(key, this.getPref(aKey));
|
let key = originalKey.replace('platform.'+OS+'.', '');
|
||||||
|
this.setDefaultPref(key, this.getPref(originalKey));
|
||||||
processed[key] = true;
|
processed[key] = true;
|
||||||
}, this);
|
}
|
||||||
this.getDescendant('extensions.treestyletab.platform.default').forEach(function(aKey) {
|
for (let [, originalKey] in Iterator(this.getDescendant('extensions.treestyletab.platform.default')))
|
||||||
var key = aKey.replace('platform.default.', '');
|
{
|
||||||
|
let key = originalKey.replace('platform.default.', '');
|
||||||
if (!(key in processed))
|
if (!(key in processed))
|
||||||
this.setDefaultPref(key, this.getPref(aKey));
|
this.setDefaultPref(key, this.getPref(originalKey));
|
||||||
}, this);
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateAeroPeek : function TSTUtils_updateAeroPeek()
|
updateAeroPeek : function TSTUtils_updateAeroPeek()
|
||||||
@ -711,26 +713,27 @@ var TreeStyleTabUtils = {
|
|||||||
doAndWaitDOMEvent : function TSTUtils_doAndWaitDOMEvent()
|
doAndWaitDOMEvent : function TSTUtils_doAndWaitDOMEvent()
|
||||||
{
|
{
|
||||||
var type, target, delay, task;
|
var type, target, delay, task;
|
||||||
Array.slice(arguments).forEach(function(aArg) {
|
for (let [, arg] in Iterator(arguments))
|
||||||
switch(typeof aArg)
|
{
|
||||||
|
switch(typeof arg)
|
||||||
{
|
{
|
||||||
case 'string':
|
case 'string':
|
||||||
type = aArg;
|
type = arg;
|
||||||
break;
|
continue;
|
||||||
|
|
||||||
case 'number':
|
case 'number':
|
||||||
delay = aArg;
|
delay = arg;
|
||||||
break;
|
continue;
|
||||||
|
|
||||||
case 'function':
|
case 'function':
|
||||||
task = aArg;
|
task = arg;
|
||||||
break;
|
continue;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
target = aArg;
|
target = arg;
|
||||||
break;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
if (!target || !type) {
|
if (!target || !type) {
|
||||||
if (task) task();
|
if (task) task();
|
||||||
@ -862,61 +865,86 @@ var TreeStyleTabUtils = {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
var box = twisty.boxObject;
|
var box = twisty.boxObject;
|
||||||
var minX = box.screenX;
|
var left = box.screenX;
|
||||||
var minY = box.screenY;
|
var top = box.screenY;
|
||||||
var maxX = minX + box.width;
|
var right = left + box.width;
|
||||||
var maxY = minY + box.height;
|
var bottom = top + box.height;
|
||||||
|
var favicon = this.getFaviconRect(tab);
|
||||||
var icon = tab.ownerDocument.getAnonymousElementByAttribute(tab, 'class', 'tab-icon-image');
|
|
||||||
var iconBox = icon.boxObject;
|
|
||||||
var throbber = tab.ownerDocument.getAnonymousElementByAttribute(tab, 'class', 'tab-throbber');
|
|
||||||
var throbberBox = throbber.boxObject;
|
|
||||||
var extraMinX = Math.min(throbberBox.screenX, iconBox.screenX);
|
|
||||||
var extraMinY = Math.min(throbberBox.screenY, iconBox.screenY);
|
|
||||||
var extraMaxX = Math.max(throbberBox.screenX + throbberBox.width, iconBox.screenX + iconBox.width);
|
|
||||||
var extraMaxY = Math.max(throbberBox.screenY + throbberBox.height, iconBox.screenY + iconBox.height);
|
|
||||||
|
|
||||||
if (!box.width || !box.height) {
|
if (!box.width || !box.height) {
|
||||||
minX = extraMinX;
|
left = favicon.left;
|
||||||
minY = extraMinY;
|
top = favicon.top;
|
||||||
maxX = extraMaxX;
|
right = favicon.right;
|
||||||
maxY = extraMaxY;
|
bottom = favicon.bottom;
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
this.shouldExpandTwistyArea &&
|
this.shouldExpandTwistyArea &&
|
||||||
!this._expandTwistyAreaBlockers.length
|
!this._expandTwistyAreaBlockers.length
|
||||||
) {
|
) {
|
||||||
minX = Math.min(minX, extraMinX);
|
left = Math.min(left, favicon.left);
|
||||||
minY = Math.min(minY, extraMinY);
|
top = Math.min(top, favicon.top);
|
||||||
maxX = Math.max(maxX, extraMaxX);
|
right = Math.max(right, favicon.right);
|
||||||
maxY = Math.max(maxY, extraMaxY);
|
bottom = Math.max(bottom, favicon.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
var x = aEvent.screenX;
|
var x = aEvent.screenX;
|
||||||
var y = aEvent.screenY;
|
var y = aEvent.screenY;
|
||||||
return (x >= minX && x <= maxX && y >= minY && y <= maxY);
|
return (x >= left && x <= right && y >= top && y <= bottom);
|
||||||
|
},
|
||||||
|
getFaviconRect : function TSTUtils_getFaviconRect(aTab)
|
||||||
|
{
|
||||||
|
var icon = aTab.ownerDocument.getAnonymousElementByAttribute(aTab, 'class', 'tab-icon-image');
|
||||||
|
var iconBox = icon.boxObject;
|
||||||
|
var iconRect = {
|
||||||
|
left : iconBox.screenX,
|
||||||
|
top : iconBox.screenY,
|
||||||
|
right : iconBox.screenX + iconBox.width,
|
||||||
|
bottom : iconBox.screenY + iconBox.height
|
||||||
|
};
|
||||||
|
|
||||||
|
var throbber = aTab.ownerDocument.getAnonymousElementByAttribute(aTab, 'class', 'tab-throbber');
|
||||||
|
var throbberBox = throbber.boxObject;
|
||||||
|
var throbberRect = {
|
||||||
|
left : throbberBox.screenX,
|
||||||
|
top : throbberBox.screenY,
|
||||||
|
right : throbberBox.screenX + throbberBox.width,
|
||||||
|
bottom : throbberBox.screenY + throbberBox.height
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!iconBox.width && !iconBox.height)
|
||||||
|
return throbberRect;
|
||||||
|
|
||||||
|
if (!throbberBox.width && !throbberBox.height)
|
||||||
|
return iconRect;
|
||||||
|
|
||||||
|
return {
|
||||||
|
left : Math.min(throbberRect.left, iconRect.left),
|
||||||
|
right : Math.max(throbberRect.right, iconRect.right),
|
||||||
|
top : Math.min(throbberRect.top, iconRect.top),
|
||||||
|
bottom : Math.max(throbberRect.bottom, iconRect.bottom)
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
// called with target(nsIDOMEventTarget), document(nsIDOMDocument), type(string) and data(object)
|
// called with target(nsIDOMEventTarget), document(nsIDOMDocument), type(string) and data(object)
|
||||||
fireDataContainerEvent : function()
|
fireDataContainerEvent : function TSTUtils_fireDataContainerEvent()
|
||||||
{
|
{
|
||||||
var target, document, type, data, canBubble, cancellable;
|
var target, document, type, data, canBubble, cancellable;
|
||||||
Array.slice(arguments).forEach(function(aArg) {
|
for (let [, arg] in Iterator(arguments))
|
||||||
if (typeof aArg == 'boolean') {
|
{
|
||||||
|
if (typeof arg == 'boolean') {
|
||||||
if (canBubble === void(0))
|
if (canBubble === void(0))
|
||||||
canBubble = aArg;
|
canBubble = arg;
|
||||||
else
|
else
|
||||||
cancellable = aArg;
|
cancellable = arg;
|
||||||
}
|
}
|
||||||
else if (typeof aArg == 'string')
|
else if (typeof arg == 'string')
|
||||||
type = aArg;
|
type = arg;
|
||||||
else if (aArg instanceof Ci.nsIDOMDocument)
|
else if (arg instanceof Ci.nsIDOMDocument)
|
||||||
document = aArg;
|
document = arg;
|
||||||
else if (aArg instanceof Ci.nsIDOMEventTarget)
|
else if (arg instanceof Ci.nsIDOMEventTarget)
|
||||||
target = aArg;
|
target = arg;
|
||||||
else
|
else
|
||||||
data = aArg;
|
data = arg;
|
||||||
});
|
}
|
||||||
if (!target)
|
if (!target)
|
||||||
target = document;
|
target = document;
|
||||||
if (!document)
|
if (!document)
|
||||||
@ -924,7 +952,7 @@ var TreeStyleTabUtils = {
|
|||||||
|
|
||||||
var event = document.createEvent('DataContainerEvent');
|
var event = document.createEvent('DataContainerEvent');
|
||||||
event.initEvent(type, canBubble, cancellable);
|
event.initEvent(type, canBubble, cancellable);
|
||||||
for (var i in data)
|
for (let i in data)
|
||||||
{
|
{
|
||||||
if (!data.hasOwnProperty(i))
|
if (!data.hasOwnProperty(i))
|
||||||
continue;
|
continue;
|
||||||
@ -1105,17 +1133,19 @@ var TreeStyleTabUtils = {
|
|||||||
{
|
{
|
||||||
if (!aTabs || aTabs.length <= 1) return;
|
if (!aTabs || aTabs.length <= 1) return;
|
||||||
var id = this.makeNewClosedSetId() + '::' + aTabs.length;
|
var id = this.makeNewClosedSetId() + '::' + aTabs.length;
|
||||||
aTabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(aTabs))
|
||||||
this.setTabValue(aTab, this.kCLOSED_SET_ID, id);
|
{
|
||||||
}, this);
|
this.setTabValue(tab, this.kCLOSED_SET_ID, id);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
unmarkAsClosedSet : function TSTUtils_unmarkAsClosedSet(aTabs) /* PUBLIC API */
|
unmarkAsClosedSet : function TSTUtils_unmarkAsClosedSet(aTabs) /* PUBLIC API */
|
||||||
{
|
{
|
||||||
if (!aTabs || !aTabs.length) return;
|
if (!aTabs || !aTabs.length) return;
|
||||||
aTabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(aTabs))
|
||||||
this.deleteTabValue(aTab, this.kCLOSED_SET_ID);
|
{
|
||||||
}, this);
|
this.deleteTabValue(tab, this.kCLOSED_SET_ID);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
useTMPSessionAPI : false,
|
useTMPSessionAPI : false,
|
||||||
@ -1253,7 +1283,7 @@ var TreeStyleTabUtils = {
|
|||||||
var b = aTabBrowser || this.browser;
|
var b = aTabBrowser || this.browser;
|
||||||
var top = aFrame.top;
|
var top = aFrame.top;
|
||||||
var tabs = this.getAllTabsArray(b);
|
var tabs = this.getAllTabsArray(b);
|
||||||
for each (var tab in tabs)
|
for (let [, tab] in Iterator(tabs))
|
||||||
{
|
{
|
||||||
if (tab.linkedBrowser.contentWindow == top)
|
if (tab.linkedBrowser.contentWindow == top)
|
||||||
return tab;
|
return tab;
|
||||||
@ -1293,10 +1323,11 @@ var TreeStyleTabUtils = {
|
|||||||
cleanUpTabsArray : function TSTUtils_cleanUpTabsArray(aTabs)
|
cleanUpTabsArray : function TSTUtils_cleanUpTabsArray(aTabs)
|
||||||
{
|
{
|
||||||
var newTabs = [];
|
var newTabs = [];
|
||||||
aTabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(aTabs))
|
||||||
if (!aTab || !aTab.parentNode) return; // ignore removed tabs
|
{
|
||||||
if (newTabs.indexOf(aTab) < 0) newTabs.push(aTab);
|
if (!tab || !tab.parentNode) continue; // ignore removed tabs
|
||||||
});
|
if (newTabs.indexOf(tab) < 0) newTabs.push(tab);
|
||||||
|
}
|
||||||
newTabs.sort(this.sortTabsByOrder);
|
newTabs.sort(this.sortTabsByOrder);
|
||||||
return newTabs;
|
return newTabs;
|
||||||
},
|
},
|
||||||
@ -1328,17 +1359,17 @@ var TreeStyleTabUtils = {
|
|||||||
var groups = [];
|
var groups = [];
|
||||||
|
|
||||||
var group = [];
|
var group = [];
|
||||||
this.cleanUpTabsArray(aTabs)
|
for (let [, tab] in Iterator(this.cleanUpTabsArray(aTabs)))
|
||||||
.forEach(function(aTab) {
|
{
|
||||||
var parent = this.getParentTab(aTab);
|
let parent = this.getParentTab(tab);
|
||||||
if (!parent || group.indexOf(parent) < 0) {
|
if (!parent || group.indexOf(parent) < 0) {
|
||||||
if (group.length) groups.push(group);
|
if (group.length) groups.push(group);
|
||||||
group = [aTab];
|
group = [tab];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
group.push(aTab);
|
group.push(tab);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, this);
|
|
||||||
if (group.length) groups.push(group);
|
if (group.length) groups.push(group);
|
||||||
return groups;
|
return groups;
|
||||||
},
|
},
|
||||||
@ -2295,10 +2326,11 @@ var TreeStyleTabUtils = {
|
|||||||
var collapsedStates = aTabs.map(function(aTab) {
|
var collapsedStates = aTabs.map(function(aTab) {
|
||||||
return this.getTabValue(aTab, this.kSUBTREE_COLLAPSED) == 'true';
|
return this.getTabValue(aTab, this.kSUBTREE_COLLAPSED) == 'true';
|
||||||
}, this);
|
}, this);
|
||||||
aTabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(aTabs))
|
||||||
this.collapseExpandSubtree(aTab, false, true);
|
{
|
||||||
this.collapseExpandTab(aTab, false, true);
|
this.collapseExpandSubtree(tab, false, true);
|
||||||
}, this);
|
this.collapseExpandTab(tab, false, true);
|
||||||
|
}
|
||||||
return collapsedStates;
|
return collapsedStates;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -2362,26 +2394,27 @@ var TreeStyleTabUtils = {
|
|||||||
while (aExpandStates.length < aTabs.length) aExpandStates.push(-1);
|
while (aExpandStates.length < aTabs.length) aExpandStates.push(-1);
|
||||||
|
|
||||||
var parentTab = null;
|
var parentTab = null;
|
||||||
aTabs.forEach(function(aTab, aIndex) {
|
for (let [i, tab] in Iterator(aTabs))
|
||||||
if (sv.isCollapsed(aTab)) sv.collapseExpandTab(aTab, false, true);
|
{
|
||||||
sv.detachTab(aTab);
|
if (sv.isCollapsed(tab)) sv.collapseExpandTab(tab, false, true);
|
||||||
|
sv.detachTab(tab);
|
||||||
|
|
||||||
var parentIndexInTree = aTreeStructure[aIndex];
|
let parentIndexInTree = aTreeStructure[i];
|
||||||
if (parentIndexInTree < 0) // there is no parent, so this is a new parent!
|
if (parentIndexInTree < 0) // there is no parent, so this is a new parent!
|
||||||
parentTab = aTab.getAttribute(sv.kID);
|
parentTab = tab.getAttribute(sv.kID);
|
||||||
|
|
||||||
var parent = sv.getTabById(parentTab);
|
let parent = sv.getTabById(parentTab);
|
||||||
if (parent) {
|
if (parent) {
|
||||||
let tabs = [parent].concat(sv.getDescendantTabs(parent));
|
let tabs = [parent].concat(sv.getDescendantTabs(parent));
|
||||||
parent = parentIndexInTree < tabs.length ? tabs[parentIndexInTree] : parent ;
|
parent = parentIndexInTree < tabs.length ? tabs[parentIndexInTree] : parent ;
|
||||||
}
|
}
|
||||||
if (parent) {
|
if (parent) {
|
||||||
sv.attachTabTo(aTab, parent, {
|
sv.attachTabTo(tab, parent, {
|
||||||
forceExpand : true,
|
forceExpand : true,
|
||||||
dontMove : true
|
dontMove : true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
for (let i = aTabs.length-1; i > -1; i--)
|
for (let i = aTabs.length-1; i > -1; i--)
|
||||||
{
|
{
|
||||||
|
@ -375,7 +375,7 @@ TreeStyleTabWindow.prototype = {
|
|||||||
this.setPref('browser.tabs.loadFolderAndReplace', !!(behavior & this.kGROUP_BOOKMARK_REPLACE));
|
this.setPref('browser.tabs.loadFolderAndReplace', !!(behavior & this.kGROUP_BOOKMARK_REPLACE));
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
[
|
for (let [, pref] in Iterator([
|
||||||
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect',
|
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect',
|
||||||
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.onCurrentTabRemove',
|
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.onCurrentTabRemove',
|
||||||
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.whileFocusMovingByShortcut',
|
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.whileFocusMovingByShortcut',
|
||||||
@ -388,12 +388,13 @@ TreeStyleTabWindow.prototype = {
|
|||||||
'extensions.treestyletab.show.context-item-bookmarkTabSubTree',
|
'extensions.treestyletab.show.context-item-bookmarkTabSubTree',
|
||||||
'extensions.multipletab.show.multipletab-selection-item-removeTabSubTree',
|
'extensions.multipletab.show.multipletab-selection-item-removeTabSubTree',
|
||||||
'extensions.multipletab.show.multipletab-selection-item-createSubTree'
|
'extensions.multipletab.show.multipletab-selection-item-createSubTree'
|
||||||
].forEach(function(aPref) {
|
]))
|
||||||
var value = this.getPref(aPref);
|
{
|
||||||
if (value === null) return;
|
let value = this.getPref(pref);
|
||||||
this.setPref(aPref.replace('SubTree', 'Subtree'), value);
|
if (value === null) continue;
|
||||||
this.clearPref(aPref);
|
this.setPref(pref.replace('SubTree', 'Subtree'), value);
|
||||||
}, this);
|
this.clearPref(pref);
|
||||||
|
}
|
||||||
case 5:
|
case 5:
|
||||||
let (behavior = this.getTreePref('openGroupBookmark.behavior')) {
|
let (behavior = this.getTreePref('openGroupBookmark.behavior')) {
|
||||||
behavior = behavior | 2048;
|
behavior = behavior | 2048;
|
||||||
@ -410,13 +411,14 @@ TreeStyleTabWindow.prototype = {
|
|||||||
this.setTreePref('autoAttach.searchResult', search);
|
this.setTreePref('autoAttach.searchResult', search);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
orientalPrefs.forEach(function(aPref) {
|
for (let [, pref] in Iterator(orientalPrefs))
|
||||||
let value = this.getPref(aPref);
|
{
|
||||||
if (value === null) return;
|
let value = this.getPref(pref);
|
||||||
this.setPref(aPref+'.horizontal', value);
|
if (value === null) continue;
|
||||||
this.setPref(aPref+'.vertical', value);
|
this.setPref(pref+'.horizontal', value);
|
||||||
this.clearPref(aPref);
|
this.setPref(pref+'.vertical', value);
|
||||||
}, this);
|
this.clearPref(pref);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.setTreePref('prefsVersion', this.kPREF_VERSION);
|
this.setTreePref('prefsVersion', this.kPREF_VERSION);
|
||||||
@ -499,16 +501,17 @@ TreeStyleTabWindow.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!prefs) return;
|
if (!prefs) return;
|
||||||
[
|
for (let [, pref] in Iterator([
|
||||||
'browser.tabs.loadFolderAndReplace',
|
'browser.tabs.loadFolderAndReplace',
|
||||||
'browser.tabs.insertRelatedAfterCurrent',
|
'browser.tabs.insertRelatedAfterCurrent',
|
||||||
'extensions.stm.tabBarMultiRows' // Super Tab Mode
|
'extensions.stm.tabBarMultiRows' // Super Tab Mode
|
||||||
].forEach(function(aPref) {
|
]))
|
||||||
var backup = prefs.getPref(aPref+'.backup');
|
{
|
||||||
if (backup === null) return;
|
let backup = prefs.getPref(pref+'.backup');
|
||||||
prefs.setPref(aPref+'.override', backup); // we have to set to ".override" pref, to avoid unexpectedly reset by the preference listener.
|
if (backup === null) continue;
|
||||||
prefs.clearPref(aPref+'.backup');
|
prefs.setPref(pref+'.override', backup); // we have to set to ".override" pref, to avoid unexpectedly reset by the preference listener.
|
||||||
});
|
prefs.clearPref(pref+'.backup');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
new this.window['piro.sakura.ne.jp'].UninstallationListener({
|
new this.window['piro.sakura.ne.jp'].UninstallationListener({
|
||||||
id : 'treestyletab@piro.sakura.ne.jp',
|
id : 'treestyletab@piro.sakura.ne.jp',
|
||||||
@ -549,21 +552,23 @@ TreeStyleTabWindow.prototype = {
|
|||||||
var items = Array.slice(aEvent.originalTarget.childNodes);
|
var items = Array.slice(aEvent.originalTarget.childNodes);
|
||||||
var firstItemIndex = 0;
|
var firstItemIndex = 0;
|
||||||
// ignore menu items inserted by Weave (Firefox Sync), Tab Utilities, and others.
|
// ignore menu items inserted by Weave (Firefox Sync), Tab Utilities, and others.
|
||||||
items.forEach(function(aItem, aIndex) {
|
for (let [i, item] in Iterator(items))
|
||||||
|
{
|
||||||
if (
|
if (
|
||||||
aItem.getAttribute('anonid') ||
|
item.getAttribute('anonid') ||
|
||||||
aItem.id ||
|
item.id ||
|
||||||
aItem.hidden ||
|
item.hidden ||
|
||||||
aItem.localName != 'menuitem'
|
item.localName != 'menuitem'
|
||||||
)
|
)
|
||||||
firstItemIndex = aIndex + 1;
|
firstItemIndex = i + 1;
|
||||||
});
|
}
|
||||||
items = items.slice(firstItemIndex);
|
items = items.slice(firstItemIndex);
|
||||||
|
|
||||||
var b = this.getTabBrowserFromChild(aEvent.originalTarget) || this.browser;
|
var b = this.getTabBrowserFromChild(aEvent.originalTarget) || this.browser;
|
||||||
this.getTabsArray(b).forEach(function(aTab, aIndex) {
|
for (let [i, tab] in Iterator(this.getTabsArray(b)))
|
||||||
items[aIndex].style.marginLeft = aTab.getAttribute(this.kNEST)+'em';
|
{
|
||||||
}, this);
|
items[i].style.marginLeft = tab.getAttribute(this.kNEST)+'em';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy : function TSTWindow_destroy()
|
destroy : function TSTWindow_destroy()
|
||||||
@ -594,9 +599,10 @@ TreeStyleTabWindow.prototype = {
|
|||||||
d.removeEventListener(this.kEVENT_TYPE_TABBAR_STATE_CHANGED, this, false);
|
d.removeEventListener(this.kEVENT_TYPE_TABBAR_STATE_CHANGED, this, false);
|
||||||
d.removeEventListener(this.kEVENT_TYPE_FOCUS_NEXT_TAB, this, false);
|
d.removeEventListener(this.kEVENT_TYPE_FOCUS_NEXT_TAB, this, false);
|
||||||
|
|
||||||
this._tabFocusAllowance.forEach(function(aListener) {
|
for (let [, listener] in Iterator(this._tabFocusAllowance))
|
||||||
w.removeEventListener(this.kEVENT_TYPE_FOCUS_NEXT_TAB, aListener, false);
|
{
|
||||||
}, this);
|
w.removeEventListener(this.kEVENT_TYPE_FOCUS_NEXT_TAB, listener, false);
|
||||||
|
}
|
||||||
|
|
||||||
var appcontent = d.getElementById('appcontent');
|
var appcontent = d.getElementById('appcontent');
|
||||||
appcontent.removeEventListener('SubBrowserAdded', this, false);
|
appcontent.removeEventListener('SubBrowserAdded', this, false);
|
||||||
@ -1054,11 +1060,12 @@ TreeStyleTabWindow.prototype = {
|
|||||||
|
|
||||||
this.AeroPeek.windows.some(function(aTabWindow) {
|
this.AeroPeek.windows.some(function(aTabWindow) {
|
||||||
if (aTabWindow.win == this.window) {
|
if (aTabWindow.win == this.window) {
|
||||||
aTabWindow.previews.forEach(function(aPreview) {
|
for (let [, preview] in Iterator(aTabWindow.previews))
|
||||||
if (!aPreview) return;
|
{
|
||||||
var tab = aPreview.controller.wrappedJSObject.tab;
|
if (!preview) continue;
|
||||||
aPreview.visible = !this.isCollapsed(tab);
|
let tab = preview.controller.wrappedJSObject.tab;
|
||||||
}, this);
|
preview.visible = !this.isCollapsed(tab);
|
||||||
|
}
|
||||||
this.AeroPeek.checkPreviewCount();
|
this.AeroPeek.checkPreviewCount();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1204,14 +1211,15 @@ TreeStyleTabWindow.prototype = {
|
|||||||
|
|
||||||
processRestoredTabs : function TSTWindow_processRestoredTabs()
|
processRestoredTabs : function TSTWindow_processRestoredTabs()
|
||||||
{
|
{
|
||||||
this._restoringTabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(this._restoringTabs))
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
var b = this.getTabBrowserFromChild(aTab);
|
let b = this.getTabBrowserFromChild(aTab);
|
||||||
if (b) b.treeStyleTab.handleRestoredTab(aTab);
|
if (b) b.treeStyleTab.handleRestoredTab(aTab);
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
}
|
}
|
||||||
}, this);
|
}
|
||||||
this._restoringTabs = [];
|
this._restoringTabs = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1272,23 +1280,24 @@ TreeStyleTabWindow.prototype = {
|
|||||||
if (aOnlyChildren)
|
if (aOnlyChildren)
|
||||||
tabs = this.gatherSubtreeMemberTabs(aTabOrTabs);
|
tabs = this.gatherSubtreeMemberTabs(aTabOrTabs);
|
||||||
|
|
||||||
this.splitTabsToSubtrees(tabs).forEach(function(aTabs) {
|
for (let [, subtreeTabs] in Iterator(this.splitTabsToSubtrees(tabs)))
|
||||||
if (!this.fireTabSubtreeClosingEvent(aTabs[0], aTabs))
|
|
||||||
return;
|
|
||||||
var b = this.getTabBrowserFromChild(aTabs[0]);
|
|
||||||
if (aOnlyChildren)
|
|
||||||
aTabs = aTabs.slice(1);
|
|
||||||
if (!aTabs.length)
|
|
||||||
return;
|
|
||||||
this.stopRendering();
|
|
||||||
this.markAsClosedSet(aTabs);
|
|
||||||
for (let i = aTabs.length-1; i > -1; i--)
|
|
||||||
{
|
{
|
||||||
b.removeTab(aTabs[i], { animate : true });
|
if (!this.fireTabSubtreeClosingEvent(subtreeTabs[0], subtreeTabs))
|
||||||
|
continue;
|
||||||
|
let b = this.getTabBrowserFromChild(subtreeTabs[0]);
|
||||||
|
if (aOnlyChildren)
|
||||||
|
subtreeTabs = subtreeTabs.slice(1);
|
||||||
|
if (!subtreeTabs.length)
|
||||||
|
continue;
|
||||||
|
this.stopRendering();
|
||||||
|
this.markAsClosedSet(subtreeTabs);
|
||||||
|
for (let i = subtreeTabs.length-1; i > -1; i--)
|
||||||
|
{
|
||||||
|
b.removeTab(subtreeTabs[i], { animate : true });
|
||||||
}
|
}
|
||||||
this.startRendering();
|
this.startRendering();
|
||||||
this.fireTabSubtreeClosedEvent(b, aTabs[0], aTabs)
|
this.fireTabSubtreeClosedEvent(b, subtreeTabs[0], subtreeTabs)
|
||||||
}, this);
|
}
|
||||||
},
|
},
|
||||||
removeTabSubTree : function() { return this.removeTabSubtree.apply(this, arguments); }, // obsolete, for backward compatibility
|
removeTabSubTree : function() { return this.removeTabSubtree.apply(this, arguments); }, // obsolete, for backward compatibility
|
||||||
|
|
||||||
@ -1388,10 +1397,11 @@ TreeStyleTabWindow.prototype = {
|
|||||||
aTabs.shift() ;
|
aTabs.shift() ;
|
||||||
var self = this;
|
var self = this;
|
||||||
this.Deferred.next(function(self) {
|
this.Deferred.next(function(self) {
|
||||||
aTabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(aTabs))
|
||||||
b.treeStyleTab.attachTabTo(aTab, root);
|
{
|
||||||
b.treeStyleTab.collapseExpandTab(aTab, false);
|
b.treeStyleTab.attachTabTo(tab, root);
|
||||||
}, self);
|
b.treeStyleTab.collapseExpandTab(tab, false);
|
||||||
|
}
|
||||||
if (parent) {
|
if (parent) {
|
||||||
b.treeStyleTab.attachTabTo(root, parent, {
|
b.treeStyleTab.attachTabTo(root, parent, {
|
||||||
insertBefore : next
|
insertBefore : next
|
||||||
@ -1425,11 +1435,12 @@ TreeStyleTabWindow.prototype = {
|
|||||||
var roots = [];
|
var roots = [];
|
||||||
if (!aTabs || !aTabs.length) return roots;
|
if (!aTabs || !aTabs.length) return roots;
|
||||||
aTabs = this.cleanUpTabsArray(aTabs);
|
aTabs = this.cleanUpTabsArray(aTabs);
|
||||||
aTabs.forEach(function(aTab) {
|
for (let [, tab] in Iterator(aTabs))
|
||||||
var parent = this.getParentTab(aTab);
|
{
|
||||||
if (parent && aTabs.indexOf(parent) > -1) return;
|
let parent = this.getParentTab(tab);
|
||||||
roots.push(aTab);
|
if (parent && aTabs.indexOf(parent) > -1) continue;
|
||||||
}, this);
|
roots.push(tab);
|
||||||
|
}
|
||||||
return roots;
|
return roots;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1507,9 +1518,10 @@ TreeStyleTabWindow.prototype = {
|
|||||||
|
|
||||||
this.stopRendering();
|
this.stopRendering();
|
||||||
this.markAsClosedSet(closeTabs);
|
this.markAsClosedSet(closeTabs);
|
||||||
closeTabs.reverse().forEach(function(aTab) {
|
for (let [, tab] in Iterator(closeTabs.reverse()))
|
||||||
b.removeTab(aTab);
|
{
|
||||||
});
|
b.removeTab(tab);
|
||||||
|
}
|
||||||
this.startRendering();
|
this.startRendering();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user