diff --git a/lib/pure-utils.rkt b/lib/pure-utils.rkt index ff8b933..669418d 100644 --- a/lib/pure-utils.rkt +++ b/lib/pure-utils.rkt @@ -3,20 +3,18 @@ (provide ; call the updater on the dictionary key only if it has that key alist-maybe-update + ; like the above but adds key if not present + alist-overwrite ; update a value only if a condition succeeds on it u ; like string-join, but for lists - list-join - u-counter) + list-join) (module+ test (require "typed-rackunit.rkt")) -(define u-counter (box 0)) - (: alist-maybe-update (∀ (A B) ((Listof (Pairof A B)) A (B -> B) -> (Listof (Pairof A B))))) (define (alist-maybe-update alist key updater) - (set-box! u-counter (add1 (unbox u-counter))) (map (λ ([p : (Pairof A B)]) (if (eq? (car p) key) (cons (car p) (updater (cdr p))) @@ -28,9 +26,17 @@ (check-equal? (alist-maybe-update '((b . 6)) 'a (λ ([x : Number]) (+ x 10))) '((b . 6)))) +(: alist-overwrite (∀ (A B) ((Listof (Pairof A B)) A B -> (Listof (Pairof A B))))) +(define (alist-overwrite alist key value) + (cons (cons key value) (filter (λ ([p : (Pairof A B)]) (not (eq? (car p) key))) alist))) +(module+ test + (check-equal? (alist-overwrite '((a . 5) (b . 6)) 'a 10) + '((a . 10) (b . 6))) + (check-equal? (alist-overwrite '((b . 6)) 'a 10) + '((a . 10) (b . 6)))) + (: u (∀ (A) ((A -> Any) (A -> A) A -> A))) (define (u condition updater value) - (set-box! u-counter (add1 (unbox u-counter))) (if (condition value) (updater value) value)) (module+ test (check-equal? (u (λ ([x : Integer]) (< x 5)) (λ ([x : Integer]) (* x -1)) 4) -4) diff --git a/lib/tree-updater.rkt b/lib/tree-updater.rkt index e911121..7dafb0b 100644 --- a/lib/tree-updater.rkt +++ b/lib/tree-updater.rkt @@ -170,7 +170,7 @@ ; don't lazyload images (curry u (λ (v) (dict-has-key? v 'data-src)) - (λ (v) (attribute-maybe-update 'src (λ (_) (car (dict-ref v 'data-src))) v))) + (λ (v) (alist-overwrite v 'src (list (dict-ref v 'data-src))))) ; don't use srcset - TODO: use srcset? (λ (v) (dict-remove v 'srcset)))) diff --git a/src/fandom-request.rkt b/src/fandom-request.rkt index c306b04..89e5276 100644 --- a/src/fandom-request.rkt +++ b/src/fandom-request.rkt @@ -50,8 +50,8 @@ (or (and ((current-inexact-milliseconds) . < . (+ last-failure failure-persist-time)) stored-failure) (let () - (define dest-url (string-append "https://www.fandom.com" path)) - (define host (string-append wikiname ".fandom.com")) + (define dest-url (format "https://~a.fandom.com~a" wikiname path)) + (define host (format "~a.fandom.com" wikiname)) (log-outgoing wikiname path) (define res (get dest-url diff --git a/static/icon-theme-dark.svg b/static/icon-theme-dark.svg index bc36ede..aa11646 100644 --- a/static/icon-theme-dark.svg +++ b/static/icon-theme-dark.svg @@ -1,2 +1 @@ - diff --git a/static/icon-theme-default.svg b/static/icon-theme-default.svg index 4f5655c..e8ca2cb 100644 --- a/static/icon-theme-default.svg +++ b/static/icon-theme-default.svg @@ -1,2 +1 @@ - diff --git a/static/icon-theme-light.svg b/static/icon-theme-light.svg index cc19c3a..3595f4a 100644 --- a/static/icon-theme-light.svg +++ b/static/icon-theme-light.svg @@ -1,2 +1 @@ - diff --git a/static/main.css b/static/main.css index 6e40f28..7b1c4ca 100644 --- a/static/main.css +++ b/static/main.css @@ -204,6 +204,14 @@ figcaption, .lightbox-caption, .thumbcaption { list-style-type: none; padding: 0; } +.wikia-slideshow-wrapper, .wikia-slideshow-images { + width: auto !important; + height: auto !important; + list-style-type: none; +} +.wikia-slideshow-toolbar { + display: none; +} /* show tabs if tabs.js isn't loaded */ .bw-tabs-nojs .wds-tabs__wrapper {