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>'
|
checklist.innerHTML = '<div class="some-block option-block">No instances found.</div>'
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
const instances = redirects[frontend][network]
|
const instances = redirects[frontend][network]
|
||||||
if (!instances || instances.length === 0) continue
|
if (!instances || instances.length === 0) continue
|
||||||
|
|
||||||
|
@ -197,7 +198,9 @@ function createList(frontend, networks, document, redirects, blacklist) {
|
||||||
.placeholder = redirects[frontend].clearnet[0]
|
.placeholder = redirects[frontend].clearnet[0]
|
||||||
|
|
||||||
const sortedInstances = instances
|
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
|
const content = sortedInstances
|
||||||
.map(x => {
|
.map(x => {
|
||||||
|
@ -231,14 +234,9 @@ function createList(frontend, networks, document, redirects, blacklist) {
|
||||||
checklist.getElementsByClassName(`add-${instance}`)[0]
|
checklist.getElementsByClassName(`add-${instance}`)[0]
|
||||||
.addEventListener("click", async () => {
|
.addEventListener("click", async () => {
|
||||||
let options = await utils.getOptions()
|
let options = await utils.getOptions()
|
||||||
let customInstances = options[frontend]
|
if (!options[frontend].includes(instance)) {
|
||||||
if (!customInstances.includes(instance)) {
|
options[frontend].push(instance)
|
||||||
customInstances.push(instance)
|
browser.storage.local.set({ options }, () => calcCustomInstances(frontend))
|
||||||
options = await utils.getOptions()
|
|
||||||
options[frontend] = customInstances
|
|
||||||
browser.storage.local.set({options}, () => {
|
|
||||||
calcCustomInstances(frontend)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue