summaryrefslogtreecommitdiffstats
path: root/toolkit/content/widgets/toolbar.xml
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-15 22:31:31 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-15 22:31:31 +0200
commitb7115f464e01e3483160cb50fef02c10c8458029 (patch)
tree0158f4c8e2482ab9dbd087743534146b2f1787db /toolkit/content/widgets/toolbar.xml
parent0f8df53ae7d831410407c182d489927cce5c3597 (diff)
downloadUXP-b7115f464e01e3483160cb50fef02c10c8458029.tar
UXP-b7115f464e01e3483160cb50fef02c10c8458029.tar.gz
UXP-b7115f464e01e3483160cb50fef02c10c8458029.tar.lz
UXP-b7115f464e01e3483160cb50fef02c10c8458029.tar.xz
UXP-b7115f464e01e3483160cb50fef02c10c8458029.zip
palemoon#975: Customizable toolbars - backward compatible (but unidirectional)
Diffstat (limited to 'toolkit/content/widgets/toolbar.xml')
-rw-r--r--toolkit/content/widgets/toolbar.xml48
1 files changed, 39 insertions, 9 deletions
diff --git a/toolkit/content/widgets/toolbar.xml b/toolkit/content/widgets/toolbar.xml
index e79843dbd..c371be317 100644
--- a/toolkit/content/widgets/toolbar.xml
+++ b/toolkit/content/widgets/toolbar.xml
@@ -30,7 +30,7 @@
</field>
<field name="externalToolbars">
- []
+ []
</field>
<!-- Set by customizeToolbar.js -->
@@ -50,22 +50,52 @@
<constructor>
<![CDATA[
this.toolbarInfoSeparators = ["|", "-"];
+ this.toolbarInfoLegacySeparator = ":";
// Look to see if there is a toolbarset.
this.toolbarset = this.firstChild;
- while (this.toolbarset && this.toolbarset.localName != "toolbarset")
+ while (this.toolbarset && this.toolbarset.localName != "toolbarset") {
this.toolbarset = toolbarset.nextSibling;
+ }
if (this.toolbarset) {
// Create each toolbar described by the toolbarset.
var index = 0;
while (this.toolbarset.hasAttribute("toolbar" + (++index))) {
- var toolbarInfo = this.toolbarset.getAttribute("toolbar"+index);
- var infoSplit = toolbarInfo.split(this.toolbarInfoSeparators[0]);
- var infoName = infoSplit[0];
- var infoHidingAttribute = infoSplit[1].split(this.toolbarInfoSeparators[1]);
- var infoCurrentSet = infoSplit[2];
-
- this.appendCustomToolbar(infoName, infoCurrentSet, infoHidingAttribute);
+ let hiddingAttribute =
+ this.toolbarset.getAttribute("type") == "menubar"
+ ? "autohide" : "collapsed";
+ let toolbarInfo = this.toolbarset.getAttribute("toolbar" + index);
+ let infoSplit = toolbarInfo.split(this.toolbarInfoSeparators[0]);
+ if (infoSplit.length == 1) {
+ infoSplit = toolbarInfo.split(this.toolbarInfoLegacySeparator);
+ }
+ let infoName = infoSplit[0];
+ let infoHidingAttribute = [null, null];
+ let infoCurrentSet = "";
+ let infoSplitLen = infoSplit.length;
+ switch (infoSplitLen) {
+ case 3:
+ // Pale Moon 27.2+
+ infoHidingAttribute = infoSplit[1]
+ .split(this.toolbarInfoSeparators[1]);
+ infoCurrentSet = infoSplit[2];
+ break;
+ case 2:
+ // Legacy:
+ // - toolbars from Pale Moon 27.0 - 27.1.x
+ // - Basilisk
+ // The previous value (hiddingAttribute) isn't stored.
+ infoHidingAttribute = [hiddingAttribute, "false"];
+ infoCurrentSet = infoSplit[1];
+ break;
+ default:
+ Components.utils.reportError(
+ "Customizable toolbars - an invalid value:" + "\n"
+ + '"toolbar' + index + '" = "' + toolbarInfo + '"');
+ break;
+ }
+ this.appendCustomToolbar(
+ infoName, infoCurrentSet, infoHidingAttribute);
}
}
]]>