mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-13 02:49:58 +00:00
Hide advanced options by default and add toggle checkbox
This commit is contained in:
@@ -415,5 +415,9 @@
|
|||||||
"optionsSaved": {
|
"optionsSaved": {
|
||||||
"message": "Saved!",
|
"message": "Saved!",
|
||||||
"description": "Status text displayed by save button once options have been successfully saved."
|
"description": "Status text displayed by save button once options have been successfully saved."
|
||||||
|
},
|
||||||
|
"optionsShowAdvancedOptions": {
|
||||||
|
"message": "Show advanced options",
|
||||||
|
"description": "Show advanced options checkbox label."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export interface Options {
|
|||||||
siteWhitelistEnabled: boolean;
|
siteWhitelistEnabled: boolean;
|
||||||
siteWhitelist: WhitelistItemData[];
|
siteWhitelist: WhitelistItemData[];
|
||||||
siteWhitelistCustomUserAgent: string;
|
siteWhitelistCustomUserAgent: string;
|
||||||
|
showAdvancedOptions: boolean;
|
||||||
|
|
||||||
[key: string]: Options[keyof Options];
|
[key: string]: Options[keyof Options];
|
||||||
}
|
}
|
||||||
@@ -39,5 +40,6 @@ export default {
|
|||||||
receiverSelectorWaitForConnection: true,
|
receiverSelectorWaitForConnection: true,
|
||||||
siteWhitelistEnabled: true,
|
siteWhitelistEnabled: true,
|
||||||
siteWhitelist: [{ pattern: "https://www.netflix.com/*" }],
|
siteWhitelist: [{ pattern: "https://www.netflix.com/*" }],
|
||||||
siteWhitelistCustomUserAgent: ""
|
siteWhitelistCustomUserAgent: "",
|
||||||
|
showAdvancedOptions: false
|
||||||
} as Options;
|
} as Options;
|
||||||
|
|||||||
@@ -68,13 +68,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
opts = JSON.parse(JSON.stringify(defaultOptions));
|
if (!opts) return;
|
||||||
|
|
||||||
|
opts = {
|
||||||
|
...JSON.parse(JSON.stringify(defaultOptions)),
|
||||||
|
// Retain advanced options shown state
|
||||||
|
showAdvancedOptions: opts.showAdvancedOptions
|
||||||
|
};
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if opts}
|
{#if opts}
|
||||||
<form
|
<form
|
||||||
id="form"
|
class="form"
|
||||||
bind:this={formElement}
|
bind:this={formElement}
|
||||||
on:input={onFormInput}
|
on:input={onFormInput}
|
||||||
on:submit|preventDefault={onFormSubmit}
|
on:submit|preventDefault={onFormSubmit}
|
||||||
@@ -102,6 +108,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{#if opts.showAdvancedOptions}
|
||||||
<div class="option option--inline">
|
<div class="option option--inline">
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
<input
|
<input
|
||||||
@@ -117,6 +124,7 @@
|
|||||||
{_("optionsMediaSyncElementDescription")}
|
{_("optionsMediaSyncElementDescription")}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<div class="option option--inline">
|
<div class="option option--inline">
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
@@ -166,6 +174,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
{#if opts.showAdvancedOptions}
|
||||||
<fieldset class="category">
|
<fieldset class="category">
|
||||||
<legend class="category__name">
|
<legend class="category__name">
|
||||||
<h2>{_("optionsMirroringCategoryName")}</h2>
|
<h2>{_("optionsMirroringCategoryName")}</h2>
|
||||||
@@ -186,7 +195,6 @@
|
|||||||
{_("optionsMirroringEnabled")}
|
{_("optionsMirroringEnabled")}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option">
|
||||||
<label class="option__label" for="mirroringAppId">
|
<label class="option__label" for="mirroringAppId">
|
||||||
{_("optionsMirroringAppId")}
|
{_("optionsMirroringAppId")}
|
||||||
@@ -204,7 +212,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if opts.showAdvancedOptions}
|
||||||
<fieldset class="category">
|
<fieldset class="category">
|
||||||
<legend class="category__name">
|
<legend class="category__name">
|
||||||
<h2>{_("optionsReceiverSelectorCategoryName")}</h2>
|
<h2>{_("optionsReceiverSelectorCategoryName")}</h2>
|
||||||
@@ -228,7 +238,9 @@
|
|||||||
{_("optionsReceiverSelectorWaitForConnection")}
|
{_("optionsReceiverSelectorWaitForConnection")}
|
||||||
</label>
|
</label>
|
||||||
<div class="option__description">
|
<div class="option__description">
|
||||||
{_("optionsReceiverSelectorWaitForConnectionDescription")}
|
{_(
|
||||||
|
"optionsReceiverSelectorWaitForConnectionDescription"
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -248,6 +260,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<fieldset class="category">
|
<fieldset class="category">
|
||||||
<legend class="category__name">
|
<legend class="category__name">
|
||||||
@@ -257,6 +270,7 @@
|
|||||||
{_("optionsSiteWhitelistCategoryDescription")}
|
{_("optionsSiteWhitelistCategoryDescription")}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
{#if opts.showAdvancedOptions}
|
||||||
<div class="option option--inline">
|
<div class="option option--inline">
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
<input
|
<input
|
||||||
@@ -277,7 +291,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option">
|
||||||
<label class="option__label" for="siteWhitelistCustomUserAgent">
|
<label
|
||||||
|
class="option__label"
|
||||||
|
for="siteWhitelistCustomUserAgent"
|
||||||
|
>
|
||||||
{_("optionsSiteWhitelistCustomUserAgent")}
|
{_("optionsSiteWhitelistCustomUserAgent")}
|
||||||
</label>
|
</label>
|
||||||
<div class="option__control">
|
<div class="option__control">
|
||||||
@@ -288,10 +305,13 @@
|
|||||||
placeholder={defaultUserAgent}
|
placeholder={defaultUserAgent}
|
||||||
/>
|
/>
|
||||||
<div class="option__description">
|
<div class="option__description">
|
||||||
{_("optionsSiteWhitelistCustomUserAgentDescription")}
|
{_(
|
||||||
|
"optionsSiteWhitelistCustomUserAgentDescription"
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<div class="option">
|
<div class="option">
|
||||||
<div class="option__label">
|
<div class="option__label">
|
||||||
@@ -307,9 +327,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<div id="buttons">
|
<div class="form__footer">
|
||||||
|
<div class="option option--inline">
|
||||||
|
<div class="option__control">
|
||||||
|
<input
|
||||||
|
id="showAdvancedOptions"
|
||||||
|
type="checkbox"
|
||||||
|
bind:checked={opts.showAdvancedOptions}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<label class="option__label" for="showAdvancedOptions">
|
||||||
|
{_("optionsShowAdvancedOptions")}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form__buttons">
|
||||||
{#if isSavedIndicatorVisible}
|
{#if isSavedIndicatorVisible}
|
||||||
<div id="status-line">
|
<div class="form__status-line">
|
||||||
{_("optionsSaved")}
|
{_("optionsSaved")}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -321,5 +355,6 @@
|
|||||||
{_("optionsSave")}
|
{_("optionsSave")}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -183,7 +183,7 @@
|
|||||||
<img src="assets/photon_delete.svg" alt="icon, remove" />
|
<img src="assets/photon_delete.svg" alt="icon, remove" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{#if !isEditingItem}
|
{#if !isEditingItem && opts.showAdvancedOptions}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="whitelist__expand-button ghost"
|
class="whitelist__expand-button ghost"
|
||||||
|
|||||||
@@ -48,23 +48,25 @@ button.ghost:not(:hover) {
|
|||||||
background-color: initial;
|
background-color: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
#form {
|
.form {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
#buttons {
|
.form__footer {
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
align-self: flex-end;
|
display: flex;
|
||||||
margin-block-start: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#buttons > :not(:last-child) {
|
.form__buttons {
|
||||||
margin-inline-end: 5px;
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
gap: 5px;
|
||||||
|
margin-inline-start: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#status-line {
|
.form__status-line {
|
||||||
color: var(--secondary-color);
|
color: var(--secondary-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,7 +230,7 @@ button.ghost:not(:hover) {
|
|||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#form > .category {
|
.form > .category {
|
||||||
border-bottom: 1px solid var(--border-color);
|
border-bottom: 1px solid var(--border-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user