From c992afdfa00b0f2bcdb71ab256002c0db054a6d6 Mon Sep 17 00:00:00 2001 From: saturn Date: Thu, 20 Apr 2023 02:34:09 -0500 Subject: [PATCH] New dark mode implementation, part 1. --- lw2-viewer.asd | 2 +- lw2.lisp | 3 +- src/clean-html.lisp | 1 + src/images.lisp | 7 ++--- src/resources.lisp | 74 +++++++++++++++++++++++++++++++++++++++++-------- www/head.js | 2 +- www/script.js | 79 +++++++++++++++++++++++++++++++---------------------- 7 files changed, 118 insertions(+), 50 deletions(-) diff --git a/lw2-viewer.asd b/lw2-viewer.asd index fc1ed92e..7d346164 100644 --- a/lw2-viewer.asd +++ b/lw2-viewer.asd @@ -45,7 +45,7 @@ (:static-file "../text-clean-regexps.js") (:static-file "../html-clean-regexps.js") (:file "colors" :depends-on ("utils")) - (:file "images" :depends-on ("conditions" "html-reader" "utils" "lmdb" "backend" "legacy-archive")) + (:file "images" :depends-on ("conditions" "html-reader" "utils" "lmdb" "backend" "legacy-archive" "resources")) (:file "elicit-predictions" :depends-on ("utils" "html-reader" "backend" "graphql")) (:file "clean-html" :depends-on ("utils" "links" "lmdb" "backend" "context" "sites" "conditions" "colors" "images" "elicit-predictions" "../text-clean-regexps.js" "../html-clean-regexps.js")) (:file "lw2-login" :depends-on ("utils" "backend" "backend-modules" "context")) diff --git a/lw2.lisp b/lw2.lisp index 56535026..023a06fb 100644 --- a/lw2.lisp +++ b/lw2.lisp @@ -869,7 +869,8 @@ signaled condition to *HTML-OUTPUT*." (t (values t nil))) (when (not *revalidate-default*) - (setf (hunchentoot:header-out :cache-control) (format nil "public, max-age=~A" (* 5 60)))) + (setf (hunchentoot:header-out :cache-control) (format nil "public, max-age=~A" (* 5 60)) + (hunchentoot:header-out :vary) "cookie")) (when (site-domain *current-site*) (setf (hunchentoot:header-out :origin-agent-cluster) "?0")) ; Allow document.domain in Chrome: https://developer.chrome.com/blog/immutable-document-domain/ (let ((*memoized-output-without-hyphens* diff --git a/src/clean-html.lisp b/src/clean-html.lisp index c9c17715..87802d9d 100644 --- a/src/clean-html.lisp +++ b/src/clean-html.lisp @@ -1107,6 +1107,7 @@ (with-output-to-string (out-stream out-string) (style-hash-to-html style-hash out-stream) (when (> (hash-table-count used-colors) 0) + #.(warn "need to finish updating this for the new dark mode system") (format out-stream "