Remove ^M in assets/js/*

This commit is contained in:
Santiago Lo Coco 2022-02-14 21:27:11 -03:00
parent 6efd8badbe
commit 8a09e60ef1
2 changed files with 56 additions and 56 deletions

View File

@ -1,8 +1,8 @@
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
const mode_toggle = document.getElementById("light-toggle"); const mode_toggle = document.getElementById("light-toggle");
mode_toggle.addEventListener("click", function() { mode_toggle.addEventListener("click", function() {
toggleTheme(localStorage.getItem("theme")); toggleTheme(localStorage.getItem("theme"));
}); });
}); });

View File

@ -1,48 +1,48 @@
let toggleTheme = (theme) => { let toggleTheme = (theme) => {
if (theme == "dark") { if (theme == "dark") {
setTheme("light"); setTheme("light");
} else { } else {
setTheme("dark"); setTheme("dark");
} }
} }
let setTheme = (theme) => { let setTheme = (theme) => {
transTheme(); transTheme();
if (theme) { if (theme) {
document.documentElement.setAttribute("data-theme", theme); document.documentElement.setAttribute("data-theme", theme);
} }
else { else {
document.documentElement.removeAttribute("data-theme"); document.documentElement.removeAttribute("data-theme");
} }
localStorage.setItem("theme", theme); localStorage.setItem("theme", theme);
if (typeof medium_zoom !== 'undefined') { if (typeof medium_zoom !== 'undefined') {
medium_zoom.update({ medium_zoom.update({
background: getComputedStyle(document.documentElement) background: getComputedStyle(document.documentElement)
.getPropertyValue('--global-bg-color') + 'ee', .getPropertyValue('--global-bg-color') + 'ee',
}) })
} }
}; };
let transTheme = () => { let transTheme = () => {
document.documentElement.classList.add("transition"); document.documentElement.classList.add("transition");
window.setTimeout(() => { window.setTimeout(() => {
document.documentElement.classList.remove("transition"); document.documentElement.classList.remove("transition");
}, 500) }, 500)
} }
let initTheme = (theme) => { let initTheme = (theme) => {
if (theme == null) { if (theme == null) {
const userPref = window.matchMedia; const userPref = window.matchMedia;
if (userPref && userPref('(prefers-color-scheme: dark)').matches) { if (userPref && userPref('(prefers-color-scheme: dark)').matches) {
theme = 'dark'; theme = 'dark';
} }
} }
setTheme(theme); setTheme(theme);
} }
initTheme(localStorage.getItem("theme")); initTheme(localStorage.getItem("theme"));