default: {
try {
await reloadAccountSelect()
+ document.getElementById('account').value = ''
} catch (err) {
walletSelect.value = ''
console.error(err)
}
async function selectAccount () {
- const accountSelect = document.querySelector('#account')
- const walletId = document.querySelector('#wallet')?.value
+ const accountSelect = document.getElementById('account')
+ const walletId = document.getElementById('wallet')?.value
if (walletId == null || walletId === '') {
accountSelect.value = ''
accountSelect.setAttribute('disabled', '')
accountSelect.removeAttribute('disabled')
if (accountSelect.value === '_new') {
try {
- return await document.querySelector('#account-new').showModal()
+ return await document.getElementById('account-new').showModal()
} catch (err) {
accountSelect.value = ''
console.error(err)
if (!select) {
throw new TypeError(`Select ${id} not found`)
}
- const oldOptions = [select.children].filter(o => o.tagName === 'option')
- for (const oldOption of oldOptions) {
- if (oldOption.value.substring(0, 1) === '_') {
- oldOption.remove()
- }
- }
+ ([...select.children])
+ .filter(o => o.tagName.toLowerCase() === 'option')
+ .filter(o => typeof o.value === 'string')
+ .filter(o => o.value.length > 0)
+ .filter(o => o.value.substring(0, 1) !== '_')
+ .map(o => o.remove())
options.map(o => select.add(new Option(o.text, o.value)))
} catch (err) {
console.error(err)