Configurando app del tiempo dentro de aplcicaciones de vanguardia

This commit is contained in:
Tatiana Villa 2026-02-01 00:51:43 +00:00
parent b930ada807
commit 6203df95a0
22 changed files with 2027 additions and 0 deletions

View File

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Agenda Espiritual AGE</title>
<link href="https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,600;1,400&family=Nunito:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/bullet-journal.css">
</head>
<body>
<div class="no-print">
<header>
<h1>Bullet Jounal</h1>
</header>
<div class="toolbar">
<div class="day-nav">
<button onclick="changeDay(-1)"></button>
<span id="currentDateDisplay"></span>
<button onclick="changeDay(1)"></button>
</div>
<div class="print-actions">
<button onclick="printFullMonth('A5')">Imprimir Mes (A5)</button>
<button onclick="printPlannerA4()">Planner Corcho (A4)</button>
</div>
</div>
<section class="card daily-panel">
<h3 id="saintDisplay">Cargando santoral...</h3>
<p id="cumpleDisplay" style="color: var(--color-acento);"></p>
<div class="tracker-group">
<label><input type="checkbox" id="rosario" class="checkbox"> Rosario</label>
<label><input type="checkbox" id="vitaminas" class="checkbox"> Vitaminas/Medicina</label>
</div>
<div class="input-group">
<label>Pasos: <input type="number" id="caminar" placeholder="0"></label>
<label>Agua (vasos): <input type="number" id="agua" placeholder="0"></label>
</div>
<label>Reflexión / Notas:</label>
<textarea id="mood" placeholder="¿Cómo ha ido el día?"></textarea>
</section>
<button class="reset" onclick="resetData()">Borrar Historial</button>
</div>
<div id="printArea" class="only-print"></div>
<script src="js/bullet-journal.js"></script>
</body>
</html>

View File

@ -0,0 +1,83 @@
:root {
--color-primario: #F5F5F5;
--color-hover: #1E3A5F;
--color-fondo: #0D0D0D;
--color-texto: #E5E5E5;
--color-acento: #5FAEDB;
--color-borde: rgba(95, 174, 219, 0.3);
--color-tarjeta: rgba(20,20,20,0.85);
}
body {
margin: 0;
font-family: 'Nunito', sans-serif;
background: radial-gradient(circle at top, #111827, #0D0D0D);
color: var(--color-texto);
padding: 15px;
}
/* INTERFAZ PANTALLA */
.no-print { max-width: 600px; margin: auto; }
.toolbar { text-align: center; margin-bottom: 20px; }
.day-nav { display: flex; justify-content: center; align-items: center; gap: 20px; margin-bottom: 15px; }
button {
padding: 10px 15px;
border-radius: 12px;
border: 1px solid var(--color-borde);
background: var(--color-tarjeta);
color: white;
cursor: pointer;
transition: 0.3s;
}
button:hover { background: var(--color-hover); }
.card {
background: var(--color-tarjeta);
padding: 20px;
border-radius: 15px;
border: 1px solid var(--color-borde);
backdrop-filter: blur(10px);
}
textarea {
width: 100%; height: 150px; margin-top: 10px;
background: #111; color: white; border: 1px solid #333; border-radius: 8px; padding: 10px;
}
/* LÓGICA DE IMPRESIÓN */
.only-print { display: none; }
@media print {
.no-print { display: none !important; }
.only-print { display: block !important; }
body { background: white; color: black; }
.page-a5 {
width: 148mm; height: 210mm;
padding: 15mm;
page-break-after: always;
border-bottom: 1px dashed #ccc;
position: relative;
color: black;
}
.dots-bg {
background-image: radial-gradient(#ddd 1px, transparent 1px);
background-size: 5mm 5mm;
height: 120mm;
border: 1px solid #eee;
}
.planner-a4 {
width: 210mm; height: 297mm;
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 2px;
background: black;
}
.planner-day { background: white; height: 40mm; padding: 5px; font-size: 10px; }
}

250
eltiempo/css/estilos.css Normal file
View File

@ -0,0 +1,250 @@
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,600;1,400&family=Nunito:wght@400;600&display=swap');
:root {
/* Paleta refinada */
--color-primario: #F5F5F5; /* Azul noche espiritual */
--color-hover: #1E3A5F; /* Azul profundo para hover */
--color-secundario: #A1A1A1; /* Azul muy suave */
--color-fondo: #0D0D0D; /* Fondo principal */
--color-texto: #E5E5E5; /* Gris claro para texto */
--blanco-puro: #FFFFFF;
--sombra: rgba(47, 58, 86, 0.15);
--color-tarjeta: #1A1A1A;
--color-acento: #5FAEDB;
--color-borde: rgba(95, 174, 219, 0.3);
}
body {
margin: 0;
font-family: 'Nunito', sans-serif;
background: linear-gradient(180deg, #0D0D0D 0%, #111827 100%);
color: var(--color-texto);
line-height: 1.7;
-webkit-font-smoothing: antialiased;
}
header {
padding: 1.5rem 0;
text-align: center;
}
header h1 {
font-family: 'EB Garamond', serif;
letter-spacing: 1px;
color: var(--color-acento);
margin: 0;
}
nav ul {
list-style: none;
padding: 0;
margin: 0 auto 2rem;
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 10px;
}
nav a {
color: var(--color-primario);
border-radius: 20px;
transition: all 0.3s ease;
}
nav a:hover {
background-color: var(--color-hover);
transform: translateY(-2px);
}
.container {
width: 92%;
max-width: 1200px;
margin: auto;
padding: 2rem 0;
display: grid;
gap: 2rem;
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.tarjeta {
background: rgba(20, 20, 20, 0.75);
backdrop-filter: blur(4px);
border-radius: 14px;
border: 1px solid var(--color-borde);
box-shadow: 0 10px 20px rgba(0,0,0,.35);
transition: all 0.3s ease;
overflow: hidden;
cursor: pointer;
}
.tarjeta:hover {
transform: translateY(-6px);
box-shadow: 0 16px 30px rgba(0,0,0,.5);
}
.tarjeta h2 {
margin: 0;
padding: 12px;
font-family: 'EB Garamond', serif;
font-size: 1.3rem;
text-align: center;
color: var(--color-acento);
background: rgba(13, 13, 13, 0.8);
border-bottom: 1px solid rgba(255,255,255,.1);
}
/* --- Párrafos generales de todas las tarjetas --- */
.tarjeta p {
text-align: center;
color: var(--color-texto);
font-size: 1rem;
margin: 2px 0; /* menos espacio entre líneas */
padding: 0; /* eliminar padding extra */
}
/* --- Ajuste para dispositivos pequeños --- */
@media (max-width: 600px) {
header h1 {
font-size: 1.6rem;
}
nav ul {
flex-direction: column;
align-items: center;
}
.container {
gap: 1.2rem;
}
}
footer {
text-align: center;
padding: 1.5rem 0;
color: var(--color-secundario);
margin-top: 3rem;
background: transparent;
}
/* --- Tarjeta Amanecer/Anochecer: más compacta --- */
#moon-mini-calendar {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 6px;
margin-top: 10px;
text-align: center;
}
.moon-day {
padding: 4px;
border-radius: 6px;
background: var(--color-fondo);
font-size: 0.9rem;
}
.moon-today {
background: var(--color-hover);
font-weight: bold;
}
.moon-icon {
font-size: 1.4rem;
display: block;
}
#moon-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
margin-top: 10px;
margin-bottom: 6px;
text-align: center;
font-weight: 600;
color: var(--color-acento);
font-size: 0.85rem;
}
#moon-weekdays span {
padding: 4px 0;
border-bottom: 1px solid var(--color-borde);
}
/* ---------- BULLET JOURNAL SUMMARY ---------- */
#bullet-summary {
cursor: default;
}
#bullet-summary .bj-resumen {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
padding: 14px;
}
#bullet-summary .bj-item {
background: rgba(13,13,13,0.8);
border: 1px solid var(--color-borde);
border-radius: 10px;
padding: 10px;
text-align: center;
box-shadow: inset 0 0 12px rgba(0,0,0,.4);
}
#bullet-summary .bj-item span {
display: block;
font-size: 0.75rem;
color: var(--color-secundario);
letter-spacing: .5px;
}
#bullet-summary .bj-item strong {
font-size: 1.4rem;
font-family: 'EB Garamond', serif;
color: var(--color-acento);
}
/* Botón */
#bullet-summary .btn , #weather-card .btn {
display: block;
width: 75%;
margin: 12px auto 14px;
padding: 10px;
background: linear-gradient(135deg, #1E3A5F, #111827);
color: var(--blanco-puro);
border-radius: 12px;
text-align: center;
text-decoration: none;
font-size: 0.9rem;
border: 1px solid var(--color-borde);
transition: all .3s ease;
}
#bullet-summary .btn:hover, #weather-card .btn:hover {
background: linear-gradient(135deg, #2b4f80, #1E293B);
transform: translateY(-2px);
}
/* ICONOS */
.termometro {
width: 48px;
}
.termometro.neutro {
fill: var(--color-primario);
}
.termometro.frio {
fill: var(--color-acento);
}
.termometro.calor {
fill: #f44336;
}
.termometro.templado { fill: #4caf50; }

View File

@ -0,0 +1,12 @@
[
{ "fecha": "01-27", "persona": "Prueba Prueba" },
{ "fecha": "02-14", "persona": "Andrea Postlbauer" },
{ "fecha": "04-08", "persona": "Tatiana Villa" },
{ "fecha": "10-14", "persona": "Jose Luis Villa" },
{ "fecha": "10-17", "persona": "Patricia Villa" },
{ "fecha": "10-19", "persona": "Mercedes Ema" },
{ "fecha": "10-24", "persona": "Arantxa Villa" },
{ "fecha": "11-24", "persona": "Nicolas Postlbauer" },
{ "fecha": "11-27", "persona": "Leo Postlbauer" }
]

368
eltiempo/data/santos.json Normal file
View File

@ -0,0 +1,368 @@
[
{ "fecha": "2026-01-01", "santo": "Santa María, Madre de Dios", "color": "rosa" },
{ "fecha": "2026-01-02", "santo": "San Basilio Magno y San Gregorio Nacianceno" },
{ "fecha": "2026-01-03", "santo": "Santísimo Nombre de Jesús" },
{ "fecha": "2026-01-04", "santo": "Santa Ángela de Foligno" },
{ "fecha": "2026-01-05", "santo": "San Genovevo Torres"},
{ "fecha": "2026-01-06", "santo": "Epifanía del Señor", "color": "rojo" },
{ "fecha": "2026-01-07", "santo": "San Raimundo de Peñafort" },
{ "fecha": "2026-01-08", "santo": "San Severino" },
{ "fecha": "2026-01-09", "santo": "San Eulogio de Córdoba" },
{ "fecha": "2026-01-10", "santo": "San Gonzalo" },
{ "fecha": "2026-01-11", "santo": "Bautismo del Señor", "color": "blanco" },
{ "fecha": "2026-01-12", "santo": "Santa Tatiana" },
{ "fecha": "2026-01-13", "santo": "San Hilario de Poitiers" },
{ "fecha": "2026-01-14", "santo": "San Félix de Nola" },
{ "fecha": "2026-01-15", "santo": "San Mauro" },
{ "fecha": "2026-01-16", "santo": "San Marcelo I, Papa" },
{ "fecha": "2026-01-17", "santo": "San Antonio Abad", "descripcion":"Patron de los animales" },
{ "fecha": "2026-01-18", "santo": "Santa Prisca" },
{ "fecha": "2026-01-19", "santo": "San Mario", "descripcion":"y familia" },
{ "fecha": "2026-01-20", "santo": "San Sebastián", "descripcion":"mártir" },
{ "fecha": "2026-01-21", "santo": "Santa Inés", "descripcion":"virgen y mártir" },
{ "fecha": "2026-01-22", "santo": "San Vicente", "descripcion":"mártir" },
{ "fecha": "2026-01-23", "santo": "San Ildefonso de Toledo", "descripcion":"obispo" },
{ "fecha": "2026-01-24", "santo": "San Francisco de Sales", "descripcion":"Doctor de la Iglesia" },
{ "fecha": "2026-01-25", "santo": "Conversión de San Pablo", "descripcion":"apóstol" },
{ "fecha": "2026-01-26", "santo": "San Timoteo y San Tito", "descripcion":"obispos" },
{ "fecha": "2026-01-27", "santo": "Santa Ángela Merici" },
{ "fecha": "2026-01-28", "santo": "Santo Tomás de Aquino", "descripcion":"Doctor de la Iglesia. Patrón de los estudiantes, teólogo, filósofo" },
{ "fecha": "2026-01-29", "santo": "San Valero de Zaragoza" },
{ "fecha": "2026-01-30", "santo": "Santa Martina" },
{ "fecha": "2026-01-31", "santo": "San Juan Bosco", "descripcion":"Fundador de los Salesianos" },
{ "fecha": "2026-02-01", "santo": "Santa Brígida", "descripcion":"Patrona de Europa" },
{ "fecha": "2026-02-02", "santo": "Presentación del Señor (Candelaria)", "descripcion":"La Virgen María y San José presentan al Niño Jesús en el Templo" },
{ "fecha": "2026-02-03", "santo": "San Blas", "descripcion":"Protector de las enfermedades de garganta" },
{ "fecha": "2026-02-04", "santo": "San Gilberto", "descripcion":"obispo" },
{ "fecha": "2026-02-05", "santo": "Santa Águeda", "descripcion":"Patrona de las mujeres" },
{ "fecha": "2026-02-06", "santo": "San Pablo Miki", "descripcion":"y compañeros mártires" },
{ "fecha": "2026-02-07", "santo": "San Ricardo", "descripcion":"mártir" },
{ "fecha": "2026-02-08", "santo": "San Jerónimo Emiliani", "descripcion":"Patrón de los huérfanos" },
{ "fecha": "2026-02-09", "santo": "Santa Apolonia", "descripcion":"mártir" },
{ "fecha": "2026-02-10", "santo": "Santa Escolástica", "descripcion":"hermana de San Benito" },
{ "fecha": "2026-02-11", "santo": "Nuestra Señora de Lourdes", "descripcion":"La Virgen María se apareció en Lourdes a Santa Bernardita" },
{ "fecha": "2026-02-12", "santo": "Santa Eulalia de Barcelona", "descripcion":"virgen y mártir" },
{ "fecha": "2026-02-13", "santo": "San Benigno", "descripcion":"mártir" },
{ "fecha": "2026-02-14", "santo": "San Valentín","descripcion":"Patrón de los enamorados" },
{ "fecha": "2026-02-15", "santo": "San Claudio de la Colombière","descripcion":"confesor" },
{ "fecha": "2026-02-16", "santo": "San Onésimo", "descripcion":"esclavo convertido por San Pablo" },
{ "fecha": "2026-02-17", "santo": "Los Siete Santos Fundadores","descripcion":"de la Orden de los Servitas" },
{ "fecha": "2026-02-18", "santo": "Miércoles de Ceniza","descripcion":"Inicio de la Cuaresma" },
{ "fecha": "2026-02-19", "santo": "San Álvaro de Córdoba", "descripcion":"confesor" },
{ "fecha": "2026-02-20", "santo": "San Eleuterio" },
{ "fecha": "2026-02-21", "santo": "San Pedro Damián", "descripcion":"obispo y doctor de la Iglesia" },
{ "fecha": "2026-02-22", "santo": "Cátedra de San Pedro", "descripcion":"Fiesta de San Pedro, apóstol" },
{ "fecha": "2026-02-23", "santo": "San Policarpo", "descripcion":"obispo y mártir" },
{ "fecha": "2026-02-24", "santo": "San Modesto", "descripcion":"mártir" },
{ "fecha": "2026-02-25", "santo": "San Cesáreo de Nazianzo", "descripcion":"obispo" },
{ "fecha": "2026-02-26", "santo": "San Alejandro de Alejandría", "descripcion":"mártir" },
{ "fecha": "2026-02-27", "santo": "San Leandro de Sevilla", "descripcion":"obispo" },
{ "fecha": "2026-02-28", "santo": "San Román", "descripcion":"mártir" },
{ "fecha": "2026-02-29", "santo": "San Osvaldo" },
{ "fecha": "2026-03-01", "santo": "San David de Gales" },
{ "fecha": "2026-03-02", "santo": "San Chad de Mercia" },
{ "fecha": "2026-03-03", "santo": "San Casimiro", "descripcion":"Patrón de Polonia" },
{ "fecha": "2026-03-04", "santo": "San Lucio I, Papa" },
{ "fecha": "2026-03-05", "santo": "San Adrián de Nicomedia" },
{ "fecha": "2026-03-06", "santo": "San Coleta de Corbie" },
{ "fecha": "2026-03-07", "santo": "San Perpetuo y San Feliciano" },
{ "fecha": "2026-03-08", "santo": "San Juan de Dios", "descripcion":"Patrón de los hospitales" },
{ "fecha": "2026-03-09", "santo": "San Francescó de Borgia" },
{ "fecha": "2026-03-10", "santo": "San Macario de Alejandría" },
{ "fecha": "2026-03-11", "santo": "San Eulogio de Córdoba" },
{ "fecha": "2026-03-12", "santo": "San Gregorio Nacianceno" },
{ "fecha": "2026-03-13", "santo": "Santa Luisa de Marillac" },
{ "fecha": "2026-03-14", "santo": "San Matías", "descripcion":"apóstol" },
{ "fecha": "2026-03-15", "santo": "San Longino" },
{ "fecha": "2026-03-16", "santo": "Santa Juana de Chantal" },
{ "fecha": "2026-03-17", "santo": "San Patricio", "descripcion":"Patrón de Irlanda" },
{ "fecha": "2026-03-18", "santo": "San Cirilo de Jerusalén" },
{ "fecha": "2026-03-19", "santo": "San José", "descripcion":"Esposo de la Virgen María" },
{ "fecha": "2026-03-20", "santo": "San Cándido", "descripcion":"mártir" },
{ "fecha": "2026-03-21", "santo": "Santa Benedicta de la Cruz" },
{ "fecha": "2026-03-22", "santo": "San León I, Papa" },
{ "fecha": "2026-03-23", "santo": "San Turibio de Mogrovejo" },
{ "fecha": "2026-03-24", "santo": "San Gabriel de la Dolorosa" },
{ "fecha": "2026-03-25", "santo": "Anunciación del Señor", "descripcion":"El angel se apareció a la Virgen María"},
{ "fecha": "2026-03-26", "santo": "San Ezequiel Moreno" },
{ "fecha": "2026-03-27", "santo": "San Ruperto" },
{ "fecha": "2026-03-28", "santo": "San Guntrán" },
{ "fecha": "2026-03-29", "santo": "San Bertoldo" },
{ "fecha": "2026-03-30", "santo": "San Amando de Maastricht" },
{ "fecha": "2026-03-31", "santo": "San Benedicto José Labre" },
{ "fecha": "2026-04-01", "santo": "San Hugo de Grenoble" },
{ "fecha": "2026-04-02", "santo": "San Francisco de Paula" },
{ "fecha": "2026-04-03", "santo": "San Ricardo Pampuri" },
{ "fecha": "2026-04-04", "santo": "San Isidoro de Sevilla" },
{ "fecha": "2026-04-05", "santo": "San Vicente Ferrer" },
{ "fecha": "2026-04-06", "santo": "San Marcelino Champagnat" },
{ "fecha": "2026-04-07", "santo": "San Juan Bautista de la Salle" },
{ "fecha": "2026-04-08", "santo": "San Dionisio", "descripcion":"(obispo) y compañeros mártires" },
{ "fecha": "2026-04-09", "santo": "San Casimiro" },
{ "fecha": "2026-04-10", "santo": "San Ezequiel Moreno" },
{ "fecha": "2026-04-11", "santo": "San Esteban I", "descripcion":"Papa y mártir" },
{ "fecha": "2026-04-12", "santo": "San León IX", "descripcion":"Papa" },
{ "fecha": "2026-04-13", "santo": "San Hermenegildo" },
{ "fecha": "2026-04-14", "santo": "San Matías", "descripcion":"apóstol" },
{ "fecha": "2026-04-15", "santo": "San Dámaso I", "descripcion":"Papa" },
{ "fecha": "2026-04-16", "santo": "San Bernabé", "descripcion":"apóstol" },
{ "fecha": "2026-04-17", "santo": "San Aniceto", "descripcion":"Papa y mártir" },
{ "fecha": "2026-04-18", "santo": "San Apuleyo" },
{ "fecha": "2026-04-19", "santo": "San Expedito" },
{ "fecha": "2026-04-20", "santo": "San Jorge", "descripcion":"mártir" },
{ "fecha": "2026-04-21", "santo": "San Anselmo de Canterbury" },
{ "fecha": "2026-04-22", "santo": "San Soter y San Calixto", "descripcion":"Papas y mártires" },
{ "fecha": "2026-04-23", "santo": "San Jorge", "descripcion":"mártir" },
{ "fecha": "2026-04-24", "santo": "San Fidel de Sigmaringa" },
{ "fecha": "2026-04-25", "santo": "San Marcos", "descripcion":"evangelista" },
{ "fecha": "2026-04-26", "santo": "San Pedro de Verona" },
{ "fecha": "2026-04-27", "santo": "San Zita" },
{ "fecha": "2026-04-28", "santo": "San Luis María Grignion de Montfort" },
{ "fecha": "2026-04-29", "santo": "San Pedro Chanel" },
{ "fecha": "2026-04-30", "santo": "San Pío V", "descripcion":"Papa" },
{ "fecha": "2026-05-01", "santo": "San José Obrero"},
{ "fecha": "2026-05-02", "santo": "San Atanasio" },
{ "fecha": "2026-05-03", "santo": "San Felipe y Santiago", "descripcion":"apóstoles" },
{ "fecha": "2026-05-04", "santo": "San Florencio de Orange" },
{ "fecha": "2026-05-05", "santo": "San Hilario de Arlés" },
{ "fecha": "2026-05-06", "santo": "San Juan de Ávila" },
{ "fecha": "2026-05-07", "santo": "San Esteban de Hungría", "descripcion":"Rey de Hungría" },
{ "fecha": "2026-05-08", "santo": "San Miguel Garicoits" },
{ "fecha": "2026-05-09", "santo": "San Gregorio Magno" },
{ "fecha": "2026-05-10", "santo": "San Antonino de Florencia" },
{ "fecha": "2026-05-11", "santo": "San Ignacio de Loyola", "descripcion":"Fundador de la Compañía de Jesús" },
{ "fecha": "2026-05-12", "santo": "Santa Nereida" },
{ "fecha": "2026-05-13", "santo": "Nuestra Señora de Fátima", "descripcion":"La Virgen María se apareció en Fátima a tres pastorcitos" },
{ "fecha": "2026-05-14", "santo": "San Matías", "descripcion":"apóstol" },
{ "fecha": "2026-05-15", "santo": "San Isidro Labrador", "descripcion":"Patrón de los agricultores" },
{ "fecha": "2026-05-16", "santo": "San Juan Nepomuceno" },
{ "fecha": "2026-05-17", "santo": "San Pasquale Baylón" },
{ "fecha": "2026-05-18", "santo": "San Venancio" },
{ "fecha": "2026-05-19", "santo": "San Celestino V", "descripcion":"Papa" },
{ "fecha": "2026-05-20", "santo": "San Bernardino de Siena" },
{ "fecha": "2026-05-21", "santo": "Santa María Magdalena de Pazzi" },
{ "fecha": "2026-05-22", "santo": "Santa Rita de Casia" },
{ "fecha": "2026-05-23", "santo": "San Desiderio" },
{ "fecha": "2026-05-24", "santo": "Nuestra Señora, Auxilio de los Cristianos" },
{ "fecha": "2026-05-25", "santo": "San Gregorio VII", "descripcion":"Papa" },
{ "fecha": "2026-05-26", "santo": "San Felipe Neri" },
{ "fecha": "2026-05-27", "santo": "San Agustín de Cantorbery" },
{ "fecha": "2026-05-28", "santo": "San Germán de París" },
{ "fecha": "2026-05-29", "santo": "San Maximiliano Kolbe" },
{ "fecha": "2026-05-30", "santo": "Santa Juana de Arco" },
{ "fecha": "2026-05-31", "santo": "Visita de la Virgen María a su prima Santa Isabel" },
{ "fecha": "2026-06-01", "santo": "San Justino Mártir" },
{ "fecha": "2026-06-02", "santo": "San Marcelino de París" },
{ "fecha": "2026-06-03", "santo": "Santos Carlos Lwanga y compañeros mártires" },
{ "fecha": "2026-06-04", "santo": "San Francisco Caracciolo" },
{ "fecha": "2026-06-05", "santo": "San Bonifacio M. de Ligorio" },
{ "fecha": "2026-06-06", "santo": "San Norberto" },
{ "fecha": "2026-06-07", "santo": "San Roberto Belarmino" },
{ "fecha": "2026-06-08", "santo": "San Medardo" },
{ "fecha": "2026-06-09", "santo": "San Efrén" },
{ "fecha": "2026-06-10", "santo": "San Guillermo de Vercelli" },
{ "fecha": "2026-06-11", "santo": "San Bernabé, apóstol" },
{ "fecha": "2026-06-12", "santo": "Santos Juan y Pablo, mártires" },
{ "fecha": "2026-06-13", "santo": "San Antonio de Padua", "descripcion":"Doctor de la Iglesia" },
{ "fecha": "2026-06-14", "santo": "San Elías Profeta" },
{ "fecha": "2026-06-15", "santo": "San Vito", "descripcion":"y compañeros mártires" },
{ "fecha": "2026-06-16", "santo": "San Juan Francisco Régis" },
{ "fecha": "2026-06-17", "santo": "San Alberto Chmielowski" },
{ "fecha": "2026-06-18", "santo": "San Gregorio Barbarigo" },
{ "fecha": "2026-06-19", "santo": "Santo Romualdo", "descripcion":"y compañeros monjes" },
{ "fecha": "2026-06-20", "santo": "San Silverio", "descripcion":"Papa y mártir" },
{ "fecha": "2026-06-21", "santo": "San Luis Gonzaga" },
{ "fecha": "2026-06-22", "santo": "Santa Paulina" },
{ "fecha": "2026-06-23", "santo": "San José Cafasso" },
{ "fecha": "2026-06-24", "santo": "Natividad de San Juan Bautista", "descripcion":"Nacimiento de San Juan Bautista" },
{ "fecha": "2026-06-25", "santo": "Santos Cirilo y Metodio" },
{ "fecha": "2026-06-26", "santo": "San José María de Yermo y Parres" },
{ "fecha": "2026-06-27", "santo": "San Ladislao" },
{ "fecha": "2026-06-28", "santo": "San Ireneo", "descripcion":"obispo y mártir" },
{ "fecha": "2026-06-29", "santo": "San Pedro y San Pablo", "descripcion":"apóstoles" },
{ "fecha": "2026-06-30", "santo": "San Justo de Alcalá" },
{ "fecha": "2026-07-01", "santo": "Santa María Goretti" },
{ "fecha": "2026-07-02", "santo": "San Martín de Porres" },
{ "fecha": "2026-07-03", "santo": "Santos Tomás y Feliciano", "descripcion":"mártires" },
{ "fecha": "2026-07-04", "santo": "San Ulrico de Augsburgo" },
{ "fecha": "2026-07-05", "santo": "San Antonio María Zaccaria" },
{ "fecha": "2026-07-06", "santo": "San María Isabel de la Trinidad" },
{ "fecha": "2026-07-07", "santo": "San Cayetano" },
{ "fecha": "2026-07-08", "santo": "San Procopio" },
{ "fecha": "2026-07-09", "santo": "San Agustín Zhao Rong y compañeros mártires" },
{ "fecha": "2026-07-10", "santo": "San Benito", "descripcion":"Abad. Fundador de la Orden Benedictina. Medalla de San Benito ()" },
{ "fecha": "2026-07-11", "santo": "San Juan Bautista de la Salle" },
{ "fecha": "2026-07-12", "santo": "San Nabor y San Félix", "descripcion":"mártires" },
{ "fecha": "2026-07-13", "santo": "San Enrique" },
{ "fecha": "2026-07-14", "santo": "San Camilo de Lelis" },
{ "fecha": "2026-07-15", "santo": "Santa María Gorretti" },
{ "fecha": "2026-07-16", "santo": "Nuestra Señora del Carmen", "descripcion":"Patrona de los Carmelitas y los pescadores. Escapulario" },
{ "fecha": "2026-07-17", "santo": "San Alejo" },
{ "fecha": "2026-07-18", "santo": "San Camilo de Lelis" },
{ "fecha": "2026-07-19", "santo": "San Vicente de Paúl" },
{ "fecha": "2026-07-20", "santo": "San Apolinario" },
{ "fecha": "2026-07-21", "santo": "San Lorenzo de Brindis" },
{ "fecha": "2026-07-22", "santo": "Santa María Magdalena", "descripcion":"la apóstol de los apóstoles" },
{ "fecha": "2026-07-23", "santo": "Santos Apeles y Clemente", "descripcion":"mártires" },
{ "fecha": "2026-07-24", "santo": "San Cristóbal Magallanes y compañeros", "descripcion":"mártires" },
{ "fecha": "2026-07-25", "santo": "Santiago", "descripcion":"apóstol" },
{ "fecha": "2026-07-26", "santo": "San Joaquín y Santa Ana" },
{ "fecha": "2026-07-27", "santo": "Santa Marta" },
{ "fecha": "2026-07-28", "santo": "San Pedro Crisólogo" },
{ "fecha": "2026-07-29", "santo": "Santa María de los Ángeles" },
{ "fecha": "2026-07-30", "santo": "San Abdon y San Sennen", "descripcion":"mártires" },
{ "fecha": "2026-07-31", "santo": "San Ignacio de Loyola" },
{ "fecha": "2026-08-01", "santo": "San Alfonso María de Ligorio" },
{ "fecha": "2026-08-02", "santo": "Santa Eusebia" },
{ "fecha": "2026-08-03", "santo": "San Lamberto", "descripcion":"obispo y mártir" },
{ "fecha": "2026-08-04", "santo": "San Juan María Vianney" },
{ "fecha": "2026-08-05", "santo": "Dedicatoria de la Basílica de Letrán" },
{ "fecha": "2026-08-06", "santo": "Transfiguración del Señor"},
{ "fecha": "2026-08-07", "santo": "San Cajetano" },
{ "fecha": "2026-08-08", "santo": "San Dominico" },
{ "fecha": "2026-08-09", "santo": "San Román" },
{ "fecha": "2026-08-10", "santo": "San Lorenzo", "descripcion":"diácono y mártir" },
{ "fecha": "2026-08-11", "santo": "Santa Clara de Asís" },
{ "fecha": "2026-08-12", "santo": "San Maximiliano Kolbe" },
{ "fecha": "2026-08-13", "santo": "San Poncio", "descripcion":"mártir" },
{ "fecha": "2026-08-14", "santo": "San Maximiliano Kolbe" },
{ "fecha": "2026-08-15", "santo": "Asunción de la Virgen María" },
{ "fecha": "2026-08-16", "santo": "San Esteban de Hungría" },
{ "fecha": "2026-08-17", "santo": "San Jacinto" },
{ "fecha": "2026-08-18", "santo": "San Alberto Hurtado" },
{ "fecha": "2026-08-19", "santo": "San Juan Eudes" },
{ "fecha": "2026-08-20", "santo": "San Bernardo de Claraval" },
{ "fecha": "2026-08-21", "santo": "San Pío X, Papa" },
{ "fecha": "2026-08-22", "santo": "Santa María Reina" },
{ "fecha": "2026-08-23", "santo": "San Rosa de Lima" },
{ "fecha": "2026-08-24", "santo": "San Bartolomé", "descripcion":"apóstol" },
{ "fecha": "2026-08-25", "santo": "San Luis IX", "descripcion":"rey de Francia" },
{ "fecha": "2026-08-26", "santo": "San José de Calasanz" },
{ "fecha": "2026-08-27", "santo": "Santa Mónica" },
{ "fecha": "2026-08-28", "santo": "San Agustín", "descripcion":"obispo y doctor de la Iglesia. Fundador de los agustinos" },
{ "fecha": "2026-08-29", "santo": "Martirio de San Juan Bautista" },
{ "fecha": "2026-08-30", "santo": "Santa Rosa de Lima" },
{ "fecha": "2026-08-31", "santo": "San Ramón Nonato", "descripcion":"santo de las parturientas" },
{ "fecha": "2026-09-01", "santo": "San Egidio", "descripcion":"abate" },
{ "fecha": "2026-09-02", "santo": "Santa María de la Cabeza" },
{ "fecha": "2026-09-03", "santo": "San Gregorio Magno" },
{ "fecha": "2026-09-04", "santo": "San Rosendo" },
{ "fecha": "2026-09-05", "santo": "Santa Teresa de Calcuta" },
{ "fecha": "2026-09-06", "santo": "San Zacarías, profeta" },
{ "fecha": "2026-09-07", "santo": "San Cayetano" },
{ "fecha": "2026-09-08", "santo": "Natividad de la Virgen María", "color": "blanco" },
{ "fecha": "2026-09-09", "santo": "San Pedro Claver" },
{ "fecha": "2026-09-10", "santo": "San Nicolás de Tolentino" },
{ "fecha": "2026-09-11", "santo": "San Juan Gabriel Perboyre" },
{ "fecha": "2026-09-12", "santo": "Santísimo Nombre de María" },
{ "fecha": "2026-09-13", "santo": "San Juan Crisóstomo, obispo y doctor de la Iglesia" },
{ "fecha": "2026-09-14", "santo": "Exaltación de la Santa Cruz", "color": "rojo" },
{ "fecha": "2026-09-15", "santo": "Nuestra Señora de los Dolores" },
{ "fecha": "2026-09-16", "santo": "San Cornelio, Papa y San Cipriano, obispo, mártires" },
{ "fecha": "2026-09-17", "santo": "San Roberto Bellarmino" },
{ "fecha": "2026-09-18", "santo": "San José de Cupertino" },
{ "fecha": "2026-09-19", "santo": "San Januario, obispo y mártir" },
{ "fecha": "2026-09-20", "santo": "San Andrés Kim Taegon y compañeros mártires" },
{ "fecha": "2026-09-21", "santo": "San Mateo, apóstol y evangelista", "color": "rojo" },
{ "fecha": "2026-09-22", "santo": "San Maurilio" },
{ "fecha": "2026-09-23", "santo": "San Pío de Pietrelcina" },
{ "fecha": "2026-09-24", "santo": "Nuestra Señora de la Merced" },
{ "fecha": "2026-09-25", "santo": "San Cleofás" },
{ "fecha": "2026-09-26", "santo": "San Cosme y San Damián, mártires" },
{ "fecha": "2026-09-27", "santo": "San Vicente de Paúl" },
{ "fecha": "2026-09-28", "santo": "San Wenceslao" },
{ "fecha": "2026-09-29", "santo": "Santos Arcángeles Miguel, Gabriel y Rafael", "color": "blanco" },
{ "fecha": "2026-09-30", "santo": "San Jerónimo, sacerdote y doctor de la Iglesia" },
{ "fecha": "2026-10-01", "santo": "Santa Teresa de Lisieux" },
{ "fecha": "2026-10-02", "santo": "Ángel de la Guarda" },
{ "fecha": "2026-10-03", "santo": "San Gerardo Majella" },
{ "fecha": "2026-10-04", "santo": "San Francisco de Asís", "color": "rojo" },
{ "fecha": "2026-10-05", "santo": "Santa Faustina Kowalska" },
{ "fecha": "2026-10-06", "santo": "San Bruno" },
{ "fecha": "2026-10-07", "santo": "Nuestra Señora del Rosario", "color": "blanco" },
{ "fecha": "2026-10-08", "santo": "San Dionisio y compañeros mártires" },
{ "fecha": "2026-10-09", "santo": "San Juan Leonardi" },
{ "fecha": "2026-10-10", "santo": "San Daniel Comboni" },
{ "fecha": "2026-10-11", "santo": "San Juan XXIII, Papa" },
{ "fecha": "2026-10-12", "santo": "Nuestra Señora de Guadalupe", "color": "blanco" },
{ "fecha": "2026-10-13", "santo": "San Eduardo el Confesor" },
{ "fecha": "2026-10-14", "santo": "San Calixto I, Papa y mártir" },
{ "fecha": "2026-10-15", "santo": "Santa Teresa de Ávila, virgen y doctora de la Iglesia" },
{ "fecha": "2026-10-16", "santo": "San Gerardo de Brogne" },
{ "fecha": "2026-10-17", "santo": "San Ignacio de Antioquía, obispo y mártir" },
{ "fecha": "2026-10-18", "santo": "San Lucas, evangelista", "color": "rojo" },
{ "fecha": "2026-10-19", "santo": "San Pablo de la Cruz", "color": "rojo" },
{ "fecha": "2026-10-20", "santo": "San Juan de Capistrano" },
{ "fecha": "2026-10-21", "santo": "San Hilarión" },
{ "fecha": "2026-10-22", "santo": "San Juan Pablo II, Papa" },
{ "fecha": "2026-10-23", "santo": "San Juan de Brébeuf y San Isaac Jogues, sacerdotes y compañeros mártires" },
{ "fecha": "2026-10-24", "santo": "San Antonio María Claret" },
{ "fecha": "2026-10-25", "santo": "San Crispín y San Crispiniano, mártires" },
{ "fecha": "2026-10-26", "santo": "San Evaristo, Papa y mártir" },
{ "fecha": "2026-10-27", "santo": "San Frumencio" },
{ "fecha": "2026-10-28", "santo": "San Simón y San Judas, apóstoles", "color": "rojo" },
{ "fecha": "2026-10-29", "santo": "San Narciso de Jerusalén" },
{ "fecha": "2026-10-30", "santo": "San Andrés Avellino" },
{ "fecha": "2026-10-31", "santo": "San Wolfgang de Ratisbona" },
{ "fecha": "2026-11-01", "santo": "Todos los Santos", "color": "blanco" },
{ "fecha": "2026-11-02", "santo": "Conmemoración de los Fieles Difuntos", "color": "negro" },
{ "fecha": "2026-11-03", "santo": "San Martín de Tours" },
{ "fecha": "2026-11-04", "santo": "San Carlos Borromeo" },
{ "fecha": "2026-11-05", "santo": "San Leónidas y compañeros mártires" },
{ "fecha": "2026-11-06", "santo": "San Leonardo de Noblac" },
{ "fecha": "2026-11-07", "santo": "San Willibrord" },
{ "fecha": "2026-11-08", "santo": "San Godofredo de Amiens" },
{ "fecha": "2026-11-09", "santo": "Dedicación de la Basílica de San Juan de Letrán", "color": "blanco" },
{ "fecha": "2026-11-10", "santo": "San León III, Papa" },
{ "fecha": "2026-11-11", "santo": "San Martín de Tours" },
{ "fecha": "2026-11-12", "santo": "San Josafat Kuncevyc" },
{ "fecha": "2026-11-13", "santo": "Santa Francesca Romana" },
{ "fecha": "2026-11-14", "santo": "San Gerardo Sagredo" },
{ "fecha": "2026-11-15", "santo": "Santa Margarita de Escocia" },
{ "fecha": "2026-11-16", "santo": "San Gerardo Majella" },
{ "fecha": "2026-11-17", "santo": "San Gregorio III, Papa" },
{ "fecha": "2026-11-18", "santo": "San Romualdo" },
{ "fecha": "2026-11-19", "santo": "San Elredo de Rievaulx" },
{ "fecha": "2026-11-20", "santo": "Santa Felicidad y compañeros mártires" },
{ "fecha": "2026-11-21", "santo": "Presentación de la Virgen María", "color": "blanco" },
{ "fecha": "2026-11-22", "santo": "San Cecilia, virgen y mártir", "descripcion":"Patrona de la música" },
{ "fecha": "2026-11-23", "santo": "San Clemente I, Papa y mártir" },
{ "fecha": "2026-11-24", "santo": "San Andrés Dung-Lac y compañeros mártires" },
{ "fecha": "2026-11-25", "santo": "San Catalina de Alejandría, virgen y mártir" },
{ "fecha": "2026-11-26", "santo": "San Silvestre I, Papa" },
{ "fecha": "2026-11-27", "santo": "San Virgilio de Salzburgo" },
{ "fecha": "2026-11-28", "santo": "San Leandro de Sevilla" },
{ "fecha": "2026-11-29", "santo": "San Saturnino" },
{ "fecha": "2026-11-30", "santo": "San Andrés, apóstol", "color": "rojo" },
{ "fecha": "2026-12-01", "santo": "Santa Elena" },
{ "fecha": "2026-12-02", "santo": "San Bibiano, mártir" },
{ "fecha": "2026-12-03", "santo": "San Francisco Javier" },
{ "fecha": "2026-12-04", "santo": "San Juan Damasceno" },
{ "fecha": "2026-12-05", "santo": "Santa Sabela" },
{ "fecha": "2026-12-06", "santo": "San Nicolás de Bari" },
{ "fecha": "2026-12-07", "santo": "San Ambrosio, obispo y doctor de la Iglesia" },
{ "fecha": "2026-12-08", "santo": "Inmaculada Concepción de la Virgen María", "color": "blanco" },
{ "fecha": "2026-12-09", "santo": "San Juan Diego Cuauhtlatoatzin" },
{ "fecha": "2026-12-10", "santo": "San Efrén" },
{ "fecha": "2026-12-11", "santo": "San Dámaso I, Papa" },
{ "fecha": "2026-12-12", "santo": "Nuestra Señora de Guadalupe", "color": "blanco" },
{ "fecha": "2026-12-13", "santo": "Santa Lucía, virgen y mártir" },
{ "fecha": "2026-12-14", "santo": "San Juan de la Cruz, sacerdote y doctor de la Iglesia" },
{ "fecha": "2026-12-15", "santo": "Santa Ninfa" },
{ "fecha": "2026-12-16", "santo": "San Ezequiel Moreno" },
{ "fecha": "2026-12-17", "santo": "San Lázaro de Betania" },
{ "fecha": "2026-12-18", "santo": "San Gatiano" },
{ "fecha": "2026-12-19", "santo": "San Urbano I, Papa y mártir" },
{ "fecha": "2026-12-20", "santo": "San Dámaso I, Papa" },
{ "fecha": "2026-12-21", "santo": "San Pedro Canisio" },
{ "fecha": "2026-12-22", "santo": "San Francisco de Sales, obispo y doctor de la Iglesia" },
{ "fecha": "2026-12-23", "santo": "San Juan Kanty" },
{ "fecha": "2026-12-24", "santo": "Nochebuena" },
{ "fecha": "2026-12-25", "santo": "Navidad del Señor", "color": "blanco" },
{ "fecha": "2026-12-26", "santo": "San Esteban, primer mártir", "color": "rojo" },
{ "fecha": "2026-12-27", "santo": "San Juan, apóstol y evangelista", "color": "rojo" },
{ "fecha": "2026-12-28", "santo": "Inocentes, mártires", "color": "rojo" },
{ "fecha": "2026-12-29", "santo": "San Tomás Becket, obispo y mártir" },
{ "fecha": "2026-12-30", "santo": "Santos Adolfo y Juan Fisher, mártires" },
{ "fecha": "2026-12-31", "santo": "San Silvestre I, Papa" }
]

View File

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Estadísticas | El Tiempo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/estilos.css">
</head>
<body class="app-tiempo">
<header>
<h1>Estadísticas del Tiempo</h1>
<h2 id="stats-location">Cargando datos…</h2>
</header>
<main class="container">
<!-- ÚLTIMO DATO -->
<article class="tarjeta">
<h2>Ahora</h2>
<p>Fecha: <strong id="last-date">--</strong></p>
<p>Temperatura: <strong id="last-temp">--</strong></p>
<p>Humedad: <strong id="last-humidity">--</strong></p>
<p>Lluvia: <strong id="last-rain">--</strong></p>
<p>Viento: <strong id="last-wind">--</strong></p>
<p>Amanecer: <strong id="last-sunrise">--</strong></p>
<p>Anochecer: <strong id="last-sunset">--</strong></p>
</article>
<!-- RESUMEN MES ACTUAL -->
<article class="tarjeta">
<h2>Resumen del mes actual</h2>
<p>Días registrados: <strong id="month-days">--</strong></p>
<p>Máxima absoluta: <strong id="month-max">--</strong></p>
<p>Mínima absoluta: <strong id="month-min">--</strong></p>
<p>Lluvia total: <strong id="month-rain">--</strong></p>
<p>Humedad media: <strong id="month-humidity">--</strong></p>
</article>
<!-- TENDENCIA HISTÓRICA -->
<article class="tarjeta">
<h2>Tendencia histórica del mes actual</h2>
<div id="trend-container">
<p>Cargando tendencia…</p>
</div>
</article>
</main>
<footer>
<p>El Tiempo &copy; <span id="year"></span> Tatiana Villa</p>
</footer>
<script src="js/estadisticas.js"></script>
</body>
</html>

250
eltiempo/estilos.css Normal file
View File

@ -0,0 +1,250 @@
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,600;1,400&family=Nunito:wght@400;600&display=swap');
:root {
/* Paleta refinada */
--color-primario: #F5F5F5; /* Azul noche espiritual */
--color-hover: #1E3A5F; /* Azul profundo para hover */
--color-secundario: #A1A1A1; /* Azul muy suave */
--color-fondo: #0D0D0D; /* Fondo principal */
--color-texto: #E5E5E5; /* Gris claro para texto */
--blanco-puro: #FFFFFF;
--sombra: rgba(47, 58, 86, 0.15);
--color-tarjeta: #1A1A1A;
--color-acento: #5FAEDB;
--color-borde: rgba(95, 174, 219, 0.3);
}
body {
margin: 0;
font-family: 'Nunito', sans-serif;
background: linear-gradient(180deg, #0D0D0D 0%, #111827 100%);
color: var(--color-texto);
line-height: 1.7;
-webkit-font-smoothing: antialiased;
}
header {
padding: 1.5rem 0;
text-align: center;
}
header h1 {
font-family: 'EB Garamond', serif;
letter-spacing: 1px;
color: var(--color-acento);
margin: 0;
}
nav ul {
list-style: none;
padding: 0;
margin: 0 auto 2rem;
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 10px;
}
nav a {
color: var(--color-primario);
border-radius: 20px;
transition: all 0.3s ease;
}
nav a:hover {
background-color: var(--color-hover);
transform: translateY(-2px);
}
.container {
width: 92%;
max-width: 1200px;
margin: auto;
padding: 2rem 0;
display: grid;
gap: 2rem;
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.tarjeta {
background: rgba(20, 20, 20, 0.75);
backdrop-filter: blur(4px);
border-radius: 14px;
border: 1px solid var(--color-borde);
box-shadow: 0 10px 20px rgba(0,0,0,.35);
transition: all 0.3s ease;
overflow: hidden;
cursor: pointer;
}
.tarjeta:hover {
transform: translateY(-6px);
box-shadow: 0 16px 30px rgba(0,0,0,.5);
}
.tarjeta h2 {
margin: 0;
padding: 12px;
font-family: 'EB Garamond', serif;
font-size: 1.3rem;
text-align: center;
color: var(--color-acento);
background: rgba(13, 13, 13, 0.8);
border-bottom: 1px solid rgba(255,255,255,.1);
}
/* --- Párrafos generales de todas las tarjetas --- */
.tarjeta p {
text-align: center;
color: var(--color-texto);
font-size: 1rem;
margin: 2px 0; /* menos espacio entre líneas */
padding: 0; /* eliminar padding extra */
}
/* --- Ajuste para dispositivos pequeños --- */
@media (max-width: 600px) {
header h1 {
font-size: 1.6rem;
}
nav ul {
flex-direction: column;
align-items: center;
}
.container {
gap: 1.2rem;
}
}
footer {
text-align: center;
padding: 1.5rem 0;
color: var(--color-secundario);
margin-top: 3rem;
background: transparent;
}
/* --- Tarjeta Amanecer/Anochecer: más compacta --- */
#moon-mini-calendar {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 6px;
margin-top: 10px;
text-align: center;
}
.moon-day {
padding: 4px;
border-radius: 6px;
background: var(--color-fondo);
font-size: 0.9rem;
}
.moon-today {
background: var(--color-hover);
font-weight: bold;
}
.moon-icon {
font-size: 1.4rem;
display: block;
}
#moon-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
margin-top: 10px;
margin-bottom: 6px;
text-align: center;
font-weight: 600;
color: var(--color-acento);
font-size: 0.85rem;
}
#moon-weekdays span {
padding: 4px 0;
border-bottom: 1px solid var(--color-borde);
}
/* ---------- BULLET JOURNAL SUMMARY ---------- */
#bullet-summary {
cursor: default;
}
#bullet-summary .bj-resumen {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
padding: 14px;
}
#bullet-summary .bj-item {
background: rgba(13,13,13,0.8);
border: 1px solid var(--color-borde);
border-radius: 10px;
padding: 10px;
text-align: center;
box-shadow: inset 0 0 12px rgba(0,0,0,.4);
}
#bullet-summary .bj-item span {
display: block;
font-size: 0.75rem;
color: var(--color-secundario);
letter-spacing: .5px;
}
#bullet-summary .bj-item strong {
font-size: 1.4rem;
font-family: 'EB Garamond', serif;
color: var(--color-acento);
}
/* Botón */
#bullet-summary .btn , #weather-card .btn {
display: block;
width: 75%;
margin: 12px auto 14px;
padding: 10px;
background: linear-gradient(135deg, #1E3A5F, #111827);
color: var(--blanco-puro);
border-radius: 12px;
text-align: center;
text-decoration: none;
font-size: 0.9rem;
border: 1px solid var(--color-borde);
transition: all .3s ease;
}
#bullet-summary .btn:hover, #weather-card .btn:hover {
background: linear-gradient(135deg, #2b4f80, #1E293B);
transform: translateY(-2px);
}
/* ICONOS */
.termometro {
width: 48px;
}
.termometro.neutro {
fill: var(--color-primario);
}
.termometro.frio {
fill: var(--color-acento);
}
.termometro.calor {
fill: #f44336;
}
.termometro.templado { fill: #4caf50; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
eltiempo/img/humedad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
eltiempo/img/lluvia.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
eltiempo/img/sunrise.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
eltiempo/img/termometro.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,22 @@
<svg class="termometro" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" aria-hidden="true">
<!-- cuerpo -->
<path d="M32 2
a10 10 0 0 0-10 10v26.2
a16 16 0 1 0 20 0V12
a10 10 0 0 0-10-10z
m0 4
a6 6 0 0 1 6 6v28.1
l.9.6
a12 12 0 1 1-13.8 0l.9-.6V12
a6 6 0 0 1 6-6z"></path>
<!-- mercurio -->
<rect x="30" y="18" width="4" height="18" rx="2"></rect>
<circle cx="32" cy="46" r="6"></circle>
<!-- marcas -->
<rect x="46" y="14" width="12" height="4" rx="2"></rect>
<rect x="46" y="24" width="8" height="4" rx="2"></rect>
<rect x="46" y="34" width="12" height="4" rx="2"></rect>
<rect x="46" y="44" width="8" height="4" rx="2"></rect>
</svg>

After

Width:  |  Height:  |  Size: 765 B

BIN
eltiempo/img/viento.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

129
eltiempo/index.html Normal file
View File

@ -0,0 +1,129 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>El Tiempo</title>
<link rel="stylesheet" href="css/estilos.css">
</head>
<body class="app-tiempo">
<header>
<h1>El Tiempo</h1>
<h2 id="location">Obteniendo ubicación...</h2>
<h3 id="fecha-actual">Fecha</h3>
<h3 id="santo-del-dia">Santo del dia</h3>
</header>
<main class="container">
<article class="tarjeta" id="bullet-summary">
<h2>Bullet Journal</h2>
<div class="bj-resumen">
<div class="bj-item">
<span>ROSARIO</span>
<strong id="bj-rosario">0</strong>
</div>
<div class="bj-item">
<span>CAMINAR</span>
<strong id="bj-caminar">0</strong>
</div>
<div class="bj-item">
<span>VITAMINAS</span>
<strong id="bj-vitaminas">0</strong>
</div>
<div class="bj-item">
<span>AGUA</span>
<strong id="bj-agua">0</strong>
</div>
</div>
<a class="btn" href="bullet-journal.html">Abrir Bullet Journal</a>
</article>
<article class="tarjeta" id="sun-card">
<h2 id="sun-title">Amanecer y Anochecer</h2>
<p>Amanecer: <strong id="sunrise">--:--</strong></p>
<p>Anochecer: <strong id="sunset">--:--</strong></p>
<p>Duración del día: <strong id="day-length">--:--</strong></p>
<p id="countdown">Tiempo hasta anochecer: --:--:--</p>
<p id="sun-icon">☀️</p>
</article>
<article class="tarjeta" id="moon-card">
<h2>Calendario lunar vs tiempo</h2>
<p>Fase lunar actual: <strong id="moon-phase">Calculando...</strong></p>
<p id="moon-icon">🌑</p>
<!--
<h3>Calendario lunar del mes</h3>
<div id="moon-weekdays">
<span>L</span>
<span>M</span>
<span>X</span>
<span>J</span>
<span>V</span>
<span>S</span>
<span>D</span>
</div>
<div id="moon-mini-calendar"></div>
-->
</article>
<article class="tarjeta" id="weather-card">
<h2>Tiempo Actual 🌤️</h2>
<p class="temp-linea">
<svg
class="termometro calor"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 64 64"
width="24"
aria-hidden="true"
>
<path d="M32 2
a10 10 0 0 0-10 10v26.2
a16 16 0 1 0 20 0V12
a10 10 0 0 0-10-10z
m0 4
a6 6 0 0 1 6 6v28.1
l.9.6
a12 12 0 1 1-13.8 0l.9-.6V12
a6 6 0 0 1 6-6z"/>
<rect x="30" y="18" width="4" height="18" rx="2"/>
<circle cx="32" cy="46" r="6"/>
</svg>
<strong id="temperature">--°C</strong>
</p>
<p>Condición: <strong id="condition">--</strong></p>
<p>Humedad: <strong id="humidity">--%</strong></p>
<p>Viento: <strong id="wind">-- km/h</strong></p>
<a class="btn" href="estadisticas.html">Ver estadísticas</a>
</article>
</main>
<footer>
<p>El Tiempo &copy; <span id="year"></span> Tatiana Villa</p>
</footer>
<script src="js/codigo.js"></script>
</body>
</html>

View File

@ -0,0 +1,113 @@
let currentDate = new Date();
const fields = ['rosario', 'vitaminas', 'caminar', 'agua', 'mood'];
// Inicialización
document.addEventListener('DOMContentLoaded', () => {
setupAutoSave();
updateUI();
});
function formatDate(date) {
return date.toISOString().split('T')[0];
}
function updateUI() {
const dateString = currentDate.toLocaleDateString('es-ES', {
weekday: 'long', day: 'numeric', month: 'long', year: 'numeric'
});
document.getElementById('currentDateDisplay').innerText = dateString;
loadDayData();
updateExtras();
}
function changeDay(offset) {
currentDate.setDate(currentDate.getDate() + offset);
updateUI();
}
/* STORAGE */
function loadDayData() {
const data = JSON.parse(localStorage.getItem('journalData')) || {};
const day = data[formatDate(currentDate)] || {};
fields.forEach(f => {
const el = document.getElementById(f);
if (el.type === 'checkbox') el.checked = day[f] || false;
else el.value = day[f] || '';
});
}
function setupAutoSave() {
fields.forEach(f => {
document.getElementById(f).addEventListener('change', () => {
const data = JSON.parse(localStorage.getItem('journalData')) || {};
const key = formatDate(currentDate);
if (!data[key]) data[key] = {};
fields.forEach(field => {
const el = document.getElementById(field);
data[key][field] = el.type === 'checkbox' ? el.checked : el.value;
});
localStorage.setItem('journalData', JSON.stringify(data));
});
});
}
/* EXTRAS: SANTORAL Y CUMPLES */
async function updateExtras() {
const iso = formatDate(currentDate);
// Santoral
try {
const resS = await fetch('data/santos.json');
const santos = await resS.json();
const s = santos.find(x => x.fecha === iso);
document.getElementById('saintDisplay').innerText = s ? `Santo: ${s.santo}` : "Santoral";
document.getElementById('santodeldia').innerText = s ? `Santo del día: ${s.santo}` : "Santo del día desconocido";
} catch (e) { console.log("Falta santos.json"); }
// Cumples
try {
const resC = await fetch('data/cumples.json');
const cumples = await resC.json();
const c = cumples.find(x => x.fecha === iso.slice(5));
document.getElementById('cumpleDisplay').innerText = c ? `🎂 ${c.persona}` : "";
} catch (e) { }
}
/* IMPRESIÓN MENSUAL A5 */
async function printFullMonth() {
const data = JSON.parse(localStorage.getItem('journalData')) || {};
const month = currentDate.getMonth();
const year = currentDate.getFullYear();
const daysInMonth = new Date(year, month + 1, 0).getDate();
let html = "";
for (let i = 1; i <= daysInMonth; i++) {
const date = new Date(year, month, i);
const key = formatDate(date);
const dayData = data[key] || {};
html += `
<div class="page-a5">
<h1> ${date.toLocaleDateString('es-ES',{weekday:'long'})}, ${i} ${date.toLocaleDateString('es-ES',{month:'long'})} de ${date.getFullYear()}</h1>
<div id="santodeldia">Santo del dia</div>
<p style="margin-top:10px">
Rosario: ${dayData.rosario ? '✔' : '☐'} | Pasos: ${dayData.caminar || 0}
| Vitaminas: ${dayData.vitaminas ? '✔' : '☐'} | Agua: ${dayData.agua || 0}ml
</p>
<div class="dots-bg"></div>
</div>
`;
}
document.getElementById('printArea').innerHTML = html;
window.print();
}
function resetData() {
if(confirm("¿Seguro que quieres borrar todo el historial?")) {
localStorage.clear();
location.reload();
}
}

318
eltiempo/js/codigo.js Normal file
View File

@ -0,0 +1,318 @@
/* ==============================================
FUNCIONES AUXILIARES
============================================== */
function formatTime(dateString) {
const date = new Date(dateString);
return date.toLocaleTimeString("es-ES", { hour: "2-digit", minute: "2-digit" });
}
function formatDuration(seconds) {
const h = Math.floor(seconds / 3600);
const m = Math.floor((seconds % 3600) / 60);
const s = Math.floor(seconds % 60);
return `${h}h ${m}m ${s}s`;
}
function ponerlaFechaActual() {
const now = new Date();
const dateString = now.toLocaleDateString('es-ES', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' });
document.getElementById("fecha-actual").textContent = dateString;
}
/* ================================
6. SANTO DEL DÍA
================================ */
async function santoDelDia() {
const hoy = new Date();
const offset = hoy.getTimezoneOffset() * 60000;
const fechaISO = new Date(hoy - offset).toISOString().split('T')[0];
try {
const res = await fetch('data/santos.json');
const listaSantos = await res.json();
const elSanto = listaSantos.find(d => d.fecha === fechaISO);
if (elSanto) {
document.getElementById("santo-del-dia").textContent = elSanto.santo;
santoDelDiaElem.textContent = elSanto.santo;
descripcionSantoDelDiaElem.textContent = elSanto.descripcion || "";
}
} catch (e) {
console.error("Error en la carga de santos:", e);
}
}
/* ==============================================
GEOLOCALIZACIÓN CENTRAL
============================================== */
async function getLocationOnce() {
return new Promise((resolve, reject) => {
if (!navigator.geolocation) reject("Geolocalización no soportada");
navigator.geolocation.getCurrentPosition(
pos => resolve({ lat: pos.coords.latitude, lon: pos.coords.longitude }),
err => reject(err.message)
);
});
}
async function getLocationName(lat, lon) {
try {
const url = `https://nominatim.openstreetmap.org/reverse?format=json&lat=${lat}&lon=${lon}`;
const res = await fetch(url);
const data = await res.json();
if (data.address) {
if (data.address.city) return data.address.city + ", " + data.address.country;
if (data.address.town) return data.address.town + ", " + data.address.country;
if (data.address.village) return data.address.village + ", " + data.address.country;
if (data.address.hamlet) return data.address.hamlet + ", " + data.address.country;
}
return "Ubicación desconocida";
} catch {
return "Ubicación desconocida";
}
}
/* ==============================================
TARJETA SOL / ANOCHECER
============================================== */
async function getSunTimes(lat, lon) {
const url = `https://api.sunrise-sunset.org/json?lat=${lat}&lng=${lon}&formatted=0`;
const response = await fetch(url);
const data = await response.json();
return data.results;
}
async function updateSunCard(lat, lon) {
try {
const sun = await getSunTimes(lat, lon);
const cityName = await getLocationName(lat, lon);
const sunrise = new Date(sun.sunrise);
const sunset = new Date(sun.sunset);
document.getElementById("sunrise").textContent = formatTime(sun.sunrise);
document.getElementById("sunset").textContent = formatTime(sun.sunset);
document.getElementById("day-length").textContent = formatDuration((sunset - sunrise)/1000);
document.getElementById("location").textContent = cityName;
const card = document.getElementById("sun-card");
const sunIcon = document.getElementById("sun-icon");
function updateMode() {
const now = new Date();
if (now >= sunrise && now <= sunset) {
card.style.background = "rgba(26,26,26,0.85)";
sunIcon.textContent = "☀️";
} else {
card.style.background = "rgba(10,10,30,0.85)";
sunIcon.textContent = "🌙";
}
}
function updateCountdown() {
const now = new Date();
let target;
let text = "Queda ";
if (now < sunrise) target = sunrise;
else if (now >= sunrise && now <= sunset) target = sunset;
else target = new Date(sunrise.getTime() + 24*60*60*1000);
const diff = Math.floor((target - now) / 1000);
const durationStr = formatDuration(diff);
text += (target.getTime() === sunrise.getTime())
? durationStr + " hasta anochecer"
: durationStr + " hasta amanecer";
document.getElementById("countdown").textContent = text;
}
updateMode();
updateCountdown();
setInterval(() => { updateMode(); updateCountdown(); }, 1000);
} catch (err) {
document.getElementById("location").textContent = "Error obteniendo datos: " + err.message;
}
}
/* ==============================================
TIEMPO ACTUAL
============================================== */
async function getWeather(position) {
const lat = position.coords.latitude;
const lon = position.coords.longitude;
// Open-Meteo API
const url = `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current_weather=true&temperature_unit=celsius&windspeed_unit=kmh&timezone=auto`;
try {
const res = await fetch(url);
const data = await res.json();
const weather = data.current_weather;
document.getElementById("temperature").textContent = `${weather.temperature}°C`;
document.getElementById("condition").textContent = `Viento ${weather.windspeed} km/h`;
document.getElementById("humidity").textContent = "N/A";
document.getElementById("wind").textContent = "N/A";
} catch (err) {
document.getElementById("location").textContent = "Error al obtener el tiempo";
console.error(err);
}
}
function showError(error) {
switch(error.code) {
case error.PERMISSION_DENIED:
document.getElementById("location").textContent = "Permiso denegado para obtener ubicación.";
break;
case error.POSITION_UNAVAILABLE:
document.getElementById("location").textContent = "Ubicación no disponible.";
break;
case error.TIMEOUT:
document.getElementById("location").textContent = "Tiempo de espera agotado.";
break;
default:
document.getElementById("location").textContent = "Error desconocido.";
}
}
/* ==============================================
FASES LUNARES
============================================== */
function getMoonPhase() {
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth() + 1;
const day = now.getDate();
const c = Math.floor(365.25 * year);
const e = Math.floor(30.6 * (month + 1));
const jd = c + e + day - 694039.09;
const phase = (jd / 29.53) % 1;
const age = phase * 29.53;
let phaseName = "", icon = "";
if (age < 1.84566) { phaseName = "Luna Nueva"; icon = "🌑"; }
else if (age < 5.53699) { phaseName = "Creciente Iluminante"; icon = "🌒"; }
else if (age < 9.22831) { phaseName = "Cuarto Creciente"; icon = "🌓"; }
else if (age < 12.91963) { phaseName = "Gibosa Creciente"; icon = "🌔"; }
else if (age < 16.61096) { phaseName = "Luna Llena"; icon = "🌕"; }
else if (age < 20.30228) { phaseName = "Gibosa Menguante"; icon = "🌖"; }
else if (age < 23.99361) { phaseName = "Cuarto Menguante"; icon = "🌗"; }
else if (age < 27.68493) { phaseName = "Creciente Menguante"; icon = "🌘"; }
else { phaseName = "Luna Nueva"; icon = "🌑"; }
document.getElementById("moon-phase").textContent = phaseName;
document.getElementById("moon-icon").textContent = icon;
}
function moonPhaseForDate(year, month, day) {
const c = Math.floor(365.25 * year);
const e = Math.floor(30.6 * (month + 1));
const jd = c + e + day - 694039.09;
const phase = (jd / 29.53) % 1;
const age = phase * 29.53;
if (age < 1.84566) return "🌑";
if (age < 5.53699) return "🌒";
if (age < 9.22831) return "🌓";
if (age < 12.91963) return "🌔";
if (age < 16.61096) return "🌕";
if (age < 20.30228) return "🌖";
if (age < 23.99361) return "🌗";
if (age < 27.68493) return "🌘";
return "🌑";
}
function generateMiniMoonCalendar() {
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth();
const today = now.getDate();
const daysInMonth = new Date(year, month + 1, 0).getDate();
const container = document.getElementById("moon-mini-calendar");
container.innerHTML = "";
let firstDay = new Date(year, month, 1).getDay();
firstDay = (firstDay === 0) ? 6 : firstDay - 1;
for (let i = 0; i < firstDay; i++) {
const empty = document.createElement("div");
empty.classList.add("moon-day");
empty.style.visibility = "hidden";
container.appendChild(empty);
}
for (let day = 1; day <= daysInMonth; day++) {
const icon = moonPhaseForDate(year, month + 1, day);
const div = document.createElement("div");
div.classList.add("moon-day");
if (day === today) div.classList.add("moon-today");
div.innerHTML = `<span>${day}</span><span class="moon-icon">${icon}</span>`;
container.appendChild(div);
}
}
/* ==============================================
BULLET JOURNAL RESUMEN
============================================== */
function loadBulletSummary() {
const data = JSON.parse(localStorage.getItem("journalData")) || {};
const now = new Date();
const month = now.getMonth();
const year = now.getFullYear();
let rosario = 0, caminar = 0, vitaminas = 0, agua = 0;
for (let key in data) {
const d = new Date(key);
if (d.getMonth() === month && d.getFullYear() === year) {
if(data[key].rosario) rosario++;
if(data[key].caminar) caminar++;
if(data[key].vitaminas) vitaminas++;
agua += Number(data[key].agua || 0);
}
}
document.getElementById("bj-rosario").textContent = rosario;
document.getElementById("bj-caminar").textContent = caminar;
document.getElementById("bj-vitaminas").textContent = vitaminas;
document.getElementById("bj-agua").textContent = agua;
}
/* ==============================================
INICIALIZACIÓN
============================================== */
document.addEventListener("DOMContentLoaded", () => {
document.getElementById("year").innerText = new Date().getFullYear();
ponerlaFechaActual();
santoDelDia();
loadBulletSummary();
getMoonPhase();
generateMiniMoonCalendar();
// Inicializar sol/luna + tiempo actual con una sola geolocalización
initApp();
});
async function initApp() {
try {
const { lat, lon } = await getLocationOnce();
updateSunCard(lat, lon);
getWeather({ coords: { latitude: lat, longitude: lon } });
} catch (err) {
document.getElementById("location").textContent = "Error: " + err;
}
}

133
eltiempo/js/estadisticas.js Normal file
View File

@ -0,0 +1,133 @@
// API URL absoluta
const API_URL = "http://aplicacionesdevanguardia.es/eltiempo/apis/api-weather-reverse.php?ciudad=madrid";
/* ---------- UTILIDADES ---------- */
function $(id) {
return document.getElementById(id);
}
function monthName(monthIndex) {
return new Date(2026, monthIndex, 1)
.toLocaleDateString("es-ES", { month: "long" });
}
/* ---------- CARGA PRINCIPAL ---------- */
async function loadStats() {
try {
console.log("Cargando datos desde API:", API_URL);
const res = await fetch(API_URL);
if (!res.ok) throw `Error HTTP: ${res.status}`;
const data = await res.json();
console.log("Datos recibidos:", data);
if (!data || !data.length) throw "Sin datos";
renderLastDay(data[0]);
renderMonthStats(data);
renderTrend(data);
$("stats-location").textContent = "Madrid (datos históricos)";
} catch (e) {
$("stats-location").textContent = "Error cargando estadísticas";
console.error("Error en loadStats:", e);
}
}
/* ---------- ÚLTIMO DÍA ---------- */
function renderLastDay(day) {
$("last-date").textContent = day.dia;
$("last-temp").textContent = `${day.temp_min}°C / ${day.temp_max}°C`;
$("last-humidity").textContent = `${Math.round(day.humedad)} %`;
$("last-rain").textContent = `${day.lluvia} mm`;
$("last-wind").textContent = `${Math.round(day.viento_velocidad)} km/h`;
$("last-sunrise").textContent = day.amanecer;
$("last-sunset").textContent = day.anochecer;
}
/* ---------- RESUMEN DEL MES ---------- */
function renderMonthStats(data) {
const now = new Date();
const month = now.getMonth();
const year = now.getFullYear();
const monthData = data.filter(d => {
const date = new Date(d.dia);
return date.getMonth() === month && date.getFullYear() === year;
});
if (!monthData.length) return;
const maxTemps = monthData.map(d => d.temp_max);
const minTemps = monthData.map(d => d.temp_min);
const lluvia = monthData.reduce((sum, d) => sum + parseFloat(d.lluvia), 0);
const humedad = (
monthData.reduce((sum, d) => sum + parseFloat(d.humedad), 0) /
monthData.length
).toFixed(1);
$("month-days").textContent = monthData.length;
$("month-max").textContent = Math.max(...maxTemps) + "°C";
$("month-min").textContent = Math.min(...minTemps) + "°C";
$("month-rain").textContent = lluvia.toFixed(1) + " mm";
$("month-humidity").textContent = humedad + " %";
}
/* ---------- TENDENCIA HISTÓRICA ---------- */
function renderTrend(data) {
const now = new Date();
const month = now.getMonth();
const byYear = {};
data.forEach(d => {
const date = new Date(d.dia);
if (date.getMonth() === month) {
const year = date.getFullYear();
if (!byYear[year]) {
byYear[year] = { max: [], min: [], rain: [] };
}
byYear[year].max.push(d.temp_max);
byYear[year].min.push(d.temp_min);
byYear[year].rain.push(parseFloat(d.lluvia));
}
});
const container = $("trend-container");
container.innerHTML = "";
Object.keys(byYear)
.sort()
.forEach(year => {
const maxAvg = (byYear[year].max.reduce((a, b) => a + b, 0) / byYear[year].max.length).toFixed(1);
const minAvg = (byYear[year].min.reduce((a, b) => a + b, 0) / byYear[year].min.length).toFixed(1);
const rainTotal = (byYear[year].rain.reduce((a, b) => a + b, 0)).toFixed(1);
container.innerHTML += `
<p>
<strong>${year}</strong>
Máx ${maxAvg}°C ·
Mín ${minAvg}°C ·
Lluvia ${rainTotal} mm
</p>
`;
});
}
/* ---------- INIT ---------- */
document.addEventListener("DOMContentLoaded", () => {
$("year").textContent = new Date().getFullYear();
loadStats();
});

View File

@ -0,0 +1,148 @@
const API_URL = "http://aplicacionesdevanguardia.es/eltiempo/apis/api-weather-reverse.php?ciudad=madrid";
/* ---------- UTILIDADES ---------- */
function $(id) {
return document.getElementById(id);
}
function monthName(monthIndex) {
return new Date(2026, monthIndex, 1)
.toLocaleDateString("es-ES", { month: "long" });
}
/* ---------- CARGA PRINCIPAL ---------- */
async function loadStats() {
try {
const res = await fetch(API_URL);
const data = await res.json();
if (!data || !data.length) throw "Sin datos";
renderLastDay(data[0]);
renderMonthStats(data);
renderTrend(data);
$("stats-location").textContent = "Madrid (datos históricos)";
} catch (e) {
$("stats-location").textContent = "Error cargando estadísticas";
console.error(e);
}
}
/* ---------- ÚLTIMO DÍA ---------- */
function renderLastDay(day) {
$("last-date").textContent = day.dia;
$("last-temp").textContent = `${day.temp_min}°C / ${day.temp_max}°C`;
$("last-humidity").textContent = `${Math.round(day.humedad)} %`;
$("last-rain").textContent = `${day.lluvia} mm`;
$("last-wind").textContent = `${Math.round(day.viento_velocidad)} km/h`;
$("last-sunrise").textContent = day.amanecer;
$("last-sunset").textContent = day.anochecer;
}
/* ---------- RESUMEN DEL MES ---------- */
function renderMonthStats(data) {
const now = new Date();
const month = now.getMonth();
const year = now.getFullYear();
const monthData = data.filter(d => {
const date = new Date(d.dia);
return date.getMonth() === month && date.getFullYear() === year;
});
if (!monthData.length) return;
const maxTemps = monthData.map(d => d.temp_max);
const minTemps = monthData.map(d => d.temp_min);
const lluvia = monthData.reduce(
(sum, d) => sum + parseFloat(d.lluvia), 0
);
const humedad = (
monthData.reduce((sum, d) => sum + parseFloat(d.humedad), 0)
/ monthData.length
).toFixed(1);
$("month-days").textContent = monthData.length;
$("month-max").textContent = Math.max(...maxTemps) + "°C";
$("month-min").textContent = Math.min(...minTemps) + "°C";
$("month-rain").textContent = lluvia.toFixed(1) + " mm";
$("month-humidity").textContent = humedad + " %";
}
/* ---------- TENDENCIA HISTÓRICA ---------- */
function renderTrend(data) {
const now = new Date();
const month = now.getMonth();
const byYear = {};
data.forEach(d => {
const date = new Date(d.dia);
if (date.getMonth() === month) {
const year = date.getFullYear();
if (!byYear[year]) {
byYear[year] = { max: [], min: [], rain: [] };
}
byYear[year].max.push(d.temp_max);
byYear[year].min.push(d.temp_min);
byYear[year].rain.push(parseFloat(d.lluvia));
}
});
const container = $("trend-container");
container.innerHTML = "";
Object.keys(byYear)
.sort()
.forEach(year => {
const maxAvg = (
byYear[year].max.reduce((a,b)=>a+b,0) /
byYear[year].max.length
).toFixed(1);
const minAvg = (
byYear[year].min.reduce((a,b)=>a+b,0) /
byYear[year].min.length
).toFixed(1);
const rainTotal = (
byYear[year].rain.reduce((a,b)=>a+b,0)
).toFixed(1);
container.innerHTML += `
<p>
<strong>${year}</strong>
Máx ${maxAvg}°C ·
Mín ${minAvg}°C ·
Lluvia ${rainTotal} mm
</p>
`;
});
}
/* ---------- INIT ---------- */
document.addEventListener("DOMContentLoaded", () => {
$("year").textContent = new Date().getFullYear();
loadStats();
});

View File

@ -0,0 +1,87 @@
<?php
header('Content-Type: application/json');
// --- 1. Database Configuration (Example with external config) ---
// In a real scenario, this would come from a file outside the web root.
// For demonstration, let's just make it clear that this should be external.
define('DB_HOST', 'localhost');
define('DB_USER', 'admin');
define('DB_PASS', 'Eavne,e1m'); // !! IMPORTANT: Store this securely in a real application !!
define('DB_NAME', 'clima');
// --- 2. Input Validation ---
// Assuming 'ciudad' comes from a GET request.
$ciudad = $_GET['ciudad'] ?? ''; // Use null coalescing operator for cleaner default
if (empty($ciudad)) {
http_response_code(400); // Bad Request
echo json_encode(["error" => "Parámetro 'ciudad' es requerido."]);
exit(); // Stop script execution
}
// Optional: Further sanitize/validate the city name if needed (e.g., alphanumeric only)
// if (!preg_match('/^[a-zA-Z\s]+$/', $ciudad)) {
// http_response_code(400);
// echo json_encode(["error" => "El nombre de la ciudad contiene caracteres inválidos."]);
// exit();
// }
// --- 3. Database Connection ---
$conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if ($conn->connect_error) {
http_response_code(500); // Internal Server Error
echo json_encode(["error" => "Error de conexión a la base de datos: " . $conn->connect_error]);
exit();
}
// --- 4. Prepare and Execute Query ---
$stmt = $conn->prepare("
SELECT DATE(fecha) AS dia,
MIN(fecha) AS primera_fecha_del_dia,
MIN(amanecer) AS amanecer,
MAX(anochecer) AS anochecer,
MAX(temp_max) AS temp_max,
MIN(temp_min) AS temp_min,
AVG(humedad) AS humedad,
AVG(lluvia) AS lluvia,
AVG(nubes) AS nubes,
AVG(viento_velocidad) AS viento_velocidad,
AVG(viento_direccion) AS viento_direccion
FROM weather
WHERE DATE(fecha) >= '2024-10-01'
AND ciudad LIKE CONCAT('%', ?, '%')
GROUP BY DATE(fecha)
ORDER BY DATE(fecha) DESC
");
if (!$stmt) {
http_response_code(500); // Internal Server Error
echo json_encode(["error" => "Error al preparar la consulta: " . $conn->error]);
$conn->close();
exit();
}
$stmt->bind_param("s", $ciudad);
$stmt->execute();
$result = $stmt->get_result();
$datos = [];
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$datos[] = $row;
}
http_response_code(200); // OK
echo json_encode($datos);
} else {
// It's usually fine to return 200 OK with an empty array or a specific message
// if no data is found, rather than a 404, unless it signifies a resource that
// *should* exist but doesn't. For a query, 200 OK is typical.
http_response_code(200); // OK
echo json_encode(["message" => "No hay datos para la ciudad especificada"]);
}
// --- 5. Close Resources ---
$stmt->close();
$conn->close();
?>

3
info.php Normal file
View File

@ -0,0 +1,3 @@
<?php
phpinfo();