|
10 | 10 | let list;
|
11 | 11 | let hiddenList;
|
12 | 12 |
|
13 |
| - let isYLX; |
14 | 13 | let YLXSidebarState = 0;
|
15 | 14 |
|
16 | 15 | // Store sidebar buttons
|
|
56 | 55 | function writeStorage() {
|
57 | 56 | const array = ordered.map((a) => [a[0].dataset.id, a[1]]);
|
58 | 57 |
|
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)); |
61 | 59 | }
|
62 | 60 |
|
63 | 61 | const container = document.createElement("div");
|
@@ -114,10 +112,8 @@ color: var(--spice-button-disabled);
|
114 | 112 | appendItems();
|
115 | 113 | }
|
116 | 114 |
|
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(); |
121 | 117 |
|
122 | 118 | document.documentElement.style.setProperty("--nav-bar-width", "280px");
|
123 | 119 |
|
@@ -155,16 +151,14 @@ color: var(--spice-button-disabled);
|
155 | 151 | for (const a of ordered) {
|
156 | 152 | a[0].onmouseover = undefined;
|
157 | 153 | }
|
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 | + ); |
168 | 162 | writeStorage();
|
169 | 163 | }
|
170 | 164 |
|
@@ -209,7 +203,6 @@ color: var(--spice-button-disabled);
|
209 | 203 | appItems = YLXAppItems;
|
210 | 204 | buttons = [];
|
211 | 205 | ordered = [];
|
212 |
| - isYLX = true; |
213 | 206 |
|
214 | 207 | appItems.id = "spicetify-sticky-list";
|
215 | 208 | // SHOW container
|
@@ -251,19 +244,6 @@ color: var(--spice-button-disabled);
|
251 | 244 |
|
252 | 245 | initConfig();
|
253 | 246 |
|
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 |
| - |
267 | 247 | const customButtonStyle = document.createElement("style");
|
268 | 248 | customButtonStyle.innerHTML = `
|
269 | 249 | div.GlueDropTarget.personal-library {
|
|
0 commit comments