diff --git a/Makefile b/Makefile index b660248..0413614 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CABALFLAGS ?= --jobs --enable-optimization DATADIR := data TMPDIR := _tmp -BUILDDIR := /srv/www/gallery +BUILDDIR := _build INFONAME := info.yaml ROOT := https://gallery.niss.website INDEX := $(DATADIR)/index.yaml @@ -115,6 +115,7 @@ list-tags: $(MAKEPAGES) HOST ?= gallery.niss.website REMOTE_USER ?= www-data +IDFILE ?= ~/.ssh/xyz REMOTE_DIR ?= gallery .PHONY: upload @@ -122,7 +123,7 @@ upload: build @rsync --recursive --partial --progress --copy-links \ --compress --human-readable --hard-links --size-only \ --delete --delete-after \ - --rsh='ssh -l $(REMOTE_USER)' \ + --rsh='ssh -l $(REMOTE_USER) -i $(IDFILE)' \ $(BUILDDIR)/ $(HOST):$(REMOTE_DIR)/ @@ -141,7 +142,7 @@ endef define resize echo "[resize] "$@ mkdir -p "$(dir $@)" -magick -define webp:lossless=true "$^" -resize "$(1)x$(2)$(3)" $(4) "$@" +convert -resize "$(1)x$(2)$(3)" -define webp:lossless=true $(4) "$^" "$@" endef # no args diff --git a/make-pages/Depend.hs b/make-pages/Depend.hs index b9f439d..0869e01 100644 --- a/make-pages/Depend.hs +++ b/make-pages/Depend.hs @@ -7,7 +7,7 @@ where import BuilderQQ hiding (CanBuild (..)) import Info hiding (Text) -import Data.Maybe (fromMaybe) +import Data.Maybe (fromMaybe, mapMaybe) import Data.Text.Lazy (Text) import Data.Foldable import System.FilePath @@ -32,6 +32,7 @@ dependSingle' yamlDir indexFile info prefix build nsfw = maybe [] (toList . allImages) $ if nsfw then Just $ info.images else sfwImages info + dls = mapMaybe (.download) images extras = info.extras dir = build prefix yamlDir @@ -40,7 +41,7 @@ dependSingle' yamlDir indexFile info prefix build nsfw = thumbFile (thumbnail info) : map pageFile images ++ map bigFile images ++ - extras + dls ++ extras dependGallery :: GalleryInfo -> FilePath -- ^ index file diff --git a/make-pages/Info.hs b/make-pages/Info.hs index 124bfd0..1b0b6fa 100644 --- a/make-pages/Info.hs +++ b/make-pages/Info.hs @@ -296,10 +296,8 @@ pageFile img = if canResize img then addSuffix "_med" img.path else img.path bigFile :: Image -> FilePath -bigFile img - | Just path <- img.download = path - | canResize img = addSuffix "_big" img.path - | otherwise = img.path +bigFile img = + if canResize img then addSuffix "_big" img.path else img.path addSuffix :: String -> FilePath -> FilePath addSuffix suf path = diff --git a/script/gallery.ts b/script/gallery.ts index 38d3303..738f23b 100644 --- a/script/gallery.ts +++ b/script/gallery.ts @@ -10,14 +10,14 @@ let showSingles = false; function fillSets(): [Set, Set] { - function checkedValues(boxes: Boxes): Set { + function checkedValues(boxes: Boxes) { return new Set([...boxes].filter(b => b.checked).map(b => b.value)); } return [checkedValues(reqBoxes), checkedValues(excBoxes)]; } -function updateItems(): void { +function updateItems() { const [reqTags, excTags] = fillSets(); const anyReq = reqTags.size > 0; @@ -37,7 +37,7 @@ function updateItems(): void { if (marker !== null) marker.hidden = hideMarker; } - function disp(pfx: string, tags: Iterable): string { + function disp(pfx: string, tags: Iterable) { return [...tags].map(x => pfx + x).join('\u2003'); // em space } const plus = disp('+\u2009', reqTags); // thin space @@ -46,12 +46,12 @@ function updateItems(): void { `${plus}\u2003${minus}`.trim(); } -function update(): void { +function update() { updateItems(); history.pushState(null, "", makeFragment()); } -function converseId(id: string): string { +function converseId(id: string) { if (id.match(/^require/)) { return id.replace('require', 'exclude'); } else { @@ -59,7 +59,7 @@ function converseId(id: string): string { } } -function toggle(checkbox: HTMLInputElement): void { +function toggle(checkbox: HTMLInputElement) { if (checkbox.checked) { const converse = document.getElementById(converseId(checkbox.id)) as HTMLInputElement; converse.checked = false; @@ -68,17 +68,17 @@ function toggle(checkbox: HTMLInputElement): void { } -function clearForm(): void { +function clearForm() { allBoxes.forEach(b => b.checked = b.defaultChecked); } -function clear(e: Event): void { +function clear(e: Event) { clearForm(); update(); e.preventDefault(); } -function toggleSingles(e: Event): void { +function toggleSingles(e: Event) { showSingles = !showSingles; const elems = Array.from(document.querySelectorAll('.filterlist li')) as HTMLElement[]; @@ -94,7 +94,7 @@ function toggleSingles(e: Event): void { } -function makeFragment(): string { +function makeFragment() { const allBoxesArr = Array.from(allBoxes); const ids = allBoxesArr.filter(b => b.checked).map(b => b.id); if (ids.length == 0) { @@ -107,7 +107,7 @@ function makeFragment(): string { } -type Shortcuts = Record>; +type Shortcuts = { [short: string]: Set }; const shortcuts: Shortcuts = { summary: new Set(['require_artsummary']), colourexamples: new Set(['require_colourexample']), @@ -116,26 +116,11 @@ const shortcuts: Shortcuts = { iconexamples: new Set(['require_iconexample']), curated: new Set(['require_curated']), gecs: new Set(['require_niss', 'require_nisse']), - niss: new Set(['require_niss']), - nisse: new Set(['require_nisse']), qt: new Set(['require_q_t_']), - "q.t.": new Set(['require_q_t_']), kesi: new Set(['require_kesi']), - bip: new Set(['require_bip']), - 60309: new Set(['require_IEC60309']), - velzek: new Set(['require_velzek']), - pricklypear: new Set(['require_pricklypear']), - prickly_pear: new Set(['require_pricklypear']), - goo: new Set(['require_thegoo']), - the_goo: new Set(['require_thegoo']), - thegoo: new Set(['require_thegoo']), - kiki: new Set(['require_kiki']), - nex: new Set(['require_nex']), - kezda: new Set(['require_kezda']), - marigold: new Set(['require_marigold']), }; -function useFragment(): void { +function useFragment() { const frag = decodeURIComponent(location.hash).replace(/^#/, ''); const details = document.getElementById('filters-details') as HTMLDetailsElement; const fromShortcut = shortcuts[frag]; @@ -160,8 +145,8 @@ function useFragment(): void { } -function sortFilters(cmp: (a: Node, b: Node) => number): void { - function sort1(id: string): void { +function sortFilters(cmp: (a: Node, b: Node) => number) { + function sort1(id: string) { const elt = document.getElementById(id); if (elt === null) return; @@ -177,7 +162,7 @@ function sortFilters(cmp: (a: Node, b: Node) => number): void { sort1('exclude'); } -function sortFiltersAlpha(e: Event): void { +function sortFiltersAlpha(e: Event) { function getName(node: Node): string { if (node instanceof Element) { return node.getElementsByTagName('input')[0]?.value ?? ''; @@ -189,7 +174,7 @@ function sortFiltersAlpha(e: Event): void { e.preventDefault(); } -function sortFiltersUses(e: Event): void { +function sortFiltersUses(e: Event) { function getUses(node: Node): number { if (node instanceof Element) { const countStr = node.getElementsByTagName('label')[0]?.dataset.count; @@ -203,7 +188,7 @@ function sortFiltersUses(e: Event): void { } -function setup(): void { +function setup() { function inputs(id: string): Boxes { const iter = document.getElementById(id)!.getElementsByTagName('input'); return new Set(Array.from(iter)); @@ -231,7 +216,7 @@ function setup(): void { allBoxes.forEach(b => b.addEventListener('change', () => toggle(b))); - function addClick(id: string, f: (e: Event) => void): void { + function addClick(id: string, f: (e: Event) => void) { document.getElementById(id)!.addEventListener('click', f); } addClick('clear', clear); diff --git a/script/nsfw-warning.ts b/script/nsfw-warning.ts index d219709..5b80e72 100644 --- a/script/nsfw-warning.ts +++ b/script/nsfw-warning.ts @@ -1,12 +1,12 @@ const nsfwOk = 'nsfw-ok'; const dialog = document.getElementById('nsfw-dialog')! as HTMLDialogElement; -function yes(): void { +function yes() { localStorage.setItem(nsfwOk, '1'); dialog.close(); } -function setup(): void { +function setup() { if (!localStorage.getItem(nsfwOk)) { (dialog.querySelector('#nsfw-yes') as HTMLElement).onclick = yes; // nsfw-no is a normal link diff --git a/script/single.ts b/script/single.ts index 17917e7..0cd291a 100644 --- a/script/single.ts +++ b/script/single.ts @@ -28,7 +28,7 @@ function setImage(id: string, src: string, href: string, if (curCw && !coverNew) { // keep old cover until load - function removeCover(): void { setTimeout(() => openCW(null, curCw!), 100); } + function removeCover() { setTimeout(() => openCW(null, curCw!), 100); } mainimg.addEventListener('load', removeCover, {once: true}); } else if (coverNew) { // place new cover @@ -82,7 +82,7 @@ function useFragment(firstLoad = false): void { } } -function setup(): void { +function setup() { mainfig = document.getElementById('mainfig')!; mainimg = document.getElementById('mainimg') as HTMLImageElement; mainlink = document.getElementById('mainlink') as HTMLAnchorElement; diff --git a/style/shiny/base.css b/style/shiny/base.css index 60f61b7..5a86f34 100644 --- a/style/shiny/base.css +++ b/style/shiny/base.css @@ -203,12 +203,6 @@ summary::after { summary::after { content: 'show'; } [open] summary::after { content: 'hide'; } -#filters-details { - summary::after { content: none; } - summary h2::before { content: 'show '; } - &[open] summary h2::before { content: 'hide '; } -} - dt { font-size: 120%; diff --git a/style/shiny/gallery.css b/style/shiny/gallery.css index 3972c47..7d52bce 100644 --- a/style/shiny/gallery.css +++ b/style/shiny/gallery.css @@ -43,7 +43,6 @@ font-weight: 500; font-size: 90%; grid-column-gap: 0.5em; - grid-row-gap: 0.3em; } .filterlist input { diff --git a/style/shiny/index.css b/style/shiny/index.css index 5511630..eaba977 100644 --- a/style/shiny/index.css +++ b/style/shiny/index.css @@ -88,14 +88,6 @@ main { margin: 2em 0; } -footer { - text-align: center; -} -footer a { - text-decoration: none; - font-weight: 700; -} - @media (pointer: coarse) { .list { font-size: 300%; diff --git a/style/shiny/pkmn.css b/style/shiny/pkmn.css index b0b7ba9..4dbff04 100644 --- a/style/shiny/pkmn.css +++ b/style/shiny/pkmn.css @@ -13,10 +13,9 @@ linear-gradient(105deg, var(--type-col) 0, var(--type-col) var(--offset), - #5d4e5d var(--offset) + #5d4e5d calc(var(--offset) + 1px) ); - --offset: calc(var(--icon-size) * 1.25); - border: 1px solid black; + --offset: calc(var(--icon-size) * 1.5); } .pkmn-move::before { @@ -29,7 +28,7 @@ } .pkmn-type + .pkmn-type { - margin-left: 0.5ex; + margin-left: 0.25ex; } .pkmn-species { @@ -44,7 +43,6 @@ } .pkmn-stats table { - table-layout: fixed; width: 80%; text-align: center; margin: 0; diff --git a/style/shiny/single.css b/style/shiny/single.css index d883b3e..8454735 100644 --- a/style/shiny/single.css +++ b/style/shiny/single.css @@ -24,6 +24,7 @@ body { overflow: hidden; border: var(--border-thickness) solid var(--border-col); box-shadow: var(--text-shadow); + background: hsl(340, 45%, 65%); } #mainfig:focus-within { @@ -109,13 +110,12 @@ body { #info .floating { float: right; - margin: 0.2em 0 0.2em 2em; + margin-left: 0.8em; max-width: 40%; } #info .floating.left { float: left; - margin: 0.2em 2em 0.2em 0; } #info .shaped { @@ -130,8 +130,9 @@ body { text-align: right; } -#info :is(h2, ul, ol, p, dl, details) { margin: 0.35em 0; } -#info :is(ul, ol) { padding-left: 1.5ch; } +#info h2, #info ul, #info ol, #info p, #info dl, #info details { + margin: 0.35em 0; +} #info details > * { margin-left: 0; @@ -140,10 +141,9 @@ body { #updates dl, dl.inline { display: grid; grid-template-columns: max-content auto; + grid-gap: 1em; align-items: baseline; } -dl.inline { gap: .25em 1em; } -#updates dl { gap: 1em; } :is(#updates, .inline) dt { font-size: 100%;