+
+
+
+
+
+
+
+ {post.fav_count}
+
+
+
+
+
+
+
+ {post.score.total}
+
+
+
+
+
+
+
+
+
+ {await navigator.clipboard.writeText(`https://e621.net/posts/${post.id}`)}}>
+
+
+
+ ID: {post.id}
+
+
+
+
+
\ No newline at end of file
diff --git a/src/lib/components/index.js b/src/lib/components/index.js
index b891313..4285376 100644
--- a/src/lib/components/index.js
+++ b/src/lib/components/index.js
@@ -1,15 +1,19 @@
-import AppSettings from './AppSettings.svelte';
import BackButton from './BackButton.svelte';
+import Button from './Button.svelte';
+import Chips from './Chips.svelte';
import GlobalSearch from './GlobalSearch.svelte';
-import ImageGrid from './ImageGrid.svelte';
-import PostMedia from './PostMedia.svelte';
import Header from './Header.svelte';
+import ImageGrid from './ImageGrid.svelte';
+import LinkButton from './LinkButton.svelte';
+import PostMedia from './PostMedia.svelte';
export {
- AppSettings,
BackButton,
+ Button,
+ Chips,
GlobalSearch,
- ImageGrid,
- PostMedia,
Header,
+ ImageGrid,
+ LinkButton,
+ PostMedia,
}
\ No newline at end of file
diff --git a/src/lib/stores.js b/src/lib/stores.js
index 18e1ac6..a1be0d5 100644
--- a/src/lib/stores.js
+++ b/src/lib/stores.js
@@ -1,4 +1,22 @@
import { writable } from 'svelte/store';
+import { browser } from '$app/environment';
+
+function localStorageStore(storageKey, defaultValue = null) {
+ if (!browser) return defaultValue;
+ let value = window.localStorage.getItem(storageKey);
+ if (value === null) {
+ if (defaultValue !== null) window.localStorage.setItem(storageKey, defaultValue);
+ value = defaultValue;
+ }
+ return writable(value)
+}
export const postSearchResults = writable(null);
-export const loading = writable(false);
\ No newline at end of file
+export const loading = writable(false);
+export const lastSearch = localStorageStore('lastSearch', '');
+export const showSearch = writable(true);
+export const imageGridColumns = localStorageStore('gridColumns', 6);
+export const postGridPreviewQuality = localStorageStore('gridPreviewQuality', 'preview');
+export const blacklist = localStorageStore('blacklist', ['gore', 'scat'])
+
+export const limitImageHeight = localStorageStore('limitImageHeight', false)
\ No newline at end of file
diff --git a/src/lib/useSettings.svelte.js b/src/lib/useSettings.svelte.js
deleted file mode 100644
index 77098ab..0000000
--- a/src/lib/useSettings.svelte.js
+++ /dev/null
@@ -1,52 +0,0 @@
-import {onMount} from "svelte";
-
-export default function useSettings() {
- let lastSearch = $state(null),
- imageGridColumns = $state(6),
- limitImageHeight = $state(true),
- postGridPreviewQuality = $state('preview'),
- blacklist = $state([
- 'gore',
- 'scat',
- 'watersports',
- 'young',
- 'loli',
- 'shota',
- ]);
-
- onMount(() => {
- lastSearch = localStorage.getItem('lastSearch') ?? lastSearch;
- imageGridColumns = localStorage.getItem('gridColumns') ?? imageGridColumns;
- limitImageHeight = localStorage.getItem('limitImageHeight') ?? limitImageHeight;
- postGridPreviewQuality = localStorage.getItem('gridPreviewQuality') ?? postGridPreviewQuality;
- blacklist = localStorage.getItem('blacklist') ?? blacklist;
- })
-
- return {
- get lastSearch() {return lastSearch},
- get imageGridColumns() {return imageGridColumns},
- get postGridPreviewQuality() {return postGridPreviewQuality},
- get blacklist() {return blacklist},
- get limitImageHeight() {return limitImageHeight},
- set lastSearch(val) {
- lastSearch = val;
- localStorage.setItem('lastSearch', val);
- },
- set imageGridColumns(val) {
- imageGridColumns = val;
- localStorage.setItem('gridColumns', val);
- },
- set postGridPreviewQuality(val) {
- postGridPreviewQuality = val
- localStorage.setItem('gridPreviewQuality', val);
- },
- set blacklist(val) {
- blacklist = val
- localStorage.setItem('blacklist', val);
- },
- set limitImageHeight(val) {
- limitImageHeight = val
- localStorage.setItem('limitImageHeight', val);
- },
- }
-}
\ No newline at end of file
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 34e086a..270f283 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -1,5 +1,4 @@
-