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

Function createSlider

Extensions/trashbin.js:29–53  ·  view source on GitHub ↗
(name, desc, defaultVal, callback)

Source from the content-addressed store, hash-verified

27 }
28
29 function createSlider(name, desc, defaultVal, callback) {
30 const container = document.createElement("div");
31 container.classList.add("setting-row");
32 container.innerHTML = `
33 <label class="col description">${desc}</label>
34 <div class="col action"><button class="switch">
35 <svg height="16" width="16" viewBox="0 0 16 16" fill="currentColor">
36 ${Spicetify.SVGIcons.check}
37 </svg>
38 </button></div>
39 `;
40
41 const slider = container.querySelector("button.switch");
42 slider.classList.toggle("disabled", !defaultVal);
43
44 slider.onclick = () => {
45 const state = slider.classList.contains("disabled");
46 slider.classList.toggle("disabled");
47 Spicetify.LocalStorage.set(name, state);
48 console.log(name, state);
49 callback(state);
50 };
51
52 return container;
53 }
54
55 function settingsContent() {
56 // Options

Callers 1

settingsContentFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected