-
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added arrow icon to dropdowns. Added settings button to each service …
…in the popup
- Loading branch information
Showing
9 changed files
with
69 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters