From 672675f0f94294f5c65af546a63a089bb8512f5b Mon Sep 17 00:00:00 2001 From: Francesco Date: Mon, 22 Apr 2024 17:12:48 +0200 Subject: [PATCH] Theme Update --- assets/css/main.css | 9 +++++++++ assets/js/main.js | 15 ++++++++++++++- layouts/_default/_markup/render-image.html | 9 +++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 layouts/_default/_markup/render-image.html diff --git a/assets/css/main.css b/assets/css/main.css index 0d6d5d8..e43e93b 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -281,4 +281,13 @@ footer a { .autonumber h4:before { content: counter(h2-counter) "." counter(h3-counter) "." counter(h4-counter) "\00a0\00a0"; +} + +/* Dark mode */ +.dark .img-light { + display: none !important; +} + +.light .img-dark { + display: none !important; } \ No newline at end of file diff --git a/assets/js/main.js b/assets/js/main.js index e2aac52..b27f7f1 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1 +1,14 @@ -console.log('This site was generated by Hugo.'); +const images = document.querySelectorAll('img'); + +images.forEach(img => { + + if (img.src.endsWith('#dark-mode')) { + + console.log('found'); + + img.onload = function () { + console.log(`Image loaded: ${img.src}`); + }; + + } +}); \ No newline at end of file diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html new file mode 100644 index 0000000..ffcaab3 --- /dev/null +++ b/layouts/_default/_markup/render-image.html @@ -0,0 +1,9 @@ +{{ $url := .Destination | safeURL }} + +{{/* Append class to figures based on ending -> #dark or #light */}} + +
+ +
\ No newline at end of file