From 553f43c7b35260f90de09529d4adfe2ff8e0c98e Mon Sep 17 00:00:00 2001
From: naielv <109038805+naielv@users.noreply.github.com>
Date: Tue, 9 Sep 2025 21:58:07 +0200
Subject: [PATCH] Add weather services
---
src/page/aulas.js | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/page/aulas.js b/src/page/aulas.js
index 13c6bec..7fe1326 100644
--- a/src/page/aulas.js
+++ b/src/page/aulas.js
@@ -13,6 +13,7 @@ PAGES.aulas = {
var data_Comedor = safeuuid();
var data_Tareas = safeuuid();
var data_Diario = safeuuid();
+ var data_Weather = safeuuid();
container.innerHTML = `
Gestión del Aula - en desarrollo
`;
+
+ //#region Cargar Clima
+ // Get location from gun.get("settings").get("weather_location"), if missing ask user and save it
+ // url format: https://wttr.in/?F0m
+ gun
+ .get("settings")
+ .get("weather_location")
+ .once((loc) => {
+ if (!loc) {
+ loc = prompt("Introduce tu ubicación para el clima (ciudad, país):", "Madrid, Spain");
+ if (loc) {
+ betterGunPut(gun.get("settings").get("weather_location"), loc);
+ }
+ }
+ if (loc) {
+ document.getElementById(data_Weather).src = "https://wttr.in/" + encodeURIComponent(loc) + "?F0m";
+ } else {
+ document.getElementById(data_Weather).src = "https://wttr.in/?F0m";
+ }
+ });
+ //#endregion Cargar Clima
//#region Cargar Comedor
gun
.get(TABLE)