{#if redirect} { browser.tabs.query({ active: true, currentWindow: true }, tabs => { browser.runtime.sendMessage({ message: "redirect", tabId: tabs[0].id }, () => { browser.tabs.update({ url: redirect }, () => { window.close() }) }) }) }} > {/if} {#if service && frontend} {#if _options[frontend].length > 1} {#if switchInstance} browser.tabs.update({ url: switchInstance }, () => { window.close() })} > {/if} { const i = _options[frontend].findIndex(instance => url.href.startsWith(instance)) _options[frontend].splice(i, 1) options.set(_options) const newUrl = await servicesHelper.switchInstance(url, service) browser.tabs.update({ url: newUrl }, () => { window.close() }) }} > {:else} { const i = _options[frontend].findIndex(instance => url.href.startsWith(instance)) _options[frontend].splice(i, 1) options.set(_options) await autoPick() browser.tabs.update({ url: await servicesHelper.switchInstance(url, service) }, () => { window.close() }) }} > { await autoPick() browser.tabs.update({ url: await servicesHelper.switchInstance(url, service) }, () => { window.close() }) }} > {/if} {/if} {#if redirectToOriginal} servicesHelper.copyRaw(url)}> { browser.tabs.query({ active: true, currentWindow: true }, tabs => { browser.runtime.sendMessage({ message: "reverse", tabId: tabs[0].id }, () => { browser.tabs.update({ url: redirectToOriginal }, () => { window.close() }) }) }) }} > {/if} {#if redirect || switchInstance || redirectToOriginal}
{/if} {#if service}
{/if} {#each _options.popupServices as serviceKey} {#if service !== serviceKey} {/if} {/each}
browser.tabs.create({ url: browser.runtime.getURL("pages/options/index.html") }, () => { window.close() })} >