MCPcopy Index your code
hub / github.com/spicetify/cli / createServiceOption

Function createServiceOption

CustomApps/reddit/Settings.js:143–175  ·  view source on GitHub ↗
(id, posCallback, removeCallback)

Source from the content-addressed store, hash-verified

141}
142
143function createServiceOption(id, posCallback, removeCallback) {
144 const container = document.createElement("div");
145 container.dataset.id = id;
146 container.innerHTML = `
147<div class="setting-row">
148 <h3 class="col description">${id}</h3>
149 <div class="col action">
150 <button class="switch small">
151 <svg height="10" width="10" viewBox="0 0 16 16" fill="currentColor">
152 ${Spicetify.SVGIcons["chart-up"]}
153 </svg>
154 </button>
155 <button class="switch small">
156 <svg height="10" width="10" viewBox="0 0 16 16" fill="currentColor">
157 ${Spicetify.SVGIcons["chart-down"]}
158 </svg>
159 </button>
160 <button class="switch small">
161 <svg height="10" width="10" viewBox="0 0 16 16" fill="currentColor">
162 ${Spicetify.SVGIcons.x}
163 </svg>
164 </button>
165 </div>
166</div>`;
167
168 const [up, down, remove] = container.querySelectorAll("button");
169
170 up.onclick = () => posCallback(container, -1);
171 down.onclick = () => posCallback(container, 1);
172 remove.onclick = () => removeCallback(container);
173
174 return container;
175}

Callers 1

openConfigFunction · 0.70

Calls 2

removeCallbackFunction · 0.85
posCallbackFunction · 0.70

Tested by

no test coverage detected