summaryrefslogtreecommitdiffstats
path: root/toolkit/content/customizeToolbar.js
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-15 22:23:57 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-15 22:23:57 +0200
commit0f8df53ae7d831410407c182d489927cce5c3597 (patch)
treeab8b35fda02f1ffa8be8937e3e78a31056bef131 /toolkit/content/customizeToolbar.js
parent4cfe5d84de0b8976f8bc5c005ae12ac3adf8f18a (diff)
downloadUXP-0f8df53ae7d831410407c182d489927cce5c3597.tar
UXP-0f8df53ae7d831410407c182d489927cce5c3597.tar.gz
UXP-0f8df53ae7d831410407c182d489927cce5c3597.tar.lz
UXP-0f8df53ae7d831410407c182d489927cce5c3597.tar.xz
UXP-0f8df53ae7d831410407c182d489927cce5c3597.zip
palemoon#903: Customizable toolbars - persist the attribute "collapsed"
https://github.com/MoonchildProductions/Pale-Moon/pull/903
Diffstat (limited to 'toolkit/content/customizeToolbar.js')
-rw-r--r--toolkit/content/customizeToolbar.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/toolkit/content/customizeToolbar.js b/toolkit/content/customizeToolbar.js
index b96b60b98..d5288776b 100644
--- a/toolkit/content/customizeToolbar.js
+++ b/toolkit/content/customizeToolbar.js
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+const gToolbarInfoSeparators = ["|", "-"];
+
var gToolboxDocument = null;
var gToolbox = null;
var gCurrentDragOverItem = null;
@@ -173,9 +175,20 @@ function persistCurrentSets()
// Remove custom toolbars whose contents have been removed.
gToolbox.removeChild(toolbar);
} else if (gToolbox.toolbarset) {
+ var hidingAttribute = toolbar.getAttribute("type") == "menubar" ?
+ "autohide" : "collapsed";
// Persist custom toolbar info on the <toolbarset/>
+ // Attributes:
+ // Names: "toolbarX" (X - the number of the toolbar)
+ // Values: "Name:HidingAttributeName-HidingAttributeValue:CurrentSet"
gToolbox.toolbarset.setAttribute("toolbar"+(++customCount),
- toolbar.toolbarName + ":" + currentSet);
+ toolbar.toolbarName
+ + gToolbarInfoSeparators[0]
+ + hidingAttribute
+ + gToolbarInfoSeparators[1]
+ + toolbar.getAttribute(hidingAttribute)
+ + gToolbarInfoSeparators[0]
+ + currentSet);
gToolboxDocument.persist(gToolbox.toolbarset.id, "toolbar"+customCount);
}
}
@@ -485,6 +498,11 @@ function addNewToolbar()
continue;
}
+ if (name.value.includes(gToolbarInfoSeparators[0])) {
+ message = stringBundle.getFormattedString("enterToolbarIllegalChars", [name.value]);
+ continue;
+ }
+
var dupeFound = false;
// Check for an existing toolbar with the same display name
@@ -506,7 +524,7 @@ function addNewToolbar()
message = stringBundle.getFormattedString("enterToolbarDup", [name.value]);
}
- gToolbox.appendCustomToolbar(name.value, "");
+ gToolbox.appendCustomToolbar(name.value, "", [null, null]);
toolboxChanged();