Skip to content

Commit 9d02e7f

Browse files
committed
fix(sidebarConfig): remove remaining legacy stuff
1 parent e108fac commit 9d02e7f

File tree

1 file changed

+11
-31
lines changed

1 file changed

+11
-31
lines changed

jsHelper/sidebarConfig.js

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
let list;
1111
let hiddenList;
1212

13-
let isYLX;
1413
let YLXSidebarState = 0;
1514

1615
// Store sidebar buttons
@@ -56,8 +55,7 @@
5655
function writeStorage() {
5756
const array = ordered.map((a) => [a[0].dataset.id, a[1]]);
5857

59-
if (isYLX) return localStorage.setItem("spicetify-sidebar-config:ylx", JSON.stringify(array));
60-
return localStorage.setItem("spicetify-sidebar-config", JSON.stringify(array));
58+
return localStorage.setItem("spicetify-sidebar-config:ylx", JSON.stringify(array));
6159
}
6260

6361
const container = document.createElement("div");
@@ -114,10 +112,8 @@ color: var(--spice-button-disabled);
114112
appendItems();
115113
}
116114

117-
if (isYLX) {
118-
YLXSidebarState = Spicetify.Platform.LocalStorageAPI.getItem("ylx-sidebar-state");
119-
if (YLXSidebarState === 1) document.querySelector(".main-yourLibraryX-collapseButton > button")?.click();
120-
}
115+
YLXSidebarState = Spicetify.Platform.LocalStorageAPI.getItem("ylx-sidebar-state");
116+
if (YLXSidebarState === 1) document.querySelector(".main-yourLibraryX-collapseButton > button")?.click();
121117

122118
document.documentElement.style.setProperty("--nav-bar-width", "280px");
123119

@@ -155,16 +151,14 @@ color: var(--spice-button-disabled);
155151
for (const a of ordered) {
156152
a[0].onmouseover = undefined;
157153
}
158-
if (isYLX) {
159-
if (YLXSidebarState === 1) document.querySelector(".main-yourLibraryX-collapseButton > button")?.click();
160-
else
161-
document.documentElement.style.setProperty(
162-
"--nav-bar-width",
163-
`${Spicetify.Platform.LocalStorageAPI.getItem(
164-
YLXSidebarState === 2 ? "ylx-expanded-state-nav-bar-width" : "ylx-default-state-nav-bar-width"
165-
)}px`
166-
);
167-
} else document.documentElement.style.setProperty("--nav-bar-width", `${Spicetify.Platform.LocalStorageAPI.getItem("nav-bar-width")}px`);
154+
if (YLXSidebarState === 1) document.querySelector(".main-yourLibraryX-collapseButton > button")?.click();
155+
else
156+
document.documentElement.style.setProperty(
157+
"--nav-bar-width",
158+
`${Spicetify.Platform.LocalStorageAPI.getItem(
159+
YLXSidebarState === 2 ? "ylx-expanded-state-nav-bar-width" : "ylx-default-state-nav-bar-width"
160+
)}px`
161+
);
168162
writeStorage();
169163
}
170164

@@ -209,7 +203,6 @@ color: var(--spice-button-disabled);
209203
appItems = YLXAppItems;
210204
buttons = [];
211205
ordered = [];
212-
isYLX = true;
213206

214207
appItems.id = "spicetify-sticky-list";
215208
// SHOW container
@@ -251,19 +244,6 @@ color: var(--spice-button-disabled);
251244

252245
initConfig();
253246

254-
// Rearrange sidebar when dynamically switching in Experimental Features
255-
new MutationObserver((mutations) => {
256-
for (const mutation of mutations) {
257-
if (mutation.attributeName === "class") {
258-
if (mutation.target.classList.contains("hasYLXSidebar") || !!mutation.target.querySelector(".main-yourLibraryX-entryPoints")) {
259-
InitSidebarXConfig();
260-
} else {
261-
InitSidebarConfig();
262-
}
263-
}
264-
}
265-
}).observe(sidebar, { childList: true, attributes: true, attributeFilter: ["class"] });
266-
267247
const customButtonStyle = document.createElement("style");
268248
customButtonStyle.innerHTML = `
269249
div.GlueDropTarget.personal-library {

0 commit comments

Comments
 (0)