MCPcopy Create free account
hub / github.com/spicetify/cli / createButton

Function createButton

Extensions/popupLyrics.js:1146–1174  ·  view source on GitHub ↗
(name, defaultValue, callback)

Source from the content-addressed store, hash-verified

1144 }
1145 // if name is null, the element can be used without a description.
1146 function createButton(name, defaultValue, callback) {
1147 let container;
1148
1149 if (name) {
1150 container = document.createElement("div");
1151 container.innerHTML = `
1152 <div class="setting-row">
1153 <label class="col description">${name}</label>
1154 <div class="col action">
1155 <button id="popup-lyrics-clickbutton" class="btn">${defaultValue}</button>
1156 </div>
1157 </div>`;
1158
1159 const button = container.querySelector("#popup-lyrics-clickbutton");
1160 button.onclick = () => {
1161 callback();
1162 };
1163 } else {
1164 container = document.createElement("button");
1165 container.innerHTML = defaultValue;
1166 container.className = "btn ";
1167
1168 container.onclick = () => {
1169 callback();
1170 };
1171 }
1172
1173 return container;
1174 }
1175 // if name is null, the element can be used without a description.
1176 function createTextfield(name, defaultValue, placeholder, callback) {
1177 let container;

Callers 2

openConfigFunction · 0.70
musixmatchTokenElementsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected