Settings refactor / add birb

This commit is contained in:
2026-05-13 12:30:45 -05:00
parent e728ddac2c
commit 82f47093a7
13 changed files with 192 additions and 74 deletions

View File

@@ -1,7 +1,7 @@
<!-- weather -->
<!-- Based on https://codepen.io/codeconvey/pen/xRzQay -->
{# This include causes a symbol (text, emoji, et cetera; from metadata.weatherSymbol) to fall from the top of the viewport like snow. #}
<div class="fallingObjects" id="weather" aria-hidden="true">
<div class="fallingObjects hidden" id="weather" aria-hidden="true">
<div class="fallingObject">
<div>{{ metadata.weatherSymbol }}</div>
</div>
@@ -34,29 +34,15 @@
</div>
</div>
<script>
const weather = document.getElementById("weather");
const weatherToggle = document.getElementById("weatherToggle");
const weatherPreference = localStorage.getItem("weather");
<script>
const turnOnWeather = (containerId) => {
const container = document.getElementById(containerId);
weather.classList.remove("hidden");
}
// Initial weather preference check on page load
if ({% if metadata.weatherOnByDefault == false %}!weatherPreference || {% endif %}weatherPreference == 0) {
weather.classList.add("hidden");
weatherToggle.checked = false;
} else {
weather.classList.remove("hidden");
weatherToggle.checked = true;
};
// Handle weather setting toggle
weatherToggle.addEventListener('change', function() {
if (this.checked) {
localStorage.setItem("weather", 1);
weather.classList.remove("hidden");
} else {
localStorage.setItem("weather", 0);
weather.classList.add("hidden");
};
});
</script>
const turnOffWeather = (containerId) => {
const container = document.getElementById(containerId);
weather.classList.add("hidden");
}
</script>
<!-- /weather -->