-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
178 lines (158 loc) · 7.41 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head> <!-- Info que aparece en vista previa al compartir enlace -->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HISPANIC GALAXYꕥ</title>
<link href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@300..700&display=swap" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="web/favicon.ico">
<link rel="stylesheet" href="web/estilo.css">
<meta name="description" content="La Comunidad Hispana Mas Grande de SA">
<meta property="og:image" content="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Travel%20and%20places/Sun%20with%20Face.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
</head>
<body>
<div class="loading-screen" id="loading-screen"> <!-- Vista de carga al iniciar -->
<p>⌛Cargando⏳</p>
</div>
<!-- Video -->
<video autoplay muted loop id="bg-video" preload="auto">
<source src="" type="video/mp4">
Error al cargar el video
</video>
<div class="content" id="content">
<p>⌛Cargando⏳</p>
</div>
<script>
// videos rotativos por mes.
const monthlyVideos = {
0: 'https://videos.pexels.com/video-files/5834608/5834608-hd_1280_720_25fps.mp4', // Enero
1: 'https://videos.pexels.com/video-files/8279906/8279906-hd_1280_720_24fps.mp4', // Febrero
2: 'https://github.com/user-attachments/assets/acd45c39-0dbc-48b7-8d20-3c7556688428', // Marzo
3: 'https://github.com/user-attachments/assets/acd45c39-0dbc-48b7-8d20-3c7556688428', // Abril
4: 'https://github.com/user-attachments/assets/acd45c39-0dbc-48b7-8d20-3c7556688428', // Mayo
5: 'https://github.com/user-attachments/assets/acd45c39-0dbc-48b7-8d20-3c7556688428', // Junio
6: 'https://github.com/user-attachments/assets/acd45c39-0dbc-48b7-8d20-3c7556688428', // Julio
7: 'https://videos.pexels.com/video-files/6157145/6157145-hd_1366_720_25fps.mp4', // Agosto
8: 'https://github.com/user-attachments/assets/acd45c39-0dbc-48b7-8d20-3c7556688428', // Septiembre
9: 'https://github.com/user-attachments/assets/acd45c39-0dbc-48b7-8d20-3c7556688428', // Octubre
10: 'https://videos.pexels.com/video-files/4957757/4957757-hd_1280_720_50fps.mp4', // Noviembre
11: 'https://github.com/user-attachments/assets/b746d91d-55ae-4679-add6-fcf71e05dcd4' // Diciembre
};
// Función para obtener el video según el mes actual
function getCurrentMonthVideo() {
const currentMonth = new Date().getMonth();
return monthlyVideos[currentMonth];
}
function hideLoadingScreen() {
document.getElementById('loading-screen').classList.add('hide');
}
async function loadContent(url, fallbackUrl = null) {
try {
const response = await fetch(url);
if (!response.ok) throw new Error(`Error fetching ${url}: ${response.statusText}`);
document.getElementById('content').innerHTML = await response.text();
loadDisqus();
} catch (error) {
console.error(`Error cargando contenido: ${error.message}`);
if (fallbackUrl) {
loadContent(fallbackUrl);
} else {
document.getElementById('content').innerHTML = `<p>Error Cargando: ${error.message}</p>`;
}
}
}
function loadDisqus() {
const disqusDiv = document.createElement('div');
disqusDiv.id = 'disqus_thread';
document.getElementById('content').appendChild(disqusDiv);
window.disqus_config = function () {
this.page.url = window.location.href;
this.page.identifier = document.title;
};
const s = document.createElement('script');
s.src = 'https://amigos-steam.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
document.body.appendChild(s);
}
function getLocalizedUrl(urlBase) {
const lang = navigator.language.slice(0, 2);
const langMap = {
es: 'es.html', // Idioma por archivo. Español
pt: 'pt.html',
fr: 'fr.html',
ru: 'ru.html',
ar: 'ar.html',
hi: 'hi.html'
};
return `${urlBase}${langMap[lang] || 'ingles.html'}`; // Predeterminado ingles en caso de no existir archivo de idioma.
}
function loadLocalizedContent(urlBase) {
const localizedUrl = getLocalizedUrl(urlBase);
const fallbackUrl = `${urlBase}ingles.html`;
loadContent(localizedUrl, fallbackUrl);
}
function initializeVideo() {
const bgVideo = document.getElementById('bg-video');
bgVideo.querySelector('source').src = getCurrentMonthVideo();
bgVideo.load();
const timeoutId = setTimeout(() => {
bgVideo.pause();
bgVideo.src = '';
bgVideo.load();
hideLoadingScreen();
}, 5000);
bgVideo.addEventListener('loadeddata', () => {
clearTimeout(timeoutId);
hideLoadingScreen();
});
}
// Variables para el historial
let currentPage = null;
let isFirstLoad = true;
// Inicialización cuando el DOM está listo
document.addEventListener("DOMContentLoaded", () => {
initializeVideo();
// Guardar la página inicial
currentPage = window.location.href;
loadLocalizedContent('web/');
isFirstLoad = false;
});
// Manejo de clicks en enlaces
document.addEventListener('click', (event) => {
const anchor = event.target.closest('a');
if (anchor && anchor.href.includes('web/')) {
event.preventDefault();
window.scrollTo({ top: 0, behavior: 'smooth' });
const baseUrl = anchor.href.substring(0, anchor.href.lastIndexOf('/') + 1);
// Agregar la nueva página al historial
if (!isFirstLoad) {
history.pushState({ page: anchor.href }, '', window.location.href);
}
currentPage = anchor.href;
loadLocalizedContent(baseUrl);
}
});
// Manejo del botón atrás
window.onpopstate = function(event) {
if (event.state && event.state.page) {
// Si hay un estado guardado, cargar esa página
const baseUrl = event.state.page.substring(0, event.state.page.lastIndexOf('/') + 1);
loadLocalizedContent(baseUrl);
} else {
// Si no hay estado, simplemente recargar la página actual
window.location.reload();
}
};
</script>
<!-- Widget de Discord -->
<script src="https://cdn.jsdelivr.net/npm/@widgetbot/crate@3" async defer>
new Crate({
server: '1295581997967868005',
channel: '1295818306871230645'
});
</script>
<noscript>JavaScript OFF. Se requiere JS activado</noscript>
</body>
</html>