Fix yugioh wiki card pages (only half-fixed in offline environments)

This commit is contained in:
Cadence Ember 2023-03-16 01:12:06 +13:00
parent 5c3a0c2715
commit 91a7439007
Signed by: cadence
GPG Key ID: BC1C2C61CF521B17
6 changed files with 28 additions and 2 deletions

View File

@ -100,7 +100,7 @@
(theme "default")
(theme "light")
(theme "dark")
(cons (format "" wikiname)
(cons (format "" wikiname)
(build-path save-dir "site.css"))))
(for ([style styles]
[i (in-naturals)])

archiver/info.rkt Normal file
View File

@ -0,0 +1,3 @@
#lang info
(define build-deps '("rackunit-lib" "web-server-lib" "http-easy-lib" "html-parsing" "html-writing" "json-pointer" "ini-lib" "memo" "net-cookies-lib" "gui-easy-lib" "sql" "charterm" "cli"))

archiver/req.rktd Normal file
View File

@ -0,0 +1 @@
((local (".")))

View File

@ -17,6 +17,7 @@ image/png png
image/tiff tiff
image/vnd.wap.wbmp wbmp
image/x-icon ico
image/ ico
image/x-jng jng
image/x-ms-bmp bmp
image/svg+xml svg

View File

@ -97,6 +97,9 @@
(string-replace-curried "pi-collapse-closed" "")
(string-replace-curried "pi-collapse" "")))
(define (cardimage-class-updater c)
(string-append c " bw-updated-cardtable-cardimage"))
(define attributes-updater
; uncollapsing
@ -184,6 +187,24 @@
((class "table-scroller"))
((,element-type (@ (data-scrolling) ,@attributes)
; HACK for /yugioh/wiki/Pot_of_Greed: move card images above tables
[(and (eq? element-type 'table)
(has-class? "cardtable" attributes)
(not (has-class? "bw-updated-cardtable-cardimage" attributes)))
(define (is-cardimage? t a c) (and (eq? t 'td)
(has-class? "cardtable-cardimage" a)))
(define cardimage ((query-selector is-cardimage? element)))
(if (not cardimage)
(list element-type attributes children)
(let ([new-cardtable (update-tree
(λ (e t a c)
(if (is-cardimage? t a c)
(list t a c)))
(@ ,(attribute-maybe-update 'class cardimage-class-updater attributes))
(list 'div null (list cardimage new-cardtable))))]
; exclude empty figcaptions
[(and (eq? element-type 'figcaption)
(or (eq? (length (filter element-is-element? children)) 0)

View File

@ -166,7 +166,7 @@
(define styles
(format "~a/wikia.php?controller=ThemeApi&method=themeVariables&variant=~a" origin (user-cookies^-theme user-cookies))
(format "~a/load.php?lang=en&" origin)))
(format "~a/load.php?lang=en&" origin)))
(if (config-true? 'strict_proxy)
(map u-proxy-url styles)