This commit is contained in:
Simon Gardling
2023-10-11 17:38:05 -04:00
commit 032679b34a
242 changed files with 9311 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import Zooming from '../lib/js/zooming-v2.1.1.min.js';
document.addEventListener('DOMContentLoaded', function () {
let bgColor;
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
bgColor = '#333';
} else {
bgColor = '#fff';
}
zooming = new Zooming({
transitionDuration: 0.2,
bgColor: bgColor,
});
zooming.listen('#content img');
const dark_mode_btn = document.getElementById("dark_mode_btn");
const light_mode_btn = document.getElementById("light_mode_btn");
dark_mode_btn.addEventListener('click', function () {
zooming.config({bgColor: '#333'});
});
light_mode_btn.addEventListener('click', function () {
zooming.config({bgColor: '#fff'});
});
});