mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Remove unnecessary option name attributes + misc cleanup
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
let formElement: HTMLFormElement;
|
let formElement: HTMLFormElement;
|
||||||
let isFormValid = true;
|
let isFormValid = true;
|
||||||
let showSavedIndicator = false;
|
let isSavedIndicatorVisible = false;
|
||||||
|
|
||||||
let platform: string;
|
let platform: string;
|
||||||
|
|
||||||
@@ -37,11 +37,10 @@
|
|||||||
/** Saves options and show indicator. */
|
/** Saves options and show indicator. */
|
||||||
async function onFormSubmit() {
|
async function onFormSubmit() {
|
||||||
formElement.reportValidity();
|
formElement.reportValidity();
|
||||||
|
if (!opts) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!opts) return;
|
// Remove implicit whitelist item props
|
||||||
|
|
||||||
// Remove unnecessary prop
|
|
||||||
for (const item of opts.siteWhitelist) {
|
for (const item of opts.siteWhitelist) {
|
||||||
if (item.isUserAgentDisabled === false) {
|
if (item.isUserAgentDisabled === false) {
|
||||||
delete item.isUserAgentDisabled;
|
delete item.isUserAgentDisabled;
|
||||||
@@ -51,9 +50,9 @@
|
|||||||
await options.setAll(opts);
|
await options.setAll(opts);
|
||||||
|
|
||||||
// 1s long saved indicator
|
// 1s long saved indicator
|
||||||
showSavedIndicator = true;
|
isSavedIndicatorVisible = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
showSavedIndicator = false;
|
isSavedIndicatorVisible = false;
|
||||||
}, 1000);
|
}, 1000);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error("Failed to save options!");
|
logger.error("Failed to save options!");
|
||||||
@@ -69,7 +68,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if opts}
|
{#if opts && platform}
|
||||||
<form
|
<form
|
||||||
id="form"
|
id="form"
|
||||||
bind:this={formElement}
|
bind:this={formElement}
|
||||||
@@ -89,7 +88,6 @@
|
|||||||
<div class="option option--inline">
|
<div class="option option--inline">
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
<input
|
<input
|
||||||
name="mediaEnabled"
|
|
||||||
id="mediaEnabled"
|
id="mediaEnabled"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
bind:checked={opts.mediaEnabled}
|
bind:checked={opts.mediaEnabled}
|
||||||
@@ -103,7 +101,6 @@
|
|||||||
<div class="option option--inline">
|
<div class="option option--inline">
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
<input
|
<input
|
||||||
name="mediaSyncElement"
|
|
||||||
id="mediaSyncElement"
|
id="mediaSyncElement"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
bind:checked={opts.mediaSyncElement}
|
bind:checked={opts.mediaSyncElement}
|
||||||
@@ -120,7 +117,6 @@
|
|||||||
<div class="option option--inline">
|
<div class="option option--inline">
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
<input
|
<input
|
||||||
name="mediaStopOnUnload"
|
|
||||||
id="mediaStopOnUnload"
|
id="mediaStopOnUnload"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
bind:checked={opts.mediaStopOnUnload}
|
bind:checked={opts.mediaStopOnUnload}
|
||||||
@@ -136,7 +132,6 @@
|
|||||||
<div class="option option--inline">
|
<div class="option option--inline">
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
<input
|
<input
|
||||||
name="localMediaEnabled"
|
|
||||||
id="localMediaEnabled"
|
id="localMediaEnabled"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
bind:checked={opts.localMediaEnabled}
|
bind:checked={opts.localMediaEnabled}
|
||||||
@@ -156,7 +151,6 @@
|
|||||||
</label>
|
</label>
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
<input
|
<input
|
||||||
name="localMediaServerPort"
|
|
||||||
id="localMediaServerPort"
|
id="localMediaServerPort"
|
||||||
type="number"
|
type="number"
|
||||||
required
|
required
|
||||||
@@ -179,7 +173,6 @@
|
|||||||
<div class="option option--inline">
|
<div class="option option--inline">
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
<input
|
<input
|
||||||
name="mirroringEnabled"
|
|
||||||
id="mirroringEnabled"
|
id="mirroringEnabled"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
bind:checked={opts.mirroringEnabled}
|
bind:checked={opts.mirroringEnabled}
|
||||||
@@ -196,7 +189,6 @@
|
|||||||
</label>
|
</label>
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
<input
|
<input
|
||||||
name="mirroringAppId"
|
|
||||||
id="mirroringAppId"
|
id="mirroringAppId"
|
||||||
type="text"
|
type="text"
|
||||||
required
|
required
|
||||||
@@ -220,7 +212,6 @@
|
|||||||
<div class="option option--inline">
|
<div class="option option--inline">
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
<input
|
<input
|
||||||
name="receiverSelectorWaitForConnection"
|
|
||||||
id="receiverSelectorWaitForConnection"
|
id="receiverSelectorWaitForConnection"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
bind:checked={opts.receiverSelectorWaitForConnection}
|
bind:checked={opts.receiverSelectorWaitForConnection}
|
||||||
@@ -240,7 +231,6 @@
|
|||||||
<div class="option option--inline">
|
<div class="option option--inline">
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
<input
|
<input
|
||||||
name="receiverSelectorCloseIfFocusLost"
|
|
||||||
id="receiverSelectorCloseIfFocusLost"
|
id="receiverSelectorCloseIfFocusLost"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
bind:checked={opts.receiverSelectorCloseIfFocusLost}
|
bind:checked={opts.receiverSelectorCloseIfFocusLost}
|
||||||
@@ -266,7 +256,6 @@
|
|||||||
<div class="option option--inline">
|
<div class="option option--inline">
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
<input
|
<input
|
||||||
name="siteWhitelistEnabled"
|
|
||||||
id="siteWhitelistEnabled"
|
id="siteWhitelistEnabled"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
bind:checked={opts.siteWhitelistEnabled}
|
bind:checked={opts.siteWhitelistEnabled}
|
||||||
@@ -289,8 +278,8 @@
|
|||||||
</label>
|
</label>
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
<input
|
<input
|
||||||
|
id="siteWhitelistCustomUserAgent"
|
||||||
type="text"
|
type="text"
|
||||||
class="user-agent-string-custom"
|
|
||||||
bind:value={opts.siteWhitelistCustomUserAgent}
|
bind:value={opts.siteWhitelistCustomUserAgent}
|
||||||
placeholder={getChromeUserAgent(platform)}
|
placeholder={getChromeUserAgent(platform)}
|
||||||
/>
|
/>
|
||||||
@@ -311,7 +300,7 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<div id="buttons">
|
<div id="buttons">
|
||||||
{#if showSavedIndicator}
|
{#if isSavedIndicatorVisible}
|
||||||
<div id="status-line">
|
<div id="status-line">
|
||||||
{_("optionsSaved")}
|
{_("optionsSaved")}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ button.ghost:not(:hover) {
|
|||||||
vertical-align: text-top;
|
vertical-align: text-top;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-agent-string-custom {
|
#siteWhitelistCustomUserAgent {
|
||||||
width: -moz-available;
|
width: -moz-available;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user