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