MCPcopy Create free account
hub / github.com/FSGModding/FSG_Mod_Assistant / #doButton

Method #doButton

renderer/renderJS/setup_ui.js:160–183  ·  view source on GitHub ↗
(key, newValue, curValue, extraText = '')

Source from the content-addressed store, hash-verified

158 }
159
160 #doButton(key, newValue, curValue, extraText = '') {
161 const node = document.createElement('div')
162 node.classList.add('row', 'mt-1')
163
164 const buttonColor = newValue === curValue ? 'success btn-thumb-up' : 'outline-secondary btn-check-mark'
165 const buttonText = newValue === curValue ? 'wizard_using_this' : 'wizard_use_this'
166
167 node.innerHTML = [
168 extraText !== '' ? `<div class="col-1 align-self-center">${extraText}</div>` : '',
169 `<div class="col-${extraText !== '' ? '8' : '9'} align-self-center small">${newValue}</div>`,
170 `<div class="col-3"><button class="btn btn-${buttonColor} w-100"><i18n-text data-key="${buttonText}"></i18n-text></button></div>`,
171 ].join('')
172
173 if ( newValue !== curValue ) {
174 node.querySelector('button').addEventListener('click', () => {
175 window.settings.set(key, newValue).then(() => {
176 this.forceUpdate()
177 })
178 })
179 } else {
180 node.querySelector('button').disabled = true
181 }
182 return node
183 }
184
185 #doPath(version) {
186 const iVer = parseInt(version)

Callers 1

updaterMethod · 0.95

Calls 4

forceUpdateMethod · 0.95
setMethod · 0.80
addMethod · 0.45
addEventListenerMethod · 0.45

Tested by

no test coverage detected