1document.addEventListener('DOMContentLoaded', () => { 2 const form = document.getElementById('astroForm'); if (!form) return; 3 form.addEventListener('submit', async event => { 4 event.preventDefault(); const button = form.querySelector('button[type="submit"]'); if (button.disabled) return; 5 const api = window.AstroApi, loading = document.getElementById('loading'), result = document.getElementById('result'), output = document.getElementById('downloadLink'); 6 button.disabled = true; loading.style.display='block'; result.style.display='none'; output.replaceChildren(); 7 try { 8 const date = form.querySelector('#date').value, time = form.querySelector('#time').value, timezone = form.querySelector('#timezone').value, system = form.querySelector('#system').value; 9 api.validBirth(date,time,timezone); 10 const coords = await api.geocode(form.querySelector('#location').value); 11 const body = {birth_date:date,birth_time:time,...coords,timezone,house_system:'P'}; 12 if (system === 'sideral') body.sidereal_system='Fagan-Bradley'; else body.use_true_node=false; 13 const data = await api.post(system === 'sideral' ? '/generate_sideral_chart/' : '/generate_chart/',body); 14 if (typeof data.url !== 'string') throw new Error('No se recibió el gráfico esperado.'); 15 const link = api.node('a','Descargar tu carta astral'); link.href=api.safeUrl(data.url); link.target='_blank'; link.rel='noopener noreferrer'; link.setAttribute('download',''); output.append(link); 16 } catch (error) { output.append(api.node('span',api.errorText(error))); } 17 finally {loading.style.display='none';result.style.display='block';button.disabled=false;} 18 }); 19});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.