forked from cadence/breezewiki
Fix yugioh wiki card pages (only half-fixed in offline environments)
This commit is contained in:
parent
5c3a0c2715
commit
91a7439007
6 changed files with 28 additions and 2 deletions
|
@ -17,6 +17,7 @@ image/png png
|
|||
image/tiff tiff
|
||||
image/vnd.wap.wbmp wbmp
|
||||
image/x-icon ico
|
||||
image/vnd.microsoft.icon ico
|
||||
image/x-jng jng
|
||||
image/x-ms-bmp bmp
|
||||
image/svg+xml svg
|
||||
|
|
|
@ -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
|
||||
(compose1
|
||||
; uncollapsing
|
||||
|
@ -184,6 +187,24 @@
|
|||
((class "table-scroller"))
|
||||
((,element-type (@ (data-scrolling) ,@attributes)
|
||||
,@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
|
||||
[(and (eq? element-type 'figcaption)
|
||||
(or (eq? (length (filter element-is-element? children)) 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue