mirror of
https://github.com/danbulant/dribbblish-dynamic-theme
synced 2026-07-09 05:01:15 +00:00
Keep tooltip text updated
This commit is contained in:
parent
8b5ef19764
commit
927f25867c
2 changed files with 7 additions and 3 deletions
|
|
@ -153,8 +153,8 @@ waitForElement([".Root__main-view .os-resize-observer-host"], ([resizeHost]) =>
|
||||||
tooltip.className = "prog-tooltip";
|
tooltip.className = "prog-tooltip";
|
||||||
progKnob.append(tooltip);
|
progKnob.append(tooltip);
|
||||||
|
|
||||||
function updateProgTime() {
|
function updateProgTime(timeOverride) {
|
||||||
const newText = Spicetify.Player.formatTime(Spicetify.Player.getProgress()) + " / " + Spicetify.Player.formatTime(Spicetify.Player.getDuration());
|
const newText = Spicetify.Player.formatTime(timeOverride || Spicetify.Player.getProgress()) + " / " + Spicetify.Player.formatTime(Spicetify.Player.getDuration());
|
||||||
// To reduce DOM Updates when the Song is Paused
|
// To reduce DOM Updates when the Song is Paused
|
||||||
if (tooltip.innerText != newText) tooltip.innerText = newText;
|
if (tooltip.innerText != newText) tooltip.innerText = newText;
|
||||||
|
|
||||||
|
|
@ -172,7 +172,8 @@ waitForElement([".Root__main-view .os-resize-observer-host"], ([resizeHost]) =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const knobPosObserver = new MutationObserver((muts) => {
|
const knobPosObserver = new MutationObserver((muts) => {
|
||||||
updateProgTime();
|
const progressPercentage = Number(getComputedStyle(document.querySelector(".progress-bar")).getPropertyValue("--progress-bar-transform").replace("%", "")) / 100;
|
||||||
|
updateProgTime(Spicetify.Player.getDuration() * progressPercentage);
|
||||||
});
|
});
|
||||||
knobPosObserver.observe(document.querySelector(".progress-bar"), {
|
knobPosObserver.observe(document.querySelector(".progress-bar"), {
|
||||||
attributes: true,
|
attributes: true,
|
||||||
|
|
|
||||||
3
user.css
3
user.css
|
|
@ -457,6 +457,9 @@ html.sidebar-hide-text .GlueDropTarget span {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: var(--spice-text);
|
color: var(--spice-text);
|
||||||
background-color: var(--spice-button);
|
background-color: var(--spice-button);
|
||||||
|
}
|
||||||
|
|
||||||
|
.playback-bar:not(:active) .prog-tooltip {
|
||||||
transition: transform 0.2s ease;
|
transition: transform 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue