Added arrow icon to dropdowns. Added settings button to each service in the popup https://github.com/libredirect/browser_extension/issues/961
This commit is contained in:
parent
ef9b247a91
commit
6bd542f858
@ -1,10 +1,13 @@
|
|||||||
<svg
|
<svg
|
||||||
|
{...$$restProps}
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
height="24px"
|
height="24px"
|
||||||
width="24px"
|
width="24px"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
preserveAspectRatio="xMinYMin meet"
|
preserveAspectRatio="xMinYMin meet"
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
|
on:click
|
||||||
|
on:keydown={null}
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
d="m9.25 22-.4-3.2q-.325-.125-.612-.3-.288-.175-.563-.375L4.7 19.375l-2.75-4.75 2.575-1.95Q4.5 12.5 4.5 12.337v-.675q0-.162.025-.337L1.95 9.375l2.75-4.75 2.975 1.25q.275-.2.575-.375.3-.175.6-.3l.4-3.2h5.5l.4 3.2q.325.125.613.3.287.175.562.375l2.975-1.25 2.75 4.75-2.575 1.95q.025.175.025.337v.675q0 .163-.05.338l2.575 1.95-2.75 4.75-2.95-1.25q-.275.2-.575.375-.3.175-.6.3l-.4 3.2Zm2.8-6.5q1.45 0 2.475-1.025Q15.55 13.45 15.55 12q0-1.45-1.025-2.475Q13.5 8.5 12.05 8.5q-1.475 0-2.488 1.025Q8.55 10.55 8.55 12q0 1.45 1.012 2.475Q10.575 15.5 12.05 15.5Z"
|
d="m9.25 22-.4-3.2q-.325-.125-.612-.3-.288-.175-.563-.375L4.7 19.375l-2.75-4.75 2.575-1.95Q4.5 12.5 4.5 12.337v-.675q0-.162.025-.337L1.95 9.375l2.75-4.75 2.975 1.25q.275-.2.575-.375.3-.175.6-.3l.4-3.2h5.5l.4 3.2q.325.125.613.3.287.175.562.375l2.975-1.25 2.75 4.75-2.575 1.95q.025.175.025.337v.675q0 .163-.05.338l2.575 1.95-2.75 4.75-2.95-1.25q-.275.2-.575.375-.3.175-.6.3l-.4 3.2Zm2.8-6.5q1.45 0 2.475-1.025Q15.55 13.45 15.55 12q0-1.45-1.025-2.475Q13.5 8.5 12.05 8.5q-1.475 0-2.488 1.025Q8.55 10.55 8.55 12q0 1.45 1.012 2.475Q10.575 15.5 12.05 15.5Z"
|
||||||
|
Before Width: | Height: | Size: 732 B After Width: | Height: | Size: 782 B |
@ -2,12 +2,13 @@
|
|||||||
const browser = window.browser || window.chrome
|
const browser = window.browser || window.chrome
|
||||||
|
|
||||||
import General from "./General/General.svelte"
|
import General from "./General/General.svelte"
|
||||||
|
import url from './url'
|
||||||
import utils from "../../assets/javascripts/utils.js"
|
import utils from "../../assets/javascripts/utils.js"
|
||||||
import { onDestroy } from "svelte"
|
import { onDestroy } from "svelte"
|
||||||
import servicesHelper from "../../assets/javascripts/services.js"
|
import servicesHelper from "../../assets/javascripts/services.js"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import Sidebar from "./Sidebar.svelte"
|
import Sidebar from "./Sidebar.svelte"
|
||||||
import { options, config, page } from "./stores"
|
import { options, config } from "./stores"
|
||||||
import Services from "./Services/Services.svelte"
|
import Services from "./Services/Services.svelte"
|
||||||
|
|
||||||
let _options
|
let _options
|
||||||
@ -36,9 +37,6 @@
|
|||||||
config.set(await utils.getConfig())
|
config.set(await utils.getConfig())
|
||||||
})
|
})
|
||||||
|
|
||||||
let _page
|
|
||||||
page.subscribe(val => (_page = val))
|
|
||||||
|
|
||||||
const dark = {
|
const dark = {
|
||||||
text: "#fff",
|
text: "#fff",
|
||||||
bgMain: "#121212",
|
bgMain: "#121212",
|
||||||
@ -85,9 +83,9 @@
|
|||||||
--light-grey: {cssVariables.lightGrey};"
|
--light-grey: {cssVariables.lightGrey};"
|
||||||
>
|
>
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
{#if _page == "general"}
|
{#if !$url.hash || $url.hash == "#general"}
|
||||||
<General />
|
<General />
|
||||||
{:else if _page == "services"}
|
{:else if $url.hash.startsWith("#services")}
|
||||||
<Services />
|
<Services />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
const browser = window.browser || window.chrome
|
const browser = window.browser || window.chrome
|
||||||
|
|
||||||
|
import url from "../url"
|
||||||
import Row from "../../components/Row.svelte"
|
import Row from "../../components/Row.svelte"
|
||||||
import Label from "../../components/Label.svelte"
|
import Label from "../../components/Label.svelte"
|
||||||
import Select from "../../components/Select.svelte"
|
import Select from "../../components/Select.svelte"
|
||||||
@ -22,8 +23,7 @@
|
|||||||
unsubscribeOptions()
|
unsubscribeOptions()
|
||||||
unsubscribeConfig()
|
unsubscribeConfig()
|
||||||
})
|
})
|
||||||
|
let selectedService = $url.hash.startsWith("#services:") ? $url.hash.split(":")[1] : "youtube"
|
||||||
let selectedService = "youtube"
|
|
||||||
$: serviceConf = _config.services[selectedService]
|
$: serviceConf = _config.services[selectedService]
|
||||||
$: serviceOptions = _options[selectedService]
|
$: serviceOptions = _options[selectedService]
|
||||||
$: frontendWebsite = serviceConf.frontends[serviceOptions.frontend].url
|
$: frontendWebsite = serviceConf.frontends[serviceOptions.frontend].url
|
||||||
@ -43,7 +43,11 @@
|
|||||||
clearable={false}
|
clearable={false}
|
||||||
class="svelte_select"
|
class="svelte_select"
|
||||||
value={selectedService}
|
value={selectedService}
|
||||||
on:change={e => (selectedService = e.detail.value)}
|
showChevron
|
||||||
|
on:change={e => {
|
||||||
|
selectedService = e.detail.value
|
||||||
|
window.location.hash = `services:${e.detail.value}`
|
||||||
|
}}
|
||||||
items={[
|
items={[
|
||||||
...servicesEntries.map(([serviceKey, service]) => {
|
...servicesEntries.map(([serviceKey, service]) => {
|
||||||
return { value: serviceKey, label: service.name }
|
return { value: serviceKey, label: service.name }
|
||||||
@ -58,6 +62,7 @@
|
|||||||
<ServiceIcon details={selection} />
|
<ServiceIcon details={selection} />
|
||||||
{selection.label}
|
{selection.label}
|
||||||
</div>
|
</div>
|
||||||
|
<div style="font-size: 10px;" slot="chevron-icon">🮦</div>
|
||||||
</SvelteSelect>
|
</SvelteSelect>
|
||||||
</div>
|
</div>
|
||||||
</Row>
|
</Row>
|
||||||
@ -104,6 +109,7 @@
|
|||||||
dir="ltr"
|
dir="ltr"
|
||||||
class="svelte_select"
|
class="svelte_select"
|
||||||
value={serviceOptions.frontend}
|
value={serviceOptions.frontend}
|
||||||
|
showChevron
|
||||||
on:change={e => {
|
on:change={e => {
|
||||||
serviceOptions.frontend = e.detail.value
|
serviceOptions.frontend = e.detail.value
|
||||||
options.set(_options)
|
options.set(_options)
|
||||||
@ -123,6 +129,7 @@
|
|||||||
<FrontendIcon details={selection} {selectedService} />
|
<FrontendIcon details={selection} {selectedService} />
|
||||||
{selection.label}
|
{selection.label}
|
||||||
</div>
|
</div>
|
||||||
|
<div style="font-size: 10px;" slot="chevron-icon">🮦</div>
|
||||||
</SvelteSelect>
|
</SvelteSelect>
|
||||||
</div>
|
</div>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<script>
|
<script>
|
||||||
const browser = window.browser || window.chrome
|
const browser = window.browser || window.chrome
|
||||||
|
|
||||||
import { page } from "./stores"
|
import url from "./url"
|
||||||
import GeneralIcon from "../icons/GeneralIcon.svelte"
|
import GeneralIcon from "../icons/GeneralIcon.svelte"
|
||||||
import ServicesIcon from "../icons/ServicesIcon.svelte"
|
import ServicesIcon from "../icons/ServicesIcon.svelte"
|
||||||
import AboutIcon from "../icons/AboutIcon.svelte"
|
import AboutIcon from "../icons/AboutIcon.svelte"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<a href="#general" on:click={() => page.set("general")} style={$page == "general" && "color: var(--active);"}>
|
<a href="#general" style={$url.hash == "#general" && "color: var(--active);"}>
|
||||||
<GeneralIcon class="margin margin_{document.body.dir}" />
|
<GeneralIcon class="margin margin_{document.body.dir}" />
|
||||||
{browser.i18n.getMessage("general") || "General"}
|
{browser.i18n.getMessage("general") || "General"}
|
||||||
</a>
|
</a>
|
||||||
<a href="#services" on:click={() => page.set("services")} style={$page == "services" && "color: var(--active);"}>
|
<a href="#services" style={$url.hash == "#services" && "color: var(--active);"}>
|
||||||
<ServicesIcon class="margin margin_{document.body.dir}" />
|
<ServicesIcon class="margin margin_{document.body.dir}" />
|
||||||
{browser.i18n.getMessage("services") || "Services"}
|
{browser.i18n.getMessage("services") || "Services"}
|
||||||
</a>
|
</a>
|
||||||
|
@ -2,4 +2,3 @@ import { writable } from "svelte/store"
|
|||||||
|
|
||||||
export const options = writable(null)
|
export const options = writable(null)
|
||||||
export const config = writable(null)
|
export const config = writable(null)
|
||||||
export const page = writable("general")
|
|
||||||
|
38
src/pages/options_src/url.js
Normal file
38
src/pages/options_src/url.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// https://svelte.dev/repl/5abaac000b164aa1aacc6051d5c4f584?version=3.59.2
|
||||||
|
|
||||||
|
import { derived, writable } from 'svelte/store'
|
||||||
|
|
||||||
|
export function createUrlStore(ssrUrl) {
|
||||||
|
// Ideally a bundler constant so that it's tree-shakable
|
||||||
|
if (typeof window === 'undefined') {
|
||||||
|
const { subscribe } = writable(ssrUrl)
|
||||||
|
return { subscribe }
|
||||||
|
}
|
||||||
|
|
||||||
|
const href = writable(window.location.href)
|
||||||
|
|
||||||
|
const originalPushState = history.pushState
|
||||||
|
const originalReplaceState = history.replaceState
|
||||||
|
|
||||||
|
const updateHref = () => href.set(window.location.href)
|
||||||
|
|
||||||
|
history.pushState = () => {
|
||||||
|
originalPushState.apply(this, arguments)
|
||||||
|
updateHref()
|
||||||
|
}
|
||||||
|
|
||||||
|
history.replaceState = () => {
|
||||||
|
originalReplaceState.apply(this, arguments)
|
||||||
|
updateHref()
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('popstate', updateHref)
|
||||||
|
window.addEventListener('hashchange', updateHref)
|
||||||
|
|
||||||
|
return {
|
||||||
|
subscribe: derived(href, ($href) => new URL($href)).subscribe
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If you're using in a pure SPA, you can return a store directly and share it everywhere
|
||||||
|
export default createUrlStore()
|
@ -88,7 +88,7 @@
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
:global(html, body) {
|
:global(html, body) {
|
||||||
width: 250px;
|
width: 300px;
|
||||||
height: min-content;
|
height: min-content;
|
||||||
min-height: auto;
|
min-height: auto;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -126,7 +126,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
:global(img, svg) {
|
:global(img, svg) {
|
||||||
margin-right: 10px;
|
margin-right: 5px;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
height: 26px;
|
height: 26px;
|
||||||
width: 26px;
|
width: 26px;
|
||||||
@ -135,6 +135,6 @@
|
|||||||
|
|
||||||
:global(.rtl img, .rtl svg) {
|
:global(.rtl img, .rtl svg) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
margin-left: 10px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
import { onDestroy } from "svelte"
|
import { onDestroy } from "svelte"
|
||||||
import servicesHelper from "../../../assets/javascripts/services"
|
import servicesHelper from "../../../assets/javascripts/services"
|
||||||
import { options, config } from "../stores"
|
import { options, config } from "../stores"
|
||||||
|
import SettingsIcon from "../../icons/SettingsIcon.svelte"
|
||||||
|
|
||||||
let _options
|
let _options
|
||||||
let _config
|
let _config
|
||||||
@ -53,6 +54,13 @@
|
|||||||
window.close()
|
window.close()
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
|
<SettingsIcon
|
||||||
|
class="interactive"
|
||||||
|
on:click={() =>
|
||||||
|
browser.tabs.create({ url: browser.runtime.getURL(`pages/options/index.html#services:${serviceKey}`) }, () => {
|
||||||
|
window.close()
|
||||||
|
})}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user