aboutsummaryrefslogtreecommitdiff
path: root/src/routes/settings/+page.svelte
blob: 18aa42cc4d97a6a7209c30df07e2f6043b6e9d71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<script lang="ts">
	/* eslint svelte/no-at-html-tags: "off" */

	import { chapterDatabase } from '$lib/chapterDatabase';
	import manga from '../../stores/manga';
	import anime from '../../stores/anime';
	import settings from '../../stores/settings';
	import SettingToggle from '$lib/Settings/SettingToggle.svelte';
	import SettingHint from '$lib/Settings/SettingHint.svelte';

	export let data;

	const pruneUnresolved = async () => {
		const unresolved = await chapterDatabase.chapters.where('chapters').equals(-1).toArray();
		const ids = unresolved.map((m) => m.id);

		manga.set('');
		anime.set('');
		await chapterDatabase.chapters.bulkDelete(ids);
	};
	const pruneAll = async () => {
		const all = await chapterDatabase.chapters.toArray();
		const ids = all.map((m) => m.id);

		manga.set('');
		await chapterDatabase.chapters.bulkDelete(ids);
	};
</script>

{#if data.user === undefined}
	Please log in to modify settings.
{:else}
	<details open>
		<summary>Display</summary>

		<SettingToggle setting={'forceLightTheme'} on={'Use preferred'} off={'Force light'}>
			theme
		</SettingToggle>
		<SettingToggle
			setting={'linkToAniList'}
			on={'Link anime to LiveChart.me'}
			off={'Link anime to AniList'}
		/>
		<SettingToggle setting={'displayPausedMedia'} on={'Hide'} off={'Show'} sectionBreak>
			paused media
		</SettingToggle>

		<p />

		<SettingToggle setting={'showCompletedAnime'} on={'Hide'} off={'Show'}>
			completed anime
		</SettingToggle>
		<SettingHint>Completed anime = anime on your lists which have finished airing</SettingHint>

		<p />

		<SettingToggle setting={'displayUnresolved'} on={'Hide'} off={'Show'}>unresolved</SettingToggle>
		<SettingHint>Displays unresolved chapter counts as "?"</SettingHint>

		<p />

		<SettingToggle setting={'displayNotStarted'} on={'Hide'} off={'Show'}>
			media with zero progress
		</SettingToggle>
		<SettingHint>
			May cause <a href="https://en.wikipedia.org/wiki/Rate_limiting" target="_blank">
				rate-limiting
			</a> depending on how much releasing manga are on your lists
		</SettingHint>

		<p />

		<SettingToggle setting={'closeAnimeByDefault'} on={'Expand'} off={'Close'}>
			anime panel by default
		</SettingToggle>
		<SettingToggle setting={'closeMangaByDefault'} on={'Expand'} off={'Close'}>
			manga panel by default
		</SettingToggle>
		<SettingToggle setting={'sortByDifference'}>
			Sort anime by {@html !$settings.sortByDifference
				? 'difference between last watched and next episode'
				: 'days left until next episode'}
		</SettingToggle>
	</details>

	<p />

	<details open>
		<summary>Calculation</summary>

		<SettingToggle setting={'roundDownChapters'} on={'Maintain'} off={'Round down'}>
			chapters
		</SettingToggle>
		<SettingHint>
			50/50.6 would {@html $settings.roundDownChapters ? '<b>not</b>' : ''} be due
		</SettingHint>
	</details>

	<p />

	<details open>
		<summary>Cache</summary>

		<a href={'#'} on:click={pruneUnresolved}>Re-cache <b>ALL</b> unresolved manga</a>

		<p />

		<a href={'#'} on:click={pruneAll}>Re-cache <b>ALL</b> manga</a>
		<SettingHint lineBreak>Force a re-cache of all cached manga chapter counts</SettingHint>

		<p />

		<span>Re-cache <b>ALL</b> media keys every</span>
		<input type="number" bind:value={$settings.cacheMinutes} min="1" max="60" placeholder="30" />
		minutes
		<SettingHint lineBreak>Media keys = your cached list data</SettingHint>

		<p />

		<span>Re-cache <b>ALL</b> manga chapter counts every</span>
		<input
			type="number"
			bind:value={$settings.cacheMangaMinutes}
			min="1"
			max="1440"
			placeholder="60"
		/>
		minutes
		<SettingHint lineBreak>
			Low values may cause <a href="https://en.wikipedia.org/wiki/Rate_limiting" target="_blank">
				rate-limiting
			</a> depending on the amount of releasing manga are on your lists
		</SettingHint>
	</details>

	<p />

	<details open>
		<summary>Reset Settings</summary>

		<a href={'#'} on:click={settings.reset}>Reset <b>ALL</b> settings</a>
		<SettingHint lineBreak>
			Resets all settings present on this page to their default values
		</SettingHint>

		<p />

		<a href={'#'} on:click={() => localStorage.clear()}>Clear <code>localStorage</code> </a>
		<SettingHint lineBreak>
			Doesn't break anything, but resets all settings and clears all key caches. Recommended after
			updates
		</SettingHint>
	</details>
{/if}

<p />

<hr />

Have feedback or suggestions? Send a private message to
<a href="https://anilist.co/user/fuwn" target="_blank">@fuwn</a> on AniList!