This commit is contained in:
icefox 2026-01-11 20:02:05 -03:00
parent cbaa466191
commit 8eb8bf1297
No known key found for this signature in database

View file

@ -12,8 +12,8 @@
x-data="{active: 0, total: {{len .Covers}}, row: 6, chapter: {{.Chapter}}, prefix: '{{.Prefix}}', comics: [{{range $i, $c := .Covers}}{{if $i}},{{end}}{{$c.Comic}}{{end}}]}"
@keydown.window.left.prevent="active = Math.max(0, active - 1)"
@keydown.window.right.prevent="active = Math.min(total - 1, active + 1)"
@keydown.window.up.prevent="active < 7 ? htmx.ajax('GET', prefix + '/' + Math.max(0, chapter - 2), {target: '#app', swap: 'outerHTML'}).then(() => history.replaceState(null, '', prefix + '/' + Math.max(0, chapter - 2))) : active = Math.max(0, active - row)"
@keydown.window.down.prevent="active > 12 ? htmx.ajax('GET', prefix + '/' + chapter, {target: '#app', swap: 'outerHTML'}).then(() => history.replaceState(null, '', prefix + '/' + chapter)) : active = Math.min(total - 1, active + row)"
@keydown.window.up.prevent="active < 6 ? htmx.ajax('GET', prefix + '/' + Math.max(0, chapter - 2), {target: '#app', swap: 'outerHTML'}).then(() => history.replaceState(null, '', prefix + '/' + Math.max(0, chapter - 2))) : active = Math.max(0, active - row)"
@keydown.window.down.prevent="active >= 12 ? htmx.ajax('GET', prefix + '/' + chapter, {target: '#app', swap: 'outerHTML'}).then(() => history.replaceState(null, '', prefix + '/' + chapter)) : active = Math.min(total - 1, active + row)"
@keydown.window.i.prevent="htmx.ajax('GET', prefix + '/' + chapter, {target: '#app', swap: 'outerHTML'}).then(() => history.replaceState(null, '', prefix + '/' + chapter))"
@keydown.window.n.prevent="htmx.ajax('GET', prefix + '/' + Math.max(0, chapter - 2), {target: '#app', swap: 'outerHTML'}).then(() => history.replaceState(null, '', prefix + '/' + Math.max(0, chapter - 2)))"
@keydown.window.enter.prevent="window.location.href = '/gallery/' + comics[active]"