Skip to content

Commit

Permalink
update navbarToolbarButtonSlider.uc.js:
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
aminomancer committed Aug 20, 2022
1 parent 636056d commit a75323f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion JS/atoolboxButton.uc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions JS/navbarToolbarButtonSlider.uc.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit a75323f

Please sign in to comment.