Recess Landing Page — Code Generator
`;
}
function formToVars(form){
const fd = new FormData(form);
const obj = Object.fromEntries(fd.entries());
return obj;
}
$('#genBtn').addEventListener('click', ()=>{
const vars = formToVars($('#genForm'));
const html = buildTemplate(vars);
$('#output').value = html;
});
$('#copyBtn').addEventListener('click', async ()=>{
const t = $('#output');
t.select(); t.setSelectionRange(0, t.value.length);
try{ await navigator.clipboard.writeText(t.value); }catch(e){}
});
$('#downloadBtn').addEventListener('click', ()=>{
const code = $('#output').value || '';
const blob = new Blob([code], {type:'text/html'});
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'recess-landing-page.html';
document.body.appendChild(a); a.click(); a.remove();
setTimeout(()=>URL.revokeObjectURL(a.href), 1000);
});
})();