Märkmaskiner

'; w.document.open(); w.document.write(html); w.document.close(); } function bind(){ const form = document.getElementById('etikettForm'); if(!form) return; document.addEventListener('change', (e)=>{ if(e.target.name==='preprinted') updatePreprinted(); if(e.target.id==='harsh_env_other_chk') updateHarshOther(); }); document.addEventListener('input', (e)=>{ const t=e.target; if(t.matches('#etikettForm input, #etikettForm textarea') && t.value.trim()!=='') t.classList.remove('is-invalid'); }); document.addEventListener('change', (e)=>{ const t=e.target; if(t.matches('#etikettForm select') && t.value) t.classList.remove('is-invalid'); if(t.name==='preprinted'){ const inline=t.closest('.row')?.querySelector('.inline'); if(inline) inline.classList.remove('is-invalid'); const err=document.querySelector('[data-err-for="preprinted"]'); if(err) err.textContent=''; } }); const btn = document.getElementById('previewBtn'); if (btn){ const clone = btn.cloneNode(true); btn.parentNode.replaceChild(clone, btn); clone.addEventListener('click', (ev)=>{ ev.preventDefault(); if(!validateForm()){ scrollToFirst(); return; } openPreview(collect()); }); } form.addEventListener('submit', (e)=>{ e.preventDefault(); if(validateForm()){} else scrollToFirst(); }); updatePreprinted(); updateHarshOther(); } if(document.readyState==='loading'){ document.addEventListener('DOMContentLoaded', bind, {once:true}); } else { bind(); } window.addEventListener('load', bind, {once:true}); })(); '; w.document.open(); w.document.write(html); w.document.close(); } function bind(){ const form = document.getElementById('etikettForm'); if(!form) return; document.addEventListener('change', (e)=>{ if(e.target.name==='preprinted') updatePreprinted(); if(e.target.id==='harsh_env_other_chk') updateHarshOther(); }); document.addEventListener('input', (e)=>{ const t=e.target; if(t.matches('#etikettForm input, #etikettForm textarea') && t.value.trim()!=='') t.classList.remove('is-invalid'); }); document.addEventListener('change', (e)=>{ const t=e.target; if(t.matches('#etikettForm select') && t.value) t.classList.remove('is-invalid'); if(t.name==='preprinted'){ const inline=t.closest('.row')?.querySelector('.inline'); if(inline) inline.classList.remove('is-invalid'); const err=document.querySelector('[data-err-for="preprinted"]'); if(err) err.textContent=''; } }); const btn = document.getElementById('previewBtn'); if (btn){ const clone = btn.cloneNode(true); btn.parentNode.replaceChild(clone, btn); clone.addEventListener('click', (ev)=>{ ev.preventDefault(); if(!validateForm()){ scrollToFirst(); return; } openPreview(collect()); }); } form.addEventListener('submit', (e)=>{ e.preventDefault(); if(validateForm()){} else scrollToFirst(); }); updatePreprinted(); updateHarshOther(); } if(document.readyState==='loading'){ document.addEventListener('DOMContentLoaded', bind, {once:true}); } else { bind(); } window.addEventListener('load', bind, {once:true}); })();