don't control visibility of menuitems and selarators if they are removed by Menu Editor addon.
This commit is contained in:
parent
738be1e6f2
commit
3a2a5e8844
@ -3832,6 +3832,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
aEvent.currentTarget,
|
aEvent.currentTarget,
|
||||||
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE
|
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE
|
||||||
).singleNodeValue;
|
).singleNodeValue;
|
||||||
|
if (!item) return;
|
||||||
items[aID] = item;
|
items[aID] = item;
|
||||||
if (this.getTreePref('show.'+aID))
|
if (this.getTreePref('show.'+aID))
|
||||||
item.removeAttribute('hidden');
|
item.removeAttribute('hidden');
|
||||||
@ -3857,17 +3858,17 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
// collapse/expand all
|
// collapse/expand all
|
||||||
sep = this.evaluateXPath(
|
sep = this.evaluateXPath(
|
||||||
'descendant::xul:menuseparator[starts-with(@id, "'+this.kMENUITEM_COLLAPSEEXPAND_SEPARATOR+'")]',
|
'descendant::xul:menuseparator[starts-with(@id, "'+this.kMENUITEM_COLLAPSEEXPAND_SEPARATOR+'")]',
|
||||||
|
|
||||||
aEvent.currentTarget,
|
aEvent.currentTarget,
|
||||||
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE
|
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE
|
||||||
).singleNodeValue;
|
).singleNodeValue;
|
||||||
let collapseItem = items[this.kMENUITEM_COLLAPSE];
|
let collapseItem = items[this.kMENUITEM_COLLAPSE];
|
||||||
let expanndItem = items[this.kMENUITEM_EXPAND];
|
let expandItem = items[this.kMENUITEM_EXPAND];
|
||||||
if (this.canCollapseSubtree(b) &&
|
if (this.canCollapseSubtree(b) &&
|
||||||
this.evaluateXPath(
|
this.evaluateXPath(
|
||||||
'child::xul:tab[@'+this.kCHILDREN+']',
|
'child::xul:tab[@'+this.kCHILDREN+']',
|
||||||
b.mTabContainer
|
b.mTabContainer
|
||||||
).snapshotLength) {
|
).snapshotLength) {
|
||||||
|
if (collapseItem) {
|
||||||
if (this.evaluateXPath(
|
if (this.evaluateXPath(
|
||||||
'child::xul:tab[@'+this.kCHILDREN+' and not(@'+this.kSUBTREE_COLLAPSED+'="true")]',
|
'child::xul:tab[@'+this.kCHILDREN+' and not(@'+this.kSUBTREE_COLLAPSED+'="true")]',
|
||||||
b.mTabContainer
|
b.mTabContainer
|
||||||
@ -3875,37 +3876,47 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
collapseItem.removeAttribute('disabled');
|
collapseItem.removeAttribute('disabled');
|
||||||
else
|
else
|
||||||
collapseItem.setAttribute('disabled', true);
|
collapseItem.setAttribute('disabled', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (expandItem) {
|
||||||
if (this.evaluateXPath(
|
if (this.evaluateXPath(
|
||||||
'child::xul:tab[@'+this.kCHILDREN+' and @'+this.kSUBTREE_COLLAPSED+'="true"]',
|
'child::xul:tab[@'+this.kCHILDREN+' and @'+this.kSUBTREE_COLLAPSED+'="true"]',
|
||||||
b.mTabContainer
|
b.mTabContainer
|
||||||
).snapshotLength)
|
).snapshotLength)
|
||||||
expanndItem.removeAttribute('disabled');
|
expandItem.removeAttribute('disabled');
|
||||||
else
|
else
|
||||||
expanndItem.setAttribute('disabled', true);
|
expandItem.setAttribute('disabled', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
collapseItem.setAttribute('hidden', true);
|
if (collapseItem) collapseItem.setAttribute('hidden', true);
|
||||||
expanndItem.setAttribute('hidden', true);
|
if (expandItem) expandItem.setAttribute('hidden', true);
|
||||||
}
|
}
|
||||||
if (collapseItem.getAttribute('hidden') == 'true' &&
|
if (sep) {
|
||||||
expanndItem.getAttribute('hidden') == 'true') {
|
if (
|
||||||
|
(!collapseItem || collapseItem.getAttribute('hidden') == 'true') &&
|
||||||
|
(!expandItem || expandItem.getAttribute('hidden') == 'true')
|
||||||
|
) {
|
||||||
sep.setAttribute('hidden', true);
|
sep.setAttribute('hidden', true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sep.removeAttribute('hidden');
|
sep.removeAttribute('hidden');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// close all tabs but this tree
|
// close all tabs but this tree
|
||||||
let removeAllTabsBut = items[this.kMENUITEM_REMOVEALLTABSBUT];
|
let removeAllTabsBut = items[this.kMENUITEM_REMOVEALLTABSBUT];
|
||||||
|
if (remoteAllTabsBug) {
|
||||||
let rootTabs = this.visibleRootTabs;
|
let rootTabs = this.visibleRootTabs;
|
||||||
if (rootTabs.length == 1 && rootTabs[0] == b.mContextTab)
|
if (rootTabs.length == 1 && rootTabs[0] == b.mContextTab)
|
||||||
removeAllTabsBut.setAttribute('disabled', true);
|
removeAllTabsBut.setAttribute('disabled', true);
|
||||||
else
|
else
|
||||||
removeAllTabsBut.removeAttribute('disabled');
|
removeAllTabsBut.removeAttribute('disabled');
|
||||||
|
}
|
||||||
|
|
||||||
// auto hide
|
// auto hide
|
||||||
let autohide = items[this.kMENUITEM_AUTOHIDE];
|
let autohide = items[this.kMENUITEM_AUTOHIDE];
|
||||||
|
if (autohide)
|
||||||
this.autoHide.updateMenuItem(autohide);
|
this.autoHide.updateMenuItem(autohide);
|
||||||
|
|
||||||
// fix
|
// fix
|
||||||
@ -3920,24 +3931,30 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
fixedLabel = 'label-horizontal';
|
fixedLabel = 'label-horizontal';
|
||||||
}
|
}
|
||||||
let fixed = items[this.kMENUITEM_FIXED];
|
let fixed = items[this.kMENUITEM_FIXED];
|
||||||
|
if (fixed) {
|
||||||
fixed.setAttribute('label', fixed.getAttribute(fixedLabel));
|
fixed.setAttribute('label', fixed.getAttribute(fixedLabel));
|
||||||
if (fixedPref)
|
if (fixedPref)
|
||||||
fixed.setAttribute('checked', true);
|
fixed.setAttribute('checked', true);
|
||||||
else
|
else
|
||||||
fixed.removeAttribute('checked');
|
fixed.removeAttribute('checked');
|
||||||
|
}
|
||||||
|
|
||||||
sep = this.evaluateXPath(
|
sep = this.evaluateXPath(
|
||||||
'descendant::xul:menuseparator[starts-with(@id, "'+this.kMENUITEM_AUTOHIDE_SEPARATOR+'")]',
|
'descendant::xul:menuseparator[starts-with(@id, "'+this.kMENUITEM_AUTOHIDE_SEPARATOR+'")]',
|
||||||
aEvent.currentTarget,
|
aEvent.currentTarget,
|
||||||
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE
|
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE
|
||||||
).singleNodeValue;
|
).singleNodeValue;
|
||||||
if (autohide.getAttribute('hidden') != 'true' ||
|
if (sep) {
|
||||||
fixed.getAttribute('hidden') != 'true') {
|
if (
|
||||||
|
(autohide && autohide.getAttribute('hidden') != 'true') ||
|
||||||
|
(fixed && fixed.getAttribute('hidden') != 'true')
|
||||||
|
) {
|
||||||
sep.removeAttribute('hidden');
|
sep.removeAttribute('hidden');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sep.setAttribute('hidden', true);
|
sep.setAttribute('hidden', true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onTabsOnTopSyncCommand : function TSTBrowser_onTabsOnTopSyncCommand(aEnabled)
|
onTabsOnTopSyncCommand : function TSTBrowser_onTabsOnTopSyncCommand(aEnabled)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user