A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: winamp theme improvements

+43 -15
+1 -1
_config.ts
··· 23 23 src: "./src", 24 24 server: { 25 25 debugBar: false, 26 - middlewares: [facetHtmlMiddleware], 26 + middlewares: [], // [facetHtmlMiddleware], 27 27 }, 28 28 }); 29 29
+38 -1
src/themes/winamp/facet/index.inline.js
··· 17 17 18 18 /** 19 19 * @import {OutputElement} from "~/components/output/types.d.ts" 20 - * @import {Track} from "~/definitions/types.d.ts" 21 20 */ 22 21 23 22 const audio = await foundation.engine.audio(); ··· 75 74 const repeat = repeatShuffle.repeat(); 76 75 if (amp.store.getState().media.repeat !== repeat) { 77 76 amp.store.dispatch({ type: "TOGGLE_REPEAT" }); 77 + } 78 + }); 79 + 80 + // Sync Diffuse shuffle → webamp 81 + effect(() => { 82 + const shuffle = repeatShuffle.shuffle(); 83 + if (amp.store.getState().media.shuffle !== shuffle) { 84 + amp.store.dispatch({ type: "TOGGLE_SHUFFLE" }); 78 85 } 79 86 }); 80 87 ··· 189 196 */ 190 197 let prevWebampTrack = /** @type {number | null} */ (null); 191 198 let prevWebampRepeat = amp.store.getState().media.repeat; 199 + let prevWebampShuffle = amp.store.getState().media.shuffle; 192 200 let milkdropRandomized = false; 193 201 194 202 amp.store.subscribe(() => { ··· 214 222 repeatShuffle.setRepeat(currentRepeat); 215 223 } 216 224 225 + // Sync webamp shuffle → Diffuse 226 + const currentShuffle = amp.store.getState().media.shuffle; 227 + if (currentShuffle !== prevWebampShuffle) { 228 + prevWebampShuffle = currentShuffle; 229 + repeatShuffle.setShuffle(currentShuffle); 230 + } 231 + 217 232 const currentTrack = amp.store.getState().playlist?.currentTrack; 218 233 if (currentTrack === prevWebampTrack) return; 219 234 prevWebampTrack = currentTrack; ··· 247 262 // DESKTOP 248 263 //////////////////////////////////////////// 249 264 265 + // Intercept Webamp's "load file" or "load dir" behaviours. 266 + // These trigger a hidden <input type="file">.click() internally, so event 267 + // propagation interception alone isn't reliable. Override the prototype 268 + // method to catch it before the file dialog opens. 269 + const _origInputClick = HTMLInputElement.prototype.click; 270 + 271 + HTMLInputElement.prototype.click = function () { 272 + if (this.type === "file") { 273 + window.open( 274 + "l/?path=facets%2Fconnect%2Flocal%2Findex.html", 275 + "_blank", 276 + ); 277 + return; 278 + } 279 + 280 + return _origInputClick.call(this); 281 + }; 282 + 250 283 // Open associated window when click desktop items 251 284 document.body.querySelectorAll(".desktop__item").forEach((element) => { 252 285 if (element instanceof HTMLElement) { ··· 261 294 document.body.querySelector("#desktop-batch")?.addEventListener( 262 295 "dblclick", 263 296 () => { 297 + if (!queue.supplyFingerprint()) { 298 + queue.supply({ trackIds: scopedTracks.tracks().map((t) => t.id) }); 299 + } 300 + 264 301 tracksPromise.promise.then(() => { 265 302 addBatch(); 266 303 });
-4
src/themes/winamp/index.css
··· 17 17 isolation: isolate; 18 18 } 19 19 20 - #webamp #eject { 21 - pointer-events: none; 22 - } 23 - 24 20 #webamp-context-menu { 25 21 z-index: 10000 !important; 26 22 }
+2 -7
src/themes/winamp/webamp/element.js
··· 96 96 97 97 /** */ 98 98 handleLoadListEvent: async () => { 99 - // TODO 100 - return [ 101 - /* Array of Tracks */ 102 - ]; 99 + return []; 103 100 }, 104 101 105 102 /** 106 103 * @param {any} tracks 107 104 */ 108 - handleSaveListEvent: (tracks) => { 109 - // TODO 110 - }, 105 + handleSaveListEvent: (tracks) => {}, 111 106 }); 112 107 } 113 108
+2 -2
src/themes/winamp/webamp/media.js
··· 172 172 173 173 const rawTime = state.currentTime(); 174 174 175 - // Clear seek target once the signal has caught up 176 - if (this._seekTarget !== null && Math.abs(rawTime - this._seekTarget) < 0.5) { 175 + // Clear seek target once the signal has caught up or passed the target 176 + if (this._seekTarget !== null && rawTime > this._seekTarget - 0.5) { 177 177 this._seekTarget = null; 178 178 } 179 179