From a75323fc8e852e9c8b68f537a250fb7108ca7624 Mon Sep 17 00:00:00 2001 From: aminomancer <33384265+aminomancer@users.noreply.github.com> Date: Fri, 19 Aug 2022 18:19:35 -0700 Subject: [PATCH] update navbarToolbarButtonSlider.uc.js: don't move non-overflowable buttons to the overflow panel. for example, the downloads button isn't supposed to overflow. so when the slider overflows, move the overflowable buttons to the panel and unpack the other buttons in place (where the slider was). --- JS/atoolboxButton.uc.js | 2 +- JS/navbarToolbarButtonSlider.uc.js | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/JS/atoolboxButton.uc.js b/JS/atoolboxButton.uc.js index d80d625..99cc5a7 100644 --- a/JS/atoolboxButton.uc.js +++ b/JS/atoolboxButton.uc.js @@ -426,7 +426,7 @@ const toolboxButtonL10n = { let shortcut = hotkey ? ` (${ShortcutUtils.prettifyShortcut(hotkey)})` : ""; toolbarbutton.label = labelString; label.value = labelString; - toolbarbutton.tooltipText = `${labelString}${shortcut}`; + toolbarbutton.tooltipText = labelString + shortcut; }; // remove this window's observers when the window closes, since observers are global diff --git a/JS/navbarToolbarButtonSlider.uc.js b/JS/navbarToolbarButtonSlider.uc.js index 8dbfd28..294bda7 100644 --- a/JS/navbarToolbarButtonSlider.uc.js +++ b/JS/navbarToolbarButtonSlider.uc.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Navbar Toolbar Button Slider -// @version 2.8.2 +// @version 2.8.3 // @author aminomancer // @homepage https://github.com/aminomancer // @description Wrap all toolbar buttons in a scrollable container. It can @@ -342,7 +342,9 @@ class NavbarToolbarSlider { let overflown = this.isOverflowing; let array = [...this.widgets].filter(this.filterFn, this); if (overflown) { - this.wrapAll(array, this.cOverflow); + array.forEach(button => { + if (button.getAttribute("overflows") !== "false") this.cOverflow.appendChild(button); + }); this.cOverflow.insertBefore(this.outer, this.cOverflow.firstElementChild); } else this.wrapAll(array, this.inner); this.outer.hidden = overflown; @@ -351,9 +353,12 @@ class NavbarToolbarSlider { onWidgetOverflow(aNode, aContainer) { if (aNode.ownerGlobal !== window) return; if (aNode === this.outer && aContainer === this.cTarget) { - NavbarToolbarSlider.appendLoop(this.kids, this.cOverflow); + [...this.kids].forEach(button => { + if (button.getAttribute("overflows") === "false") { + this.cTarget.insertBefore(button, this.outer); + } else this.cOverflow.appendChild(button); + }); this.outer.hidden = true; - this.reOrder(); } } onWidgetUnderflow(aNode, aContainer) {