(function () { const params = new URLSearchParams(window.location.search); const f = params.get('f'); const tema = params.get('tema'); if (tema) { document.getElementById('back-link').href = 'esquema.html?tema=' + tema; } if (!f) { document.getElementById('loading').textContent = 'No se especificó ningún fichero.'; return; } fetch(f) .then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r.text(); }) .then(function (md) { const nombre = f.split('/').pop().replace('.md', ''); document.getElementById('page-title').textContent = nombre; document.title = nombre + ' · TAI'; const contenido = document.getElementById('contenido'); contenido.innerHTML = marked.parse(md); }) .catch(function (err) { document.getElementById('loading').innerHTML = '
Error al cargar el fichero: ' + err.message + '
' + 'Abre el visor desde un servidor local, no directamente con file://:
' +
'cd /home/tatvil/trabajo/oposiciones/taiage-apuntes\npython3 -m http.server 8000' +
'' +
'Luego abre: http://localhost:8000/esquema.html
'; }); }());