Skip to content

Commit 1282bd0

Browse files
CopilotMyst1cX
andcommitted
Fix: Click library button instead of forcing CSS to ensure correct aria-label
Co-authored-by: Myst1cX <97919309+Myst1cX@users.noreply.github.com>
1 parent 954c1c1 commit 1282bd0

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

spotifuck-v6.user.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,15 @@
159159
libBtn.addEventListener('click', function() {
160160
setTimeout(() => switchLs(), 0);
161161
});
162-
// Collapse library on startup
163-
switchLs(true);
164-
console.log('Library collapsed on startup');
162+
163+
// Collapse library on startup if it's expanded
164+
// Check if button says "Collapse" (meaning library is currently expanded)
165+
if (libBtn.getAttribute('aria-label') === 'Collapse Your Library') {
166+
console.log('Library is expanded on startup, collapsing it...');
167+
// Click the button to let Spotify update its state properly
168+
// This ensures the button will show "Open your library" after collapse
169+
libBtn.click();
170+
}
165171
}
166172
};
167173

@@ -200,8 +206,11 @@
200206
// Only auto-close library if it's NOT a folder
201207
if (!isFolder) {
202208
console.log('AutoCloseLib (playlist/item clicked)');
203-
// Force collapse using switchLs to avoid code duplication
204-
switchLs(true);
209+
// Click the library button to let Spotify update its state properly
210+
// This ensures the button shows "Open your library" after collapse
211+
if (window.lBtn) {
212+
window.lBtn.click();
213+
}
205214
closeNowPlay();
206215
}
207216
});

0 commit comments

Comments
 (0)