Prevent Tidal CSS Removal when CoverEverywhere is Disabled

This commit is contained in:
2025-06-04 21:18:26 +10:00
parent 2d31a0c685
commit 8282179c0d
+18 -4
View File
@@ -21,8 +21,7 @@ const baseStyleTag = new StyleTag("RadiantLyrics-base", unloads);
const playerBarStyleTag = new StyleTag("RadiantLyrics-player-bar", unloads); const playerBarStyleTag = new StyleTag("RadiantLyrics-player-bar", unloads);
const lyricsGlowStyleTag = new StyleTag("RadiantLyrics-lyrics-glow", unloads); const lyricsGlowStyleTag = new StyleTag("RadiantLyrics-lyrics-glow", unloads);
// StyleTag for global spinning background CSS let globalSpinningBgStyleTag: StyleTag | null = null;
const globalSpinningBgStyleTag = new StyleTag("RadiantLyrics-global-spinning-bg", unloads, coverEverywhereCss);
// Apply lyrics glow styles if enabled // Apply lyrics glow styles if enabled
if (settings.lyricsGlowEnabled) { if (settings.lyricsGlowEnabled) {
@@ -75,9 +74,24 @@ const updateRadiantLyricsStyles = function(): void {
// Function to apply spinning background to the entire app // Function to apply spinning background to the entire app
const applyGlobalSpinningBackground = (albumImageSrc: string): void => { const applyGlobalSpinningBackground = (albumImageSrc: string): void => {
if (!settings.spinningCoverEverywhere) return;
const appContainer = document.querySelector('[data-test="main"]') as HTMLElement; const appContainer = document.querySelector('[data-test="main"]') as HTMLElement;
if (!settings.spinningCoverEverywhere) {
// Remove StyleTag and all background elements
if (globalSpinningBgStyleTag) {
globalSpinningBgStyleTag.remove();
globalSpinningBgStyleTag = null;
}
if (appContainer) {
appContainer.querySelectorAll('.global-spinning-image, .global-spinning-black-bg').forEach(el => el.remove());
}
return;
}
// Add StyleTag if not present
if (!globalSpinningBgStyleTag) {
globalSpinningBgStyleTag = new StyleTag("RadiantLyrics-global-spinning-bg", unloads, coverEverywhereCss);
}
if (!appContainer) return; if (!appContainer) return;
// Remove any existing background elements // Remove any existing background elements