(name, defaultValue, callback)
| 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; |
no outgoing calls
no test coverage detected