| |
|
|
| |
| function openTab(evt, tabName) { |
| var i, tabcontent, tablinks; |
| tabcontent = document.getElementsByClassName("tab-content"); |
| for (i = 0; i < tabcontent.length; i++) { tabcontent[i].classList.remove("active"); } |
| tablinks = document.getElementsByClassName("tab-btn"); |
| for (i = 0; i < tablinks.length; i++) { tablinks[i].classList.remove("active"); } |
| document.getElementById(tabName).classList.add("active"); |
| evt.currentTarget.classList.add("active"); |
| } |
|
|
| |
| async function loadDownloadsFromXML() { |
| const xmlUrl = 'https://huggingface.co/arepaconcafe/neko-base/resolve/main/downloads.xml'; |
| |
| try { |
| const response = await fetch(xmlUrl); |
| if (!response.ok) throw new Error('No se pudo cargar el archivo XML'); |
| |
| const xmlText = await response.text(); |
| const parser = new DOMParser(); |
| const xmlDoc = parser.parseFromString(xmlText, "text/xml"); |
|
|
| |
| const release = xmlDoc.getElementsByTagName("release")[0]; |
| if (release) { |
| const version = release.getAttribute("version"); |
| document.getElementById('version-tag').textContent = `v. ${version}`; |
| } |
|
|
| |
| const isos = xmlDoc.getElementsByTagName("iso"); |
| for (let i = 0; i < isos.length; i++) { |
| const id = isos[i].getAttribute("id"); |
| const url = isos[i].textContent.trim(); |
| |
| if (id === "link-xorg") document.getElementById('link-xorg').href = url; |
| if (id === "link-xlibre") document.getElementById('link-xlibre').href = url; |
| } |
| console.log("Enlaces de descarga sincronizados correctamente."); |
|
|
| } catch (error) { |
| console.error("Error al sincronizar con Hugging Face:", error); |
| document.getElementById('version-tag').textContent = "Error de sincronizaci贸n"; |
| } |
| } |
|
|
| |
| window.addEventListener('scroll', () => { |
| let current = ''; |
| const sections = document.querySelectorAll('section'); |
| sections.forEach(section => { |
| const sectionTop = section.offsetTop; |
| if (pageYOffset >= sectionTop - 150) { |
| current = section.getAttribute('id'); |
| } |
| }); |
|
|
| document.querySelectorAll('.nav-link').forEach(link => { |
| link.classList.remove('active'); |
| if (link.getAttribute('href').includes(current)) { |
| link.classList.add('active'); |
| } |
| }); |
| }); |
|
|
| |
| window.onload = loadDownloadsFromXML; |