This commit is contained in:
sky
2025-11-23 10:56:29 -05:00
parent 3cdee505d9
commit e60e6791d9
7 changed files with 110 additions and 10 deletions

View File

@ -31,6 +31,11 @@
<link rel="icon" href="https://ixl.com/ixl-favicon.png" id="favicon" />
<!-- <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415518411898563" crossorigin="anonymous"></script> -->
<script>
window.addEventListener('beforeunload', function (event) {
event.preventDefault();
event.returnValue = '';
return 'Are you sure you want to leave? Any unsaved changes will be lost.';
});
function connectToSocket() {
let socket = new WebSocket("/socket");
socket.addEventListener("open", () => {
@ -107,7 +112,7 @@
let weatherData = await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${locationData.latitude}&longitude=${locationData.longitude}&current=temperature_2m,weather_code&temperature_unit=fahrenheit`)
.then(data => data.json());
document.getElementById("weather").innerText = `${Math.round(weatherData["current"]["temperature_2m"])}°C ${weatherCodeToEmoji[weatherData["current"]["weather_code"]]}`
document.getElementById("weather").innerText = `${Math.round(weatherData["current"]["temperature_2m"])}°F ${weatherCodeToEmoji[weatherData["current"]["weather_code"]]}`
}
function updateTime() {
document.getElementById("time").innerText = (new Date()).toLocaleTimeString();
@ -255,7 +260,7 @@
<div id="bottom-menu">
<div class="bottom-item"><p id="online">currently online: --</p></div>
<div class="bottom-item"><p>|</p></div>
<div class="bottom-item"><p id="weather">--° 🌩️</p></div>
<div class="bottom-item"><p id="weather">--°F 🌩️</p></div>
<div class="bottom-item"><p>|</p></div>
<div class="bottom-item"><p id="time">7:41:21 pm</p></div>
</div>