fixed bug in music gateway extras sidebar
Signed-off-by: ari melody <ari@arimelody.me>
This commit is contained in:
parent
77516e3d34
commit
f42c4067f2
|
@ -28,20 +28,18 @@ function apply_funny_bob_to_upcoming_tags() {
|
|||
}
|
||||
}
|
||||
|
||||
const extras_pairs = Array.from(document.querySelectorAll("div#info > div").values().map(container => {
|
||||
const extras_pairs = Array.from(document.querySelectorAll("div#info > div").values()).map(container => {
|
||||
return {
|
||||
container,
|
||||
button: document.getElementById("extras").querySelector(`ul li a[href="#${container.id}"]`)
|
||||
};
|
||||
}));
|
||||
});
|
||||
const info_container = document.getElementById("info")
|
||||
info_container.addEventListener("scroll", update_extras_buttons);
|
||||
function update_extras_buttons() {
|
||||
console.clear();
|
||||
const info_rect = info_container.getBoundingClientRect();
|
||||
const info_y = info_rect.y;
|
||||
const font_size = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||
console.log("info_y: " + info_y);
|
||||
let current = extras_pairs[0];
|
||||
extras_pairs.forEach(pair => {
|
||||
pair.button.classList.remove("active");
|
||||
|
@ -50,7 +48,6 @@ function update_extras_buttons() {
|
|||
info_rect.height / 2 +
|
||||
4 * font_size;
|
||||
if (scroll_diff <= 0) current = pair;
|
||||
console.log(`${pair.container.id}: ${scroll_diff}`);
|
||||
})
|
||||
current.button.classList.add("active");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue