diff options
| author | Fuwn <[email protected]> | 2023-11-06 10:50:31 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-11-06 10:50:31 -0800 |
| commit | be9a02cd3cbbda885a478fabd373ed8afff6cc06 (patch) | |
| tree | 93a89728973d64e2e6d199051540647d889f980c /src | |
| parent | feat(settinsg): guess method hint (diff) | |
| download | due.moe-be9a02cd3cbbda885a478fabd373ed8afff6cc06.tar.xz due.moe-be9a02cd3cbbda885a478fabd373ed8afff6cc06.zip | |
feat(manga): option to disable volume ood
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/Media/manga.ts | 46 | ||||
| -rw-r--r-- | src/routes/settings/+page.svelte | 17 | ||||
| -rw-r--r-- | src/stores/settings.ts | 4 |
3 files changed, 45 insertions, 22 deletions
diff --git a/src/lib/Media/manga.ts b/src/lib/Media/manga.ts index ab33f124..746e9d29 100644 --- a/src/lib/Media/manga.ts +++ b/src/lib/Media/manga.ts @@ -79,32 +79,36 @@ export const chapterCount = async ( } } - const volumeOfChapterData = await ( - await fetch(`/api/mangadex/chapter?id=${mangadexId}&chapter=${manga.mediaListEntry?.progress}`) - ).json(); - let lastAvailableVolume = lastChapterData['data'][0]['attributes']['volume']; - - if (lastAvailableVolume === null) { - let chapterIndex = 0; - - while (chapterIndex < lastChapterData['data'].length && lastAvailableVolume === null) { - if (lastChapterData['data'][chapterIndex]['attributes']['volume'] !== null) { - lastAvailableVolume = lastChapterData['data'][chapterIndex]['attributes']['volume']; + if (!settings.get().disableOutOfDateVolumeWarning) { + const volumeOfChapterData = await ( + await fetch( + `/api/mangadex/chapter?id=${mangadexId}&chapter=${manga.mediaListEntry?.progress}` + ) + ).json(); + let lastAvailableVolume = lastChapterData['data'][0]['attributes']['volume']; + + if (lastAvailableVolume === null) { + let chapterIndex = 0; + + while (chapterIndex < lastChapterData['data'].length && lastAvailableVolume === null) { + if (lastChapterData['data'][chapterIndex]['attributes']['volume'] !== null) { + lastAvailableVolume = lastChapterData['data'][chapterIndex]['attributes']['volume']; + } + + chapterIndex += 1; } - - chapterIndex += 1; } - } - if (volumeOfChapterData['data'] !== undefined && volumeOfChapterData['data'].length > 0) { - const volumeOfChapter = volumeOfChapterData['data'][0]['attributes']['volume']; + if (volumeOfChapterData['data'] !== undefined && volumeOfChapterData['data'].length > 0) { + const volumeOfChapter = volumeOfChapterData['data'][0]['attributes']['volume']; - if (volumeOfChapter !== null) { - completedVolumes = volumeOfChapter; - } + if (volumeOfChapter !== null) { + completedVolumes = volumeOfChapter; + } - if (completedVolumes === volumeOfChapter) { - completedVolumes -= 1; + if (completedVolumes === volumeOfChapter) { + completedVolumes -= 1; + } } } diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte index aafb7853..50c5ac28 100644 --- a/src/routes/settings/+page.svelte +++ b/src/routes/settings/+page.svelte @@ -96,6 +96,23 @@ <br /> + <SettingCheckboxToggle + setting="disableOutOfDateVolumeWarning" + text="Disable out-of-date volume warning" + > + <SettingHint lineBreak> + Keeping this enabled displays a warning message when there is a mismatch between chapter + progress and the number of volumes you have completed for a given title. (e.g. you are on + Vol. 5 Ch. 50, but only have 3 volumes tracked when you should have 4) + + <br /> + + Disabling this option speeds up refresh times for manga lists. + </SettingHint> + </SettingCheckboxToggle> + + <br /> + <SettingCheckboxToggle setting="disableGuessing" text="Disable informed chapter estimation"> <SettingHint lineBreak> Enabling this setting will disable light novel chapter counts and may cause inaccuracy in diff --git a/src/stores/settings.ts b/src/stores/settings.ts index d5a854d6..b6ad02bf 100644 --- a/src/stores/settings.ts +++ b/src/stores/settings.ts @@ -19,6 +19,7 @@ export interface Settings { hoverNavigation: boolean; displayNativeTitles: boolean; guessMethod: 'median' | 'trimmed_mean' | 'weighted_average'; + disableOutOfDateVolumeWarning: boolean; } const defaultSettings: Settings = { @@ -38,7 +39,8 @@ const defaultSettings: Settings = { disableGuessing: false, hoverNavigation: false, displayNativeTitles: false, - guessMethod: 'trimmed_mean' + guessMethod: 'trimmed_mean', + disableOutOfDateVolumeWarning: false }; const createStore = () => { |