From 0c8106ffefb1455b2c837dfce992099c34dfd90f Mon Sep 17 00:00:00 2001 From: hensm Date: Mon, 8 Aug 2022 15:06:00 +0100 Subject: [PATCH] Remove unnecessary option name attributes + misc cleanup --- ext/src/ui/options/Options.svelte | 27 ++++++++------------------- ext/src/ui/options/styles/index.css | 2 +- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/ext/src/ui/options/Options.svelte b/ext/src/ui/options/Options.svelte index c54881a..5bda111 100644 --- a/ext/src/ui/options/Options.svelte +++ b/ext/src/ui/options/Options.svelte @@ -16,7 +16,7 @@ let formElement: HTMLFormElement; let isFormValid = true; - let showSavedIndicator = false; + let isSavedIndicatorVisible = false; let platform: string; @@ -37,11 +37,10 @@ /** Saves options and show indicator. */ async function onFormSubmit() { formElement.reportValidity(); + if (!opts) return; try { - if (!opts) return; - - // Remove unnecessary prop + // Remove implicit whitelist item props for (const item of opts.siteWhitelist) { if (item.isUserAgentDisabled === false) { delete item.isUserAgentDisabled; @@ -51,9 +50,9 @@ await options.setAll(opts); // 1s long saved indicator - showSavedIndicator = true; + isSavedIndicatorVisible = true; setTimeout(() => { - showSavedIndicator = false; + isSavedIndicatorVisible = false; }, 1000); } catch (err) { logger.error("Failed to save options!"); @@ -69,7 +68,7 @@ } -{#if opts} +{#if opts && platform}
@@ -311,7 +300,7 @@
- {#if showSavedIndicator} + {#if isSavedIndicatorVisible}
{_("optionsSaved")}
diff --git a/ext/src/ui/options/styles/index.css b/ext/src/ui/options/styles/index.css index f8d4652..d94c5c7 100644 --- a/ext/src/ui/options/styles/index.css +++ b/ext/src/ui/options/styles/index.css @@ -399,7 +399,7 @@ button.ghost:not(:hover) { vertical-align: text-top; } -.user-agent-string-custom { +#siteWhitelistCustomUserAgent { width: -moz-available; }