diff --git a/src/background.ts b/src/background.ts index 22787b8..f1a72a4 100644 --- a/src/background.ts +++ b/src/background.ts @@ -29,6 +29,7 @@ let ports: { [key: number]: Runtime.Port } = {}; const responseMap: Map = new Map(); var serverUrl: RequestInfo; var renderingsPanel: browser.Windows.Window | browser.Tabs.Tab; +var errorPanel: browser.Windows.Window | browser.Tabs.Tab; let launchPad : browser.Windows.Window | browser.Tabs.Tab; var graphicUrl: string = ""; var extVersion = process.env.NODE_ENV; @@ -197,13 +198,15 @@ async function handleMessage(p: Runtime.Port, message: any) { "body": JSON.stringify(query) }); windowsPanel ? browser.windows.remove(progressWindow.id!) : browser.tabs.remove(progressWindow.id!); + // close existing error panel if it exists + windowsPanel ? (errorPanel && browser.windows.remove(errorPanel.id!)) : (errorPanel && browser.tabs.remove(errorPanel.id!)); if (resp.ok) { json = await resp.json(); } else { - windowsPanel ? browser.windows.create({ + errorPanel = windowsPanel ? await browser.windows.create({ type: "panel", url: "errors/http_error.html" - }) : browser.tabs.create({ + }) : await browser.tabs.create({ url: "errors/http_error.html", }); console.error(`HTTP Error ${resp.status}: ${resp.statusText}`); @@ -213,10 +216,12 @@ async function handleMessage(p: Runtime.Port, message: any) { } } catch { windowsPanel ? browser.windows.remove(progressWindow.id!) : browser.tabs.remove(progressWindow.id!); - windowsPanel ? browser.windows.create({ + // close existing error panel if it exists + windowsPanel ? (errorPanel && browser.windows.remove(errorPanel.id!)) : (errorPanel && browser.tabs.remove(errorPanel.id!)); + errorPanel = windowsPanel ? await browser.windows.create({ type: "panel", url: "errors/http_error.html" - }) : browser.tabs.create({ + }) : await browser.tabs.create({ url: "errors/http_error.html", }); return; @@ -811,6 +816,7 @@ browser.contextMenus.onClicked.addListener((info, tab) => { } } else { console.error("No tab passed to context menu listener!"); + windowsPanel ? (errorPanel && browser.windows.remove(errorPanel.id!)) : (errorPanel && browser.tabs.remove(errorPanel.id!)); windowsPanel ? browser.windows.create({ type: "panel", url: "errors/http_error.html" diff --git a/src/options/options.css b/src/options/options.css index c74176e..b4afd2d 100644 --- a/src/options/options.css +++ b/src/options/options.css @@ -241,4 +241,16 @@ padding: 1rem; border: 2px solid lightgrey; margin: 0.5rem 0rem; - } \ No newline at end of file + } + +/* High contrast mode support */ +@media (forced-colors: active) { + .slider { + background-color: Canvas; + border: 1px solid CanvasText; + forced-color-adjust: none; + } + .slider::before { + background-color: CanvasText; + } +} diff --git a/src/options/options.ts b/src/options/options.ts index e287dbf..c2562e5 100644 --- a/src/options/options.ts +++ b/src/options/options.ts @@ -80,6 +80,7 @@ function optionsCheck(){ alertMessage = browser.i18n.getMessage("perferencesSaved"); } announcer!.textContent = alertMessage; + window.alert(alertMessage) setTimeout(() => { announcer!.textContent = ''; }, 1000);