small tweak
This commit is contained in:
parent
b4e76fc4b6
commit
6df1197bd1
|
@ -189,6 +189,7 @@ function createList(frontend, networks, document, redirects, blacklist) {
|
|||
checklist.innerHTML = '<div class="some-block option-block">No instances found.</div>'
|
||||
break
|
||||
}
|
||||
|
||||
const instances = redirects[frontend][network]
|
||||
if (!instances || instances.length === 0) continue
|
||||
|
||||
|
@ -197,7 +198,9 @@ function createList(frontend, networks, document, redirects, blacklist) {
|
|||
.placeholder = redirects[frontend].clearnet[0]
|
||||
|
||||
const sortedInstances = instances
|
||||
.sort((a, b) => (blacklist.cloudflare.includes(a) && !blacklist.cloudflare.includes(b)))
|
||||
.sort((a, b) => {
|
||||
return (blacklist.cloudflare.includes(a) && !blacklist.cloudflare.includes(b))
|
||||
})
|
||||
|
||||
const content = sortedInstances
|
||||
.map(x => {
|
||||
|
@ -231,14 +234,9 @@ function createList(frontend, networks, document, redirects, blacklist) {
|
|||
checklist.getElementsByClassName(`add-${instance}`)[0]
|
||||
.addEventListener("click", async () => {
|
||||
let options = await utils.getOptions()
|
||||
let customInstances = options[frontend]
|
||||
if (!customInstances.includes(instance)) {
|
||||
customInstances.push(instance)
|
||||
options = await utils.getOptions()
|
||||
options[frontend] = customInstances
|
||||
browser.storage.local.set({options}, () => {
|
||||
calcCustomInstances(frontend)
|
||||
})
|
||||
if (!options[frontend].includes(instance)) {
|
||||
options[frontend].push(instance)
|
||||
browser.storage.local.set({ options }, () => calcCustomInstances(frontend))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue