diff --git a/lib/pure-utils.rkt b/lib/pure-utils.rkt index 669418d..ff8b933 100644 --- a/lib/pure-utils.rkt +++ b/lib/pure-utils.rkt @@ -3,18 +3,20 @@ (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) + list-join + u-counter) (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))) @@ -26,17 +28,9 @@ (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 7dafb0b..e911121 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) (alist-overwrite v 'src (list (dict-ref v 'data-src))))) + (λ (v) (attribute-maybe-update 'src (λ (_) (car (dict-ref v 'data-src))) v))) ; 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 89e5276..c306b04 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 (format "https://~a.fandom.com~a" wikiname path)) - (define host (format "~a.fandom.com" wikiname)) + (define dest-url (string-append "https://www.fandom.com" path)) + (define host (string-append wikiname ".fandom.com")) (log-outgoing wikiname path) (define res (get dest-url diff --git a/static/icon-theme-dark.svg b/static/icon-theme-dark.svg index aa11646..bc36ede 100644 --- a/static/icon-theme-dark.svg +++ b/static/icon-theme-dark.svg @@ -1 +1,2 @@ + diff --git a/static/icon-theme-default.svg b/static/icon-theme-default.svg index e8ca2cb..4f5655c 100644 --- a/static/icon-theme-default.svg +++ b/static/icon-theme-default.svg @@ -1 +1,2 @@ + diff --git a/static/icon-theme-light.svg b/static/icon-theme-light.svg index 3595f4a..cc19c3a 100644 --- a/static/icon-theme-light.svg +++ b/static/icon-theme-light.svg @@ -1 +1,2 @@ + diff --git a/static/main.css b/static/main.css index 7b1c4ca..6e40f28 100644 --- a/static/main.css +++ b/static/main.css @@ -204,14 +204,6 @@ 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 {