mirror of
https://github.com/meowarex/TidaLuna-Plugins.git
synced 2026-06-18 03:43:10 +10:00
Improved Logic
This commit is contained in:
@@ -100,11 +100,11 @@ observe<HTMLElement>(unloads, '[data-test="footer-player"]', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// MARKER: Quality-Based Seeker Color
|
// MARKER: Quality-Based Seeker Color
|
||||||
// Colors for the quality tier (Max, High, Low)
|
// Maps data-test-media-state-indicator-streaming-quality values to colors
|
||||||
const qualityColors: Record<string, string> = {
|
const qualityColors: Record<string, string> = {
|
||||||
Max: "#ffd432",
|
HI_RES_LOSSLESS: "#ffd432", //Max
|
||||||
High: "#3fe",
|
LOSSLESS: "#3fe", //High
|
||||||
Low: "#FFFFFF",
|
HIGH: "#FFFFFF", //Low
|
||||||
};
|
};
|
||||||
|
|
||||||
const applyQualityProgressColor = (): void => {
|
const applyQualityProgressColor = (): void => {
|
||||||
@@ -113,20 +113,21 @@ const applyQualityProgressColor = (): void => {
|
|||||||
) as HTMLElement | null;
|
) as HTMLElement | null;
|
||||||
if (!progressIndicator) return;
|
if (!progressIndicator) return;
|
||||||
|
|
||||||
// Reset to white (for when the setting gets disabled)
|
// Remove inline style if disabled
|
||||||
if (!settings.qualityProgressColor) {
|
if (!settings.qualityProgressColor) {
|
||||||
progressIndicator.style.setProperty("background-color", "#FFFFFF", "important");
|
progressIndicator.style.removeProperty("background-color");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the media-state tag (Max, High, Low)
|
// Read quality from the media-state tag
|
||||||
|
// (using data-test-media-state-indicator-streaming-quality)
|
||||||
const qualityButton = document.querySelector(
|
const qualityButton = document.querySelector(
|
||||||
'[data-test="media-state-max"], [data-test="media-state-high"], [data-test="media-state-low"]',
|
"[data-test-media-state-indicator-streaming-quality]",
|
||||||
) as HTMLElement | null;
|
) as HTMLElement | null;
|
||||||
if (!qualityButton) return;
|
if (!qualityButton) return;
|
||||||
|
|
||||||
const qualityText = qualityButton.textContent?.trim() ?? "";
|
const quality = qualityButton.getAttribute("data-test-media-state-indicator-streaming-quality") ?? "";
|
||||||
const color = qualityColors[qualityText];
|
const color = qualityColors[quality];
|
||||||
if (!color) return;
|
if (!color) return;
|
||||||
|
|
||||||
progressIndicator.style.setProperty("background-color", color, "important");
|
progressIndicator.style.setProperty("background-color", color, "important");
|
||||||
|
|||||||
Reference in New Issue
Block a user