diff options
| author | Fuwn <[email protected]> | 2023-09-05 21:36:05 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-09-05 21:38:36 -0700 |
| commit | 59f73659d2cfeb8621cae7aefda0079c585d01f5 (patch) | |
| tree | 5d46c724525256b7c1871d0b3907e7dc52a8df62 /src | |
| parent | feat(home): response columns (diff) | |
| download | due.moe-59f73659d2cfeb8621cae7aefda0079c585d01f5.tar.xz due.moe-59f73659d2cfeb8621cae7aefda0079c585d01f5.zip | |
feat(anime): optionally link to livechart.me
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/List/Due/AnimeList.svelte | 11 | ||||
| -rw-r--r-- | src/lib/List/UpcomingAnimeList.svelte | 12 | ||||
| -rw-r--r-- | src/routes/settings/+page.svelte | 10 | ||||
| -rw-r--r-- | src/stores/settings.ts | 4 |
4 files changed, 32 insertions, 5 deletions
diff --git a/src/lib/List/Due/AnimeList.svelte b/src/lib/List/Due/AnimeList.svelte index 3079352b..224a3e49 100644 --- a/src/lib/List/Due/AnimeList.svelte +++ b/src/lib/List/Due/AnimeList.svelte @@ -167,8 +167,15 @@ <ul> {#each cleanedMedia as anime} <li> - <a href={`https://anilist.co/anime/${anime.id}`} target="_blank"> - {anime.title.english || anime.title.romaji} + <a + href={$settings.linkToAniList + ? `https://anilist.co/anime/${anime.id}` + : `https://www.livechart.me/search?q=${ + anime.title.native || anime.title.english || anime.title.romaji + }`} + target="_blank" + > + {anime.title.english || anime.title.romaji || anime.title.native} </a> <span style="opacity: 50%;">|</span> {(anime.mediaListEntry || { progress: 0 }).progress}{@html totalEpisodes(anime)} diff --git a/src/lib/List/UpcomingAnimeList.svelte b/src/lib/List/UpcomingAnimeList.svelte index 87343032..8eee9e48 100644 --- a/src/lib/List/UpcomingAnimeList.svelte +++ b/src/lib/List/UpcomingAnimeList.svelte @@ -6,6 +6,7 @@ import { onMount } from 'svelte'; import anime from '../../stores/anime'; import lastPruneTimes from '../../stores/lastPruneTimes'; + import settings from '../../stores/settings'; export let user: AniListAuthorisation; export let identity: UserIdentity; @@ -123,8 +124,15 @@ <ul> {#each cleanedMedia as anime} <li> - <a href={`https://anilist.co/anime/${anime.id}`} target="_blank"> - {anime.title.english || anime.title.romaji} + <a + href={$settings.linkToAniList + ? `https://anilist.co/anime/${anime.id}` + : `https://www.livechart.me/search?q=${ + anime.title.native || anime.title.english || anime.title.romaji + }`} + target="_blank" + > + {anime.title.english || anime.title.romaji || anime.title.native} </a> <span style="opacity: 50%;">|</span> {@html airingTime(anime)} diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte index 2cc7ea0a..54add148 100644 --- a/src/routes/settings/+page.svelte +++ b/src/routes/settings/+page.svelte @@ -44,6 +44,16 @@ > <br /> + <a + href={'#'} + on:click={() => + $settings.linkToAniList + ? settings.setKey('linkToAniList', false) + : settings.setKey('linkToAniList', true)} + >{$settings.linkToAniList ? 'Link anime to LiveChart.me' : 'Link anime to AniList'}</a + > + <br /> + <p /> <a diff --git a/src/stores/settings.ts b/src/stores/settings.ts index c802e8b2..01580ec3 100644 --- a/src/stores/settings.ts +++ b/src/stores/settings.ts @@ -11,6 +11,7 @@ interface Settings { roundDownChapters: boolean; sortByDifference: boolean; forceLightTheme: boolean; + linkToAniList: boolean; } const defaultSettings: Settings = { @@ -22,7 +23,8 @@ const defaultSettings: Settings = { displayUnresolved: false, roundDownChapters: true, sortByDifference: false, - forceLightTheme: false + forceLightTheme: false, + linkToAniList: true }; const createStore = () => { |