diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
commit | fc61780b35af913801d72086456f493f63197da6 (patch) | |
tree | f85891288a7bd988da9f0f15ae64e5c63f00d493 /toolkit/jetpack | |
parent | 69f7f9e5f1475891ce11cc4f431692f965b0cd30 (diff) | |
parent | 50d3e596bbe89c95615f96eb71f6bc5be737a1db (diff) | |
download | UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar.gz UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar.lz UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar.xz UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.zip |
Merge commit '50d3e596bbe89c95615f96eb71f6bc5be737a1db' into Basilisk-releasev2018.07.18
# Conflicts:
# browser/app/profile/firefox.js
# browser/components/preferences/jar.mn
Diffstat (limited to 'toolkit/jetpack')
-rw-r--r-- | toolkit/jetpack/sdk/ui/buttons.js | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/toolkit/jetpack/sdk/ui/buttons.js b/toolkit/jetpack/sdk/ui/buttons.js index 6aaed3865..450584ea7 100644 --- a/toolkit/jetpack/sdk/ui/buttons.js +++ b/toolkit/jetpack/sdk/ui/buttons.js @@ -50,6 +50,14 @@ function insertButton(aWindow, id, onBuild) { let toolbar = toolbarId != "" && doc.getElementById(toolbarId); if (toolbar) { + // Handle special items with dynamic ids + let match = /^(separator|spacer|spring)\[(\d+)\]$/.exec(nextItemId); + if (match !== null) { + let dynItems = toolbar.querySelectorAll("toolbar" + match[1]); + if (match[2] < dynItems.length) { + nextItemId = dynItems[match[2]].id; + } + } let nextItem = nextItemId != "" && doc.getElementById(nextItemId); // If nextItem not in toolbar then retrieve it by reading currentset attribute if (!(nextItem && nextItem.parentNode && nextItem.parentNode.id == toolbarId)) { @@ -82,15 +90,26 @@ function afterCustomize(e) { for (let [id] of buttonsList) { let toolbox = e.target; let b = toolbox.parentNode.querySelector("#" + id); - let toolbarId = null, nextItemId = null; + let toolbarId = null, nextItem = null, nextItemId = null; if (b) { let parent = b.parentNode; - let nextItem = b.nextSibling; + nextItem = b.nextSibling; if (parent && parent.localName == "toolbar") { toolbarId = parent.id; nextItemId = nextItem && nextItem.id; } } + // Handle special items with dynamic ids + let match = /^(separator|spacer|spring)\d+$/.exec(nextItemId); + if (match !== null) { + let dynItems = nextItem.parentNode.querySelectorAll("toolbar" + match[1]); + for (let i = 0; i < dynItems.length; i++) { + if (dynItems[i].id == nextItemId) { + nextItemId = match[1] + "[" + i + "]"; + break; + } + } + } saveLocation(id, toolbarId, nextItemId); } } |