-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
156 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,164 @@ | ||
<script> | ||
async function loadContent(url, updateHistory = true) { | ||
try { | ||
const response = await fetch(url); | ||
if (!response.ok) throw new Error(`Error fetching ${url}: ${response.statusText}`); | ||
const htmlContent = await response.text(); | ||
document.getElementById('content').innerHTML = htmlContent; | ||
|
||
// Actualiza la URL en la barra de direcciones sin recargar la página | ||
if (updateHistory) { | ||
history.pushState({ url: url }, '', url); | ||
} | ||
|
||
// Cargar Disqus en la nueva sección | ||
const disqusDiv = document.createElement('div'); | ||
disqusDiv.id = 'disqus_thread'; | ||
document.getElementById('content').appendChild(disqusDiv); | ||
|
||
var disqus_config = function () { | ||
this.page.url = window.location.href; | ||
this.page.identifier = document.title; | ||
}; | ||
|
||
(function() { | ||
var d = document, s = d.createElement('script'); | ||
s.src = 'https://amigos-steam.disqus.com/embed.js'; | ||
s.setAttribute('data-timestamp', +new Date()); | ||
(d.head || d.body).appendChild(s); | ||
})(); | ||
} catch (error) { | ||
console.error(error); | ||
document.getElementById('content').innerHTML = `<p>Error loading content: ${error.message}</p>`; | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<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"> | ||
<style> | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
font-family: 'Comfortaa', sans-serif; | ||
color: white; | ||
overflow-x: hidden; | ||
} | ||
} | ||
|
||
// Manejador de eventos para los enlaces internos | ||
document.addEventListener('click', function(event) { | ||
const target = event.target; | ||
|
||
// Si el elemento clicado es un enlace | ||
if (target.tagName === 'A') { | ||
const href = target.getAttribute('href'); | ||
|
||
// Verificar si es un enlace interno (que empieza con "web/") o relativo | ||
if (href.startsWith('web/') || href.startsWith('./') || href.startsWith('/')) { | ||
event.preventDefault(); // Evita la carga completa de la página | ||
loadContent(href); // Carga el contenido dinámicamente | ||
} else if (href.startsWith('http://') || href.startsWith('https://')) { | ||
// Para enlaces externos, no hacemos nada, el navegador los manejará | ||
return; | ||
} | ||
video#bg-video { | ||
position: fixed; | ||
top: 50%; | ||
left: 50%; | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
transform: translate(-50%, -50%); | ||
z-index: -1; | ||
} | ||
a { | ||
color: lightblue; | ||
cursor: pointer; | ||
} | ||
blockquote { | ||
margin: 20px 0; | ||
padding: 10px 20px; | ||
background-color: rgba(0, 0, 0, 0.7); | ||
border-left: 5px solid #ccc; | ||
color: white; | ||
} | ||
code { | ||
font-family: monospace; | ||
padding: 2px 4px; | ||
border-radius: 4px; | ||
background-color: rgba(0, 0, 0, 0.7); | ||
border-left: 5px solid #ccc; | ||
color: white; | ||
} | ||
.content { | ||
background-color: rgba(0, 0, 0, 0.7); | ||
padding: 20px; | ||
border-radius: 10px; | ||
max-width: 800px; | ||
margin: 50px auto; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); | ||
position: relative; | ||
z-index: 1; | ||
# Fondo Borroso. backdrop-filter: blur(10px); | ||
} | ||
}); | ||
|
||
// Detectar cuando el usuario navega hacia atrás/adelante | ||
window.onpopstate = function(event) { | ||
if (event.state && event.state.url) { | ||
loadContent(event.state.url, false); // Cargar sin modificar el historial | ||
h1, p { | ||
color: white; | ||
} | ||
|
||
#disqus_thread { | ||
margin-top: 20px; | ||
} | ||
}; | ||
</style> | ||
</head> | ||
<body> | ||
<video autoplay muted loop id="bg-video"> | ||
<source src="https://github.com/user-attachments/assets/fd54742d-a7e9-49f4-b268-da16689918c1" type="video/mp4"> | ||
Tu navegador no soporta el elemento de video. | ||
</video> | ||
|
||
<div class="content" id="content"> | ||
<p>Contenido inicial cargado dinámicamente.</p> | ||
</div> | ||
|
||
<script> | ||
// Función para cargar el contenido dinámico | ||
async function loadContent(url, updateHistory = true) { | ||
try { | ||
const response = await fetch(url); | ||
if (!response.ok) throw new Error(`Error fetching ${url}: ${response.statusText}`); | ||
const htmlContent = await response.text(); | ||
document.getElementById('content').innerHTML = htmlContent; | ||
|
||
// Actualiza la URL en la barra de direcciones sin recargar la página | ||
if (updateHistory) { | ||
history.pushState({ url: url }, '', url); | ||
} | ||
|
||
// Cargar Disqus en la nueva sección | ||
const disqusDiv = document.createElement('div'); | ||
disqusDiv.id = 'disqus_thread'; | ||
document.getElementById('content').appendChild(disqusDiv); | ||
|
||
// Cargar contenido inicial basado en el idioma | ||
document.addEventListener("DOMContentLoaded", function() { | ||
const userLang = navigator.language || navigator.userLanguage; | ||
let htmlFile = 'web/ingles.html'; | ||
var disqus_config = function () { | ||
this.page.url = window.location.href; | ||
this.page.identifier = document.title; | ||
}; | ||
|
||
if (userLang.startsWith('es')) { | ||
htmlFile = 'web/es.html'; | ||
} else if (userLang.startsWith('pt')) { | ||
htmlFile = 'web/pt.html'; | ||
(function() { | ||
var d = document, s = d.createElement('script'); | ||
s.src = 'https://amigos-steam.disqus.com/embed.js'; | ||
s.setAttribute('data-timestamp', +new Date()); | ||
(d.head || d.body).appendChild(s); | ||
})(); | ||
} catch (error) { | ||
console.error(error); | ||
document.getElementById('content').innerHTML = `<p>Error loading content: ${error.message}</p>`; | ||
} | ||
} | ||
|
||
loadContent(htmlFile); | ||
}); | ||
</script> | ||
// Detectar cuando el usuario navega hacia atrás/adelante | ||
window.onpopstate = function(event) { | ||
if (event.state && event.state.url) { | ||
loadContent(event.state.url, false); // Cargar sin modificar el historial | ||
} | ||
}; | ||
|
||
// Cargar contenido inicial basado en el idioma | ||
document.addEventListener("DOMContentLoaded", function() { | ||
const userLang = navigator.language || navigator.userLanguage; | ||
let htmlFile = 'web/ingles.html'; // Archivo predeterminado | ||
|
||
if (userLang.startsWith('es')) { | ||
htmlFile = 'web/es.html'; | ||
} else if (userLang.startsWith('pt')) { | ||
htmlFile = 'web/pt.html'; | ||
} | ||
|
||
// Cargar contenido inicial según el idioma detectado | ||
loadContent(htmlFile, false); | ||
}); | ||
|
||
// Manejador de eventos para interceptar enlaces internos | ||
document.addEventListener('click', function(event) { | ||
const target = event.target; | ||
|
||
// Si el elemento clicado es un enlace | ||
if (target.tagName === 'A') { | ||
const href = target.getAttribute('href'); | ||
|
||
// Verificar si es un enlace interno (que empieza con "web/") o relativo | ||
if (href.startsWith('web/') || href.startsWith('./') || href.startsWith('/')) { | ||
event.preventDefault(); // Evita la carga completa de la página | ||
loadContent(href); // Carga el contenido dinámicamente | ||
} else if (href.startsWith('http://') || href.startsWith('https://')) { | ||
// Para enlaces externos, no hacemos nada, el navegador los manejará | ||
return; | ||
} | ||
} | ||
}); | ||
</script> | ||
|
||
<script src='https://cdn.jsdelivr.net/npm/@widgetbot/crate@3' async defer> | ||
new Crate({ | ||
server: '1278571215635877908', // Basu | ||
channel: '1280976262504124508' // #basurero-sexta-feira | ||
}) | ||
</script> | ||
|
||
<noscript> JavaScript OFF.</noscript> | ||
</body> | ||
</html> |