diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-17 08:26:02 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-17 08:26:02 +0200 |
commit | b18a9cf86ea25bc52d9cfea584e3aa8bfbe81f0a (patch) | |
tree | 2e3d8df53e48b5dd2897f796295401faaec42a85 /toolkit/content/widgets/toolbar.xml | |
parent | 90c68b34abf51ae0b1a2848094fc3115b30ee498 (diff) | |
parent | e719d7b3be222dfafad78c71761bad2bafb1243d (diff) | |
download | UXP-b18a9cf86ea25bc52d9cfea584e3aa8bfbe81f0a.tar UXP-b18a9cf86ea25bc52d9cfea584e3aa8bfbe81f0a.tar.gz UXP-b18a9cf86ea25bc52d9cfea584e3aa8bfbe81f0a.tar.lz UXP-b18a9cf86ea25bc52d9cfea584e3aa8bfbe81f0a.tar.xz UXP-b18a9cf86ea25bc52d9cfea584e3aa8bfbe81f0a.zip |
Merge branch 'master' of https://github.com/MoonchildProductions/UXP into pm_url_1
Diffstat (limited to 'toolkit/content/widgets/toolbar.xml')
-rw-r--r-- | toolkit/content/widgets/toolbar.xml | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/toolkit/content/widgets/toolbar.xml b/toolkit/content/widgets/toolbar.xml index 548504e24..e1f58f7aa 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 --> @@ -49,18 +49,54 @@ <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 (toolbarset.hasAttribute("toolbar"+(++index))) { - var toolbarInfo = toolbarset.getAttribute("toolbar"+index); - var infoSplit = toolbarInfo.split(":"); - this.appendCustomToolbar(infoSplit[0], infoSplit[1]); + while (this.toolbarset.hasAttribute("toolbar" + (++index))) { + 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+ + // Basilisk (UXP) + infoHidingAttribute = infoSplit[1] + .split(this.toolbarInfoSeparators[1]); + infoCurrentSet = infoSplit[2]; + break; + case 2: + // Legacy: + // - toolbars from Pale Moon 27.0 - 27.1.x + // - Basilisk (moebius) + // 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); } } ]]> @@ -69,6 +105,7 @@ <method name="appendCustomToolbar"> <parameter name="aName"/> <parameter name="aCurrentSet"/> + <parameter name="aHidingAttribute"/> <body> <![CDATA[ if (!this.toolbarset) @@ -84,6 +121,10 @@ toolbar.setAttribute("iconsize", this.getAttribute("iconsize")); toolbar.setAttribute("context", this.toolbarset.getAttribute("context")); toolbar.setAttribute("class", "chromeclass-toolbar"); + // Restore persist the hiding attribute. + if (aHidingAttribute[0]) { + toolbar.setAttribute(aHidingAttribute[0], aHidingAttribute[1]); + } this.insertBefore(toolbar, this.toolbarset); return toolbar; |