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 untrusted user: cadence
GPG key ID: BC1C2C61CF521B17
6 changed files with 28 additions and 2 deletions

View file

@ -100,7 +100,7 @@
(theme "default") (theme "default")
(theme "light") (theme "light")
(theme "dark") (theme "dark")
(cons (format "https://~a.fandom.com/load.php?lang=en&modules=skin.fandomdesktop.styles%7Cext.fandom.PortableInfoboxFandomDesktop.css%7Cext.fandom.GlobalComponents.CommunityHeaderBackground.css%7Cext.gadget.site-styles%2Csound-styles%7Csite.styles&only=styles&skin=fandomdesktop" wikiname) (cons (format "https://~a.fandom.com/load.php?lang=en&modules=site.styles%7Cskin.fandomdesktop.styles%7Cext.fandom.PortableInfoboxFandomDesktop.css%7Cext.fandom.GlobalComponents.CommunityHeaderBackground.css%7Cext.gadget.site-styles%2Csound-styles&only=styles&skin=fandomdesktop" wikiname)
(build-path save-dir "site.css")))) (build-path save-dir "site.css"))))
(for ([style styles] (for ([style styles]
[i (in-naturals)]) [i (in-naturals)])

3
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"))

1
archiver/req.rktd Normal file
View file

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

View file

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

View file

@ -97,6 +97,9 @@
(string-replace-curried "pi-collapse-closed" "") (string-replace-curried "pi-collapse-closed" "")
(string-replace-curried "pi-collapse" ""))) (string-replace-curried "pi-collapse" "")))
(define (cardimage-class-updater c)
(string-append c " bw-updated-cardtable-cardimage"))
(define attributes-updater (define attributes-updater
(compose1 (compose1
; uncollapsing ; uncollapsing
@ -184,6 +187,24 @@
((class "table-scroller")) ((class "table-scroller"))
((,element-type (@ (data-scrolling) ,@attributes) ((,element-type (@ (data-scrolling) ,@attributes)
,@children)))] ,@children)))]
; 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)
return-no-element
(list t a c)))
`(,element-type
(@ ,(attribute-maybe-update 'class cardimage-class-updater attributes))
,@children))])
(list 'div null (list cardimage new-cardtable))))]
; exclude empty figcaptions ; exclude empty figcaptions
[(and (eq? element-type 'figcaption) [(and (eq? element-type 'figcaption)
(or (eq? (length (filter element-is-element? children)) 0) (or (eq? (length (filter element-is-element? children)) 0)

View file

@ -166,7 +166,7 @@
(define styles (define styles
(list (list
(format "~a/wikia.php?controller=ThemeApi&method=themeVariables&variant=~a" origin (user-cookies^-theme user-cookies)) (format "~a/wikia.php?controller=ThemeApi&method=themeVariables&variant=~a" origin (user-cookies^-theme user-cookies))
(format "~a/load.php?lang=en&modules=skin.fandomdesktop.styles%7Cext.fandom.PortableInfoboxFandomDesktop.css%7Cext.fandom.GlobalComponents.CommunityHeaderBackground.css%7Cext.gadget.site-styles%2Csound-styles%7Csite.styles&only=styles&skin=fandomdesktop" origin))) (format "~a/load.php?lang=en&modules=site.styles%7Cskin.fandomdesktop.styles%7Cext.fandom.PortableInfoboxFandomDesktop.css%7Cext.fandom.GlobalComponents.CommunityHeaderBackground.css%7Cext.gadget.site-styles%2Csound-styles&only=styles&skin=fandomdesktop" origin)))
(if (config-true? 'strict_proxy) (if (config-true? 'strict_proxy)
(map u-proxy-url styles) (map u-proxy-url styles)
styles)] styles)]