refactor: switch watchlist IDs from global to JSON script tag

This commit is contained in:
2026-06-06 16:53:40 +02:00
committed by Milas Holsting
parent 072f565c1b
commit 81966520a1
3 changed files with 7 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
{{define "title"}}Browse{{end}} {{define "title"}}Browse{{end}}
{{define "scripts"}}{{end}}
{{define "content"}} {{define "content"}}
{{if .WatchlistIDs}}<script>window.__WATCHLIST_IDS__={{.WatchlistIDs}}</script>{{end}} {{if .WatchlistIDs}}<script type="application/json" id="watchlist-ids-json">{{.WatchlistIDs}}</script>{{end}}
{{template "browse_content" .}} {{template "browse_content" .}}
{{end}} {{end}}
@@ -70,7 +71,7 @@
{{end}} {{end}}
{{define "browse_sentinel"}} {{define "browse_sentinel"}}
<div hx-get="/browse?q={{.Query}}&type={{.Type}}&status={{.Status}}&order_by={{.OrderBy}}&sort={{.Sort}}&studio={{.Studio}}&sfw={{.SFW}}{{ if .Genres }}&{{genresParams .Genres}}{{ end }}&page={{.NextPage}}" <div hx-get='{{browseURL . (dict "page" .NextPage)}}'
hx-trigger="intersect once" hx-trigger="intersect once"
hx-swap="outerHTML" hx-swap="outerHTML"
hx-target="this" hx-target="this"

View File

@@ -1,6 +1,7 @@
{{define "title"}}Watch {{.Anime.Title}}{{end}} {{define "title"}}Watch {{.Anime.Title}}{{end}}
{{define "scripts"}}<script type="module" src="/dist/static/player/main.js" defer></script>{{end}}
{{define "content"}} {{define "content"}}
{{if .WatchlistIDs}}<script>window.__WATCHLIST_IDS__={{.WatchlistIDs}}</script>{{end}} {{if .WatchlistIDs}}<script type="application/json" id="watchlist-ids-json">{{.WatchlistIDs}}</script>{{end}}
{{$anime := .Anime}} {{$anime := .Anime}}
{{$episodes := .Episodes}} {{$episodes := .Episodes}}
{{$currentEpID := .CurrentEpID}} {{$currentEpID := .CurrentEpID}}

View File

@@ -1,6 +1,7 @@
{{define "title"}}Watchlist{{end}} {{define "title"}}Watchlist{{end}}
{{define "scripts"}}{{end}}
{{define "content"}} {{define "content"}}
{{if .WatchlistIDs}}<script>window.__WATCHLIST_IDS__={{.WatchlistIDs}}</script>{{end}} {{if .WatchlistIDs}}<script type="application/json" id="watchlist-ids-json">{{.WatchlistIDs}}</script>{{end}}
<div id="watchlist-content" class="flex w-full flex-col gap-6"> <div id="watchlist-content" class="flex w-full flex-col gap-6">
<h1 class="text-xl font-normal tracking-[-0.02em] text-foreground">Watchlist</h1> <h1 class="text-xl font-normal tracking-[-0.02em] text-foreground">Watchlist</h1>