-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhexagrama.html
More file actions
423 lines (376 loc) · 15.1 KB
/
hexagrama.html
File metadata and controls
423 lines (376 loc) · 15.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- ========== SECURITY: Content Security Policy ========== -->
<meta http-equiv="Content-Security-Policy" content="
default-src 'self';
script-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://www.gstatic.com;
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://cdnjs.cloudflare.com;
font-src 'self' https://fonts.gstatic.com https://cdnjs.cloudflare.com;
connect-src 'self' https://*.firebase.googleapis.com https://*.firebaseio.com;
img-src 'self' data: https:;
base-uri 'self';
form-action 'self'
" />
<!-- ====================================================== -->
<meta name="description"
content="Explora el Hexagrama #X del I Ching. Descubre su juicio, imagen, interpretación y líneas específicas." />
<!-- Open Graph / Facebook -->
<meta property="og:type" content="article" />
<meta property="og:url" content="https://iching-librodemutaciones.web.app/hexagrama.html?id=1" />
<meta property="og:title" content="Hexagrama #1 - Ch'ien - Lo Creativo" />
<meta property="og:description"
content="Explora el Hexagrama #1 del I Ching: Ch'ien - Lo Creativo. Descubre su juicio, imagen, interpretación y líneas específicas." />
<meta property="og:image" content="assets/images/og-image-hexagrama-1.jpg" />
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content="https://iching-librodemutaciones.web.app/hexagrama.html?id=1" />
<meta property="twitter:title" content="Hexagrama #1 - Ch'ien - Lo Creativo" />
<meta property="twitter:description"
content="Explora el Hexagrama #1 del I Ching: Ch'ien - Lo Creativo. Descubre su juicio, imagen, interpretación y líneas específicas." />
<meta property="twitter:image" content="assets/images/og-image-hexagrama-1.jpg" />
<title>
Hexagrama #<span id="hexagram-number">1</span> - El Oráculo del I Ching
</title>
<!-- Favicon -->
<link rel="apple-touch-icon" sizes="180x180" href="assets/images/favicon/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicon/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon/favicon-16x16.png" />
<link rel="manifest" href="assets/images/favicon/site.webmanifest" />
<link rel="mask-icon" href="assets/images/favicon/safari-pinned-tab.svg" color="#8c1c13" />
<meta name="msapplication-TileColor" content="#8c1c13" />
<meta name="theme-color" content="#8c1c13" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="dns-prefetch" href="https://cdnjs.cloudflare.com" />
<link
href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&family=Noto+Serif:ital,wght@0,400;0,700;1,400&display=swap"
rel="stylesheet" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" media="print"
onload="this.media='all'" />
<!-- Enlace al CSS - ¡CORREGIDO! -->
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="container">
<header>
<div class="logo-container">loading="eager"
<img src="assets/images/logo.png" alt="Logo del Oráculo del I Ching" class="logo" />
<h1>El Oráculo del I Ching</h1>
</div>
<p>Explorando el Hexagrama #<span id="header-number">1</span></p>
</header>
<nav>
<ul>
<li>
<a href="index.html#inicio"><i class="fas fa-home"></i> Inicio</a>
</li>
<li>
<a href="index.html#consultor"><i class="fas fa-hand-point-right"></i> Consulta</a>
</li>
<li>
<a href="index.html#biblioteca"><i class="fas fa-book"></i> Biblioteca</a>
</li>
</ul>
</nav>
<main>
<section id="hexagram-detail">
<div class="section-header">
<h2>
Hexagrama #<span id="detail-number">1</span>:
<span id="hexagram-title">Ch'ien - Lo Creativo</span>
</h2>
<p>La esencia y significado profundo</p>
</div>
<div class="hexagram-detail-container">
<div class="hexagram-visual">
<div id="hexagram-symbol" class="card-hexagram">
<!-- Se llenará dinámicamente -->
</div>
<div class="hexagram-info">
<div class="hexagram-id">
Hexagrama #<span id="info-number">1</span>
</div>
<div class="hexagram-name" id="info-name">
Ch'ien - Lo Creativo
</div>
<div class="hexagram-binary" id="info-binary">111111</div>
<div class="hexagram-symbol" id="info-symbol">☰</div>
</div>
</div>
<div class="hexagram-content">
<div class="judgment-section">
<h3>Juicio</h3>
<p id="judgment-text">
Lo Creativo obra elevado éxito, propiciando mediante la
perseverancia.
</p>
</div>
<div class="image-section">
<h3>Imagen</h3>
<p id="image-text">
El movimiento de los cielos está lleno de poder. Así, el
hombre superior se hace fuerte e incansable.
</p>
</div>
<div class="interpretation-section">
<h3>Interpretación</h3>
<p id="interpretation-text">
Este hexagrama representa el cielo, la fuerza creativa, el
principio masculino y el movimiento constante. Simboliza la
acción, la iniciativa y la perseverancia. Es un momento para
avanzar con determinación y confianza, pero también para ser
consciente de los límites y no caer en la arrogancia. Ch'ien
es la energía del comienzo, la creación y el desarrollo
continuo.
</p>
</div>
<div class="lines-section">
<h3>Líneas</h3>
<div id="lines-container">
<!-- Líneas se llenarán dinámicamente -->
</div>
</div>
<div class="mutations-section">
<h3>Mutaciones</h3>
<ul id="mutations-list">
<!-- Mutaciones se llenarán dinámicamente -->
</ul>
</div>
</div>
</div>
</section>
</main>
<footer>
<div class="footer-grid">
<div class="footer-section">
<h3>El Oráculo del I Ching</h3>
<p>
Un espacio dedicado a la difusión y estudio del Libro de las
Mutaciones, patrimonio cultural de la humanidad.
</p>
</div>
<div class="footer-section">
<h3>Enlaces Rápidos</h3>
<ul>
<li><a href="index.html#inicio">Inicio</a></li>
<li><a href="index.html#consultor">Consulta</a></li>
<li><a href="index.html#biblioteca">Biblioteca</a></li>
<li><a href="index.html#historia">Historia</a></li>
<li><a href="index.html#filosofia">Filosofía</a></li>
</ul>
</div>
<div class="footer-section">
<h3>Recursos</h3>
<ul>
<li><a href="#">Glosario de Términos</a></li>
<li><a href="#">Métodos de Consulta</a></li>
<li><a href="#">Interpretación de Hexagramas</a></li>
<li><a href="#">Artículos Académicos</a></li>
</ul>
</div>
</div>
<div class="copyright">
<p>
© 2025 El Oráculo del I Ching by Jose Álvarez Dev - Todos los
derechos reservados.
</p>
</div>
</footer>
</div>
<script>
// Obtener el ID del hexagrama de los parámetros de la URL
const urlParams = new URLSearchParams(window.location.search);
const hexagramId = urlParams.get("id") || "1";
// Función para actualizar meta tags dinámicamente
function updateMetaTags(hexagram) {
// Actualizar título
document.title = `Hexagrama #${hexagram.id} - ${hexagram.nombre} - El Oráculo del I Ching`;
// Actualizar description
const metaDescription = document.querySelector(
'meta[name="description"]'
);
if (metaDescription) {
metaDescription.setAttribute(
"content",
`Explora el Hexagrama #${hexagram.id} del I Ching: ${hexagram.nombre}. Descubre su juicio, imagen, interpretación y líneas específicas.`
);
}
// Actualizar Open Graph title
const ogTitle = document.querySelector('meta[property="og:title"]');
if (ogTitle) {
ogTitle.setAttribute(
"content",
`Hexagrama #${hexagram.id} - ${hexagram.nombre}`
);
}
// Actualizar Open Graph description
const ogDescription = document.querySelector(
'meta[property="og:description"]'
);
if (ogDescription) {
ogDescription.setAttribute(
"content",
`Explora el Hexagrama #${hexagram.id} del I Ching: ${hexagram.nombre}. Descubre su juicio, imagen, interpretación y líneas específicas.`
);
}
// Actualizar Open Graph URL
const ogUrl = document.querySelector('meta[property="og:url"]');
if (ogUrl) {
ogUrl.setAttribute(
"content",
`${window.location.origin}${window.location.pathname}?id=${hexagram.id}`
);
}
// Actualizar Open Graph image
const ogImage = document.querySelector('meta[property="og:image"]');
if (ogImage) {
ogImage.setAttribute(
"content",
`assets/images/og-image-hexagrama-${hexagram.id}.jpg`
);
}
// Actualizar Twitter title
const twitterTitle = document.querySelector(
'meta[property="twitter:title"]'
);
if (twitterTitle) {
twitterTitle.setAttribute(
"content",
`Hexagrama #${hexagram.id} - ${hexagram.nombre}`
);
}
// Actualizar Twitter description
const twitterDescription = document.querySelector(
'meta[property="twitter:description"]'
);
if (twitterDescription) {
twitterDescription.setAttribute(
"content",
`Explora el Hexagrama #${hexagram.id} del I Ching: ${hexagram.nombre}. Descubre su juicio, imagen, interpretación y líneas específicas.`
);
}
// Actualizar Twitter image
const twitterImage = document.querySelector(
'meta[property="twitter:image"]'
);
if (twitterImage) {
twitterImage.setAttribute(
"content",
`assets/images/og-image-hexagrama-${hexagram.id}.jpg`
);
}
}
// Función auxiliar para actualizar elementos de forma segura
function safeUpdateElement(id, content) {
const element = document.getElementById(id);
if (element) {
element.textContent = content;
return true;
}
return false;
}
// Función para mostrar errores
function showError(message) {
const content = document.querySelector(".hexagram-content");
if (content) {
content.innerHTML = `
<div class="error-message">
<h2>Error</h2>
<p>${message}</p>
<p><a href="index.html#biblioteca">Volver a la biblioteca</a></p>
</div>
`;
}
}
// Función para actualizar el contenido del hexagrama
function updateHexagramContent(hexagram) {
// Actualizar todos los elementos de forma segura
safeUpdateElement("hexagram-number", hexagram.id);
safeUpdateElement("header-number", hexagram.id);
safeUpdateElement("detail-number", hexagram.id);
safeUpdateElement("hexagram-title", hexagram.nombre);
safeUpdateElement("info-number", hexagram.id);
safeUpdateElement("info-name", hexagram.nombre);
safeUpdateElement("info-binary", `Binario: ${hexagram.binario}`);
safeUpdateElement("info-symbol", `Símbolo: ${hexagram.simbolo}`);
safeUpdateElement("judgment-text", hexagram.juicio);
safeUpdateElement("image-text", hexagram.imagen);
safeUpdateElement("interpretation-text", hexagram.interpretacion);
// Actualizar el hexagrama visual
const hexagramSymbol = document.getElementById("hexagram-symbol");
if (hexagramSymbol) {
hexagramSymbol.innerHTML = "";
const lines = hexagram.binario.split("");
for (let i = 5; i >= 0; i--) {
const lineDiv = document.createElement("div");
lineDiv.className = lines[i] === "1" ? "line" : "line broken";
hexagramSymbol.appendChild(lineDiv);
}
}
// Actualizar las líneas (SECURITY: Sanitizar datos)
const linesContainer = document.getElementById("lines-container");
if (linesContainer) {
linesContainer.innerHTML = "";
hexagram.lineas.forEach((line, index) => {
const lineDiv = document.createElement("div");
lineDiv.className = "line-item";
// ========== SECURITY FIX: Usar createElement en lugar de innerHTML ==========
const strongEl = document.createElement("strong");
strongEl.textContent = `Línea ${index + 1}:`;
lineDiv.appendChild(strongEl);
// Agregar el texto de la línea de forma segura
lineDiv.appendChild(document.createTextNode(` ${line}`));
// ============================================
linesContainer.appendChild(lineDiv);
});
}
// Actualizar las mutaciones
const mutationsList = document.getElementById("mutations-list");
if (mutationsList) {
mutationsList.innerHTML = "";
hexagram.mutaciones.forEach((mutation) => {
const li = document.createElement("li");
li.textContent = mutation;
mutationsList.appendChild(li);
});
}
}
// Cargar los datos del hexagrama
document.addEventListener("DOMContentLoaded", async () => {
try {
const response = await fetch("hexagramas.json");
if (!response.ok) {
throw new Error(
`Error ${response.status} al cargar hexagramas.json`
);
}
const data = await response.json();
// Encontrar el hexagrama por ID
const hexagram = data.hexagramas.find((h) => h.id == hexagramId);
if (hexagram) {
// Actualizar meta tags
updateMetaTags(hexagram);
// Actualizar contenido
updateHexagramContent(hexagram);
} else {
// Manejar hexagrama no encontrado
showError(
`Hexagrama #${hexagramId} no encontrado. Por favor, verifica el número.`
);
console.warn(
`Hexagrama #${hexagramId} no encontrado en la base de datos.`
);
}
} catch (error) {
console.error("Error al cargar el hexagrama:", error);
showError(
`Error al cargar los datos del hexagrama: ${error.message}`
);
}
});
</script>
</body>
</html>