Loosen criteria for noscript images

This commit is contained in:
blankie 2022-12-04 19:31:34 +07:00
parent f216a1996a
commit 95418613e5
Signed by untrusted user: blankie
GPG key ID: CC15FC822C7F61F5

View file

@ -39,6 +39,11 @@
(img (@ (src "data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D") (img (@ (src "data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D")
(data-src "https://static.wikia.nocookie.net/nice-image-thumbnail.png") (data-src "https://static.wikia.nocookie.net/nice-image-thumbnail.png")
(class "thumbimage lazyload")))) (class "thumbimage lazyload"))))
(noscript
(a (@ (href "https://static.wikia.nocookie.net/nice-image.png") (title "a nice image") (three-attribs))
(img (@ (src "https://static.wikia.nocookie.net/nice-image-thumbnail.png")
(data-src "https://static.wikia.nocookie.net/nice-image-thumbnail.png")
(class "thumbimage")))))
(noscript (noscript
(a (@ (href "https://static.wikia.nocookie.net/nice-image.png") (class "image")) (a (@ (href "https://static.wikia.nocookie.net/nice-image.png") (class "image"))
(img (@ (src "https://static.wikia.nocookie.net/nice-image-thumbnail.png") (img (@ (src "https://static.wikia.nocookie.net/nice-image-thumbnail.png")
@ -193,8 +198,8 @@
; remove noscript versions of images because they are likely lower quality than the script versions ; remove noscript versions of images because they are likely lower quality than the script versions
[(and (eq? element-type 'noscript) [(and (eq? element-type 'noscript)
(match children (match children
; either the noscript has a.image as a first child... ; either the noscript has an a, with attributes and an img as a first child, as a first child...
[(list (list 'a (list '@ a-att ...) _)) (has-class? "image" a-att)] [(list (list 'a (list '@ _ ...) (list 'img _))) #t]
; or the noscript has img as a first child ; or the noscript has img as a first child
[(list (list 'img _)) #t] [(list (list 'img _)) #t]
[_ #f])) [_ #f]))