diff options
| author | Fuwn <[email protected]> | 2023-11-14 10:29:15 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-11-14 10:29:15 -0800 |
| commit | 53145ae601a416d81d8b2dd9af9021fc5bd1eaf5 (patch) | |
| tree | a579d53c3255843235db8e4173002abe310154f6 /src | |
| parent | feat(wrapped): optional watermark (diff) | |
| download | due.moe-53145ae601a416d81d8b2dd9af9021fc5bd1eaf5.tar.xz due.moe-53145ae601a416d81d8b2dd9af9021fc5bd1eaf5.zip | |
feat(anime): show total hours on hover
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/Media/anime.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/Media/anime.ts b/src/lib/Media/anime.ts index 5e5bfd68..5e17025f 100644 --- a/src/lib/Media/anime.ts +++ b/src/lib/Media/anime.ts @@ -30,13 +30,14 @@ export const airingTime = (anime: Media, upcoming = false) => { hour: 'numeric', minute: '2-digit' }); + let hours = null; if (untilAiring !== undefined) { let minutes = untilAiring / 60; let few = true; if (minutes >= 30) { - let hours = minutes / 60; + hours = minutes / 60; if (hours >= 24) { let weeks = Math.floor(Math.floor(hours / 24) / 7); @@ -66,11 +67,15 @@ export const airingTime = (anime: Media, upcoming = false) => { const opacity = Math.round(100 - (untilAiring / 60 / 60 / 24 / 7) * 50); if (upcoming) { - return `<span style="opacity: ${opacity}%">${anime.nextAiringEpisode?.episode}${totalEpisodes( + return `<span title="${ + hours ? `${hours.toFixed(2)} hours` : '' + }" style="opacity: ${opacity}%">${anime.nextAiringEpisode?.episode}${totalEpisodes( anime )} in ${timeFrame} <span style="opacity: 50%">${few ? `(${time})` : ''}</span></span>`; } else { - return `<span style="opacity: ${opacity}%">${anime.nextAiringEpisode?.episode} in ${ + return `<span title="${ + hours ? `${hours.toFixed(2)} hours` : '' + }" style="opacity: ${opacity}%">${anime.nextAiringEpisode?.episode} in ${ few ? '<b>' : '' }${timeFrame}${few ? '</b>' : ''} ${few ? `(${time})` : ''}</span>`; } |