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

Method #doSwitch

renderer/renderJS/setup_ui.js:263–278  ·  view source on GitHub ↗
(key, keyOver = null, size = 2)

Source from the content-addressed store, hash-verified

261 }
262
263 #doSwitch(key, keyOver = null, size = 2) {
264 const i18nKey = keyOver !== null ? keyOver : key
265 const node = document.createElement('div')
266 node.innerHTML = [
267 `<i18n-text class="inset-block-header" data-key="user_pref_title_${i18nKey}"></i18n-text>`,
268 '<div class="row">',
269 `<i18n-text class="inset-block-blurb-option col-${12-size}" data-key="user_pref_blurb_${i18nKey}"></i18n-text>`,
270 `<div class="col-${size} form-switch custom-switch">`,
271 '<input class="form-check-input" type="checkbox" role="switch">',
272 '</div></div>',
273 ].join('')
274 const input = node.querySelector('input')
275 input.addEventListener('change', () => { this.inputs[key].set(input) })
276 this.update.push(() => { this.inputs[key].update(input) })
277 return node
278 }
279
280 #doSpecial(key) {
281 const node = document.createElement('div')

Callers 1

initMethod · 0.95

Calls 3

setMethod · 0.80
addEventListenerMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected