Use Prettier

This commit is contained in:
prototypa
2022-09-11 03:51:55 -04:00
parent 51362812c8
commit d909adb658
52 changed files with 1487 additions and 1447 deletions

View File

@@ -2,47 +2,47 @@
---
<script is:inline>
// Set "light" theme as default
// if (!localStorage.theme) {
// localStorage.theme = "light";
// }
// Set "light" theme as default
// if (!localStorage.theme) {
// localStorage.theme = "light";
// }
if (
localStorage.theme === "dark" ||
(!("theme" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches)
) {
document.documentElement.classList.add("dark");
} else {
document.documentElement.classList.remove("dark");
}
if (
localStorage.theme === 'dark' ||
(!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark');
}
function attachEvent(selector, event, fn) {
const matches = document.querySelectorAll(selector);
if (matches && matches.length) {
matches.forEach((elem) => {
elem.addEventListener(event, () => fn(elem), false);
});
}
}
function attachEvent(selector, event, fn) {
const matches = document.querySelectorAll(selector);
if (matches && matches.length) {
matches.forEach((elem) => {
elem.addEventListener(event, () => fn(elem), false);
});
}
}
window.onload = function () {
attachEvent("[data-aw-toggle-menu]", "click", function (elem) {
elem.classList.toggle("expanded");
document.body.classList.toggle("overflow-hidden");
document.getElementById("menu")?.classList.toggle("hidden");
});
window.onload = function () {
attachEvent('[data-aw-toggle-menu]', 'click', function (elem) {
elem.classList.toggle('expanded');
document.body.classList.toggle('overflow-hidden');
document.getElementById('menu')?.classList.toggle('hidden');
});
attachEvent("[data-aw-toggle-color-scheme]", "click", function () {
document.documentElement.classList.toggle("dark");
localStorage.theme = document.documentElement.classList.contains("dark") ? "dark" : "light";
});
};
window.onpageshow = function () {
const elem = document.querySelector("[data-aw-toggle-menu]");
if (elem) {
elem.classList.remove("expanded");
}
document.body.classList.remove("overflow-hidden");
document.getElementById("menu")?.classList.add("hidden");
};
attachEvent('[data-aw-toggle-color-scheme]', 'click', function () {
document.documentElement.classList.toggle('dark');
localStorage.theme = document.documentElement.classList.contains('dark') ? 'dark' : 'light';
});
};
window.onpageshow = function () {
const elem = document.querySelector('[data-aw-toggle-menu]');
if (elem) {
elem.classList.remove('expanded');
}
document.body.classList.remove('overflow-hidden');
document.getElementById('menu')?.classList.add('hidden');
};
</script>