Fixed bug in RedirectType in settings

This commit is contained in:
ManeraKai 2023-03-06 18:46:55 +03:00
parent e3474b4b96
commit ec1b517639
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
1 changed files with 16 additions and 13 deletions

View File

@ -41,19 +41,22 @@ async function changeFrontendsSettings(service) {
} }
} }
} }
if (config.services[service].frontends[divs[service].frontend.value].embeddable) { if (document.getElementById(`${service}-redirectType`)) {
document.getElementById(`${service}-redirectType`).innerHTML = ` const frontend = options[service].frontend ?? Object.keys(config.services[service].frontends)[0]
<option value="both" data-localise="__MSG_both__">both</options> if (config.services[service].frontends[frontend].embeddable) {
<option value="sub_frame" data-localise="__MSG_onlyEmbedded__">Only Embedded</option> document.getElementById(`${service}-redirectType`).innerHTML = `
<option value="main_frame" data-localise="__MSG_onlyNotEmbedded__">Only Not Embedded</option> <option value="both" data-localise="__MSG_both__">both</options>
` <option value="sub_frame" data-localise="__MSG_onlyEmbedded__">Only Embedded</option>
document.getElementById(`${service}-redirectType`).value = options[divs[service].frontend.value].redirectType = options[service].redirectType <option value="main_frame" data-localise="__MSG_onlyNotEmbedded__">Only Not Embedded</option>
} else { `
document.getElementById(`${service}-redirectType`).innerHTML = ` document.getElementById(`${service}-redirectType`).value = options[frontend].redirectType = options[service].redirectType
<option value="main_frame" data-localise="__MSG_onlyNotEmbedded__">Only Not Embedded</option> } else {
` document.getElementById(`${service}-redirectType`).innerHTML = `
options[service].redirectType = "main_frame" <option value="main_frame" data-localise="__MSG_onlyNotEmbedded__">Only Not Embedded</option>
browser.storage.local.set({ options }) `
options[service].redirectType = "main_frame"
browser.storage.local.set({ options })
}
} }
const frontend_name_element = document.getElementById(`${service}_page`).getElementsByClassName("frontend_name")[0] const frontend_name_element = document.getElementById(`${service}_page`).getElementsByClassName("frontend_name")[0]
if (divs[service].frontend) { if (divs[service].frontend) {