MCPcopy
hub / github.com/spicetify/cli / apply

Method apply

Extensions/bookmark.js:36–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34 }
35
36 apply() {
37 this.items.textContent = ""; // Remove all childs
38 this.items.append(createMenuItem("Current page", storeThisPage));
39 this.items.append(createMenuItem("Track", storeTrack));
40 this.items.append(createMenuItem("Track with timestamp", storeTrackWithTime));
41
42 const select = createSortSelect(this.filter);
43 select.onchange = (event) => {
44 this.filter = event.srcElement.selectedIndex;
45 this.apply();
46 };
47 this.items.append(select);
48
49 const collection = this.getStorage();
50 for (const item of collection) {
51 if (this.filter !== 0) {
52 const isTrack = this.isTrack(item.uri);
53 if (this.filter === 1 && isTrack) continue;
54 if (this.filter === 2 && !isTrack) continue;
55 }
56
57 this.items.append(new CardContainer(item));
58 }
59 }
60
61 isTrack(uri) {
62 return uri.startsWith("spotify:track:") || uri.startsWith("spotify:episode:");

Callers 4

constructorMethod · 0.95
addToStorageMethod · 0.95
removeFromStorageMethod · 0.95

Calls 4

getStorageMethod · 0.95
isTrackMethod · 0.95
createSortSelectFunction · 0.85
createMenuItemFunction · 0.70

Tested by

no test coverage detected