Download script.js from arepaconcafe/neko-base: direct link, hf CLI and curl.
- Browser
- Download file 2.7 kB
-
https://huggingface.co/arepaconcafe/neko-base/resolve/refs%2Fpr%2F1/script.js
- Command line
-
hf download hf://arepaconcafe/neko-base@refs/pr/1/script.js
-
curl -L -o script.js https://huggingface.co/arepaconcafe/neko-base/resolve/refs%2Fpr%2F1/script.js
2.7 kB
| // script.js | |
| // Funci贸n para cambiar pesta帽as | |
| 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"); | |
| } | |
| // Funci贸n para cargar enlaces desde el XML externo | |
| 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"); | |
| // Obtener versi贸n si existe en el XML | |
| const release = xmlDoc.getElementsByTagName("release")[0]; | |
| if (release) { | |
| const version = release.getAttribute("version"); | |
| document.getElementById('version-tag').textContent = `v. ${version}`; | |
| } | |
| // Buscar nodos <iso> y asignar enlaces | |
| 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"; | |
| } | |
| } | |
| // L贸gica de Scroll para el men煤 lateral | |
| 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'); | |
| } | |
| }); | |
| }); | |
| // Inicializar carga al abrir la p谩gina | |
| window.onload = loadDownloadsFromXML; |