| 222 | } |
| 223 | |
| 224 | #doSettings(version) { |
| 225 | const iVer = parseInt(version) |
| 226 | const fullKey = `game_settings_${version}` |
| 227 | const node = document.createElement('div') |
| 228 | node.innerHTML = [ |
| 229 | '<i18n-text class="inset-block-header" data-key="user_pref_title_game_settings"></i18n-text>', |
| 230 | '<i18n-text class="inset-block-blurb-option mb-3" data-key="user_pref_blurb_game_settings"></i18n-text>', |
| 231 | '<div class="row inset-block-lined-row">', |
| 232 | '<div class="col"><i18n-text data-key="wizard_current"></i18n-text></div>', |
| 233 | '<div class="col-auto fst-italic small current_game_settings"></div>', |
| 234 | '</div>', |
| 235 | '<div class="found_settings"></div>', |
| 236 | ].join('') |
| 237 | |
| 238 | const buttons = node.querySelector('.found_settings') |
| 239 | |
| 240 | const updater = () => { |
| 241 | window.settings.get(fullKey).then((value) => { |
| 242 | buttons.innerHTML = '' |
| 243 | node.querySelector('.current_game_settings').textContent = value !== '' ? value : '--' |
| 244 | |
| 245 | if ( this.wizard.settings[iVer].length === 0 ) { |
| 246 | buttons.appendChild(I18N.__('wizard_step_4_fail_settings', ['text-center', 'd-block'])) |
| 247 | } else { |
| 248 | for ( const setPath of this.wizard.settings[iVer] ) { |
| 249 | buttons.appendChild(this.#doButton( |
| 250 | fullKey, |
| 251 | setPath, |
| 252 | value |
| 253 | )) |
| 254 | } |
| 255 | } |
| 256 | }) |
| 257 | } |
| 258 | |
| 259 | this.update.push(updater) |
| 260 | return node |
| 261 | } |
| 262 | |
| 263 | #doSwitch(key, keyOver = null, size = 2) { |
| 264 | const i18nKey = keyOver !== null ? keyOver : key |