perf: optimize episode fetching and metadata scraping
This commit is contained in:
@@ -28,7 +28,15 @@
|
||||
|
||||
{{template "watchlist_actions" dict "Anime" $anime "User" .User "Status" .Status}}
|
||||
|
||||
<div class="space-y-4">
|
||||
<div class="mt-6 flex flex-wrap gap-3">
|
||||
{{range $anime.External}}
|
||||
<a href="{{.URL}}" target="_blank" rel="noopener" class="bg-white/5 hover:bg-white/10 border-white/10 rounded-md border px-3 py-1.5 text-xs font-medium text-neutral-300 transition-colors">
|
||||
{{.Name}}
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div class="mt-8 space-y-4">
|
||||
<div>
|
||||
<h2 class="mb-2 text-lg font-medium text-neutral-300">Synopsis</h2>
|
||||
<p id="synopsis-container" class="text-foreground-muted max-w-4xl text-base leading-relaxed whitespace-pre-line line-clamp-5 md:line-clamp-none">
|
||||
|
||||
@@ -21,13 +21,19 @@
|
||||
{{$totalEps = $fallbackSub}}
|
||||
{{end}}
|
||||
|
||||
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5">
|
||||
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5" data-episode-list>
|
||||
{{range $episodes}}
|
||||
{{$isCurrent := eq (printf "%v" .MalID) $currentEpID}}
|
||||
<a href="/anime/{{$anime.MalID}}/watch?ep={{.MalID}}" class="group flex flex-col overflow-hidden bg-white/5 transition-colors hover:bg-white/10 {{if $isCurrent}}ring-accent ring-2{{end}}">
|
||||
<a href="/anime/{{$anime.MalID}}/watch?ep={{.MalID}}" class="group flex flex-col overflow-hidden bg-white/5 transition-colors hover:bg-white/10 {{if $isCurrent}}ring-accent ring-2{{end}}" data-episode-id="{{.MalID}}">
|
||||
<div class="relative aspect-video w-full overflow-hidden bg-black/50">
|
||||
{{if .Images.Jpg.ImageURL}}
|
||||
<img src="{{.Images.Jpg.ImageURL}}" alt="{{.Title}}" class="h-full w-full object-cover transition-transform group-hover:scale-105" loading="lazy" />
|
||||
{{if .Images}}
|
||||
{{if .Images.Jpg.ImageURL}}
|
||||
<img src="{{.Images.Jpg.ImageURL}}" alt="{{.Title}}" class="h-full w-full object-cover transition-transform group-hover:scale-105" loading="lazy" />
|
||||
{{else}}
|
||||
<div class="flex h-full w-full items-center justify-center text-neutral-600">
|
||||
<svg class="h-8 w-8" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>
|
||||
</div>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<div class="flex h-full w-full items-center justify-center text-neutral-600">
|
||||
<svg class="h-8 w-8" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>
|
||||
@@ -41,7 +47,7 @@
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 p-3">
|
||||
<span class="text-accent text-xs font-semibold">Episode {{.MalID}}</span>
|
||||
<span class="line-clamp-2 text-sm font-medium text-neutral-200">{{.Title}}</span>
|
||||
<span class="line-clamp-2 text-sm font-medium text-neutral-200" data-episode-title>{{.Title}}</span>
|
||||
</div>
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user