5d66c62bd6
Claude-Session: https://claude.ai/code/session_01GzammAMzsJTgpQHqxwM2bC
33 lines
1.8 KiB
HTML
33 lines
1.8 KiB
HTML
{{define "inline_confirm_js"}}
|
|
<script>
|
|
/* Inline two-step confirm (take-two F-16, the hub siblings of drill F-11): the trigger swaps IN
|
|
PLACE to "<question> Igen/Mégse". Never native confirm() — an OS-modal dialog freezes browser
|
|
automation (CDP) and blocks the session. Form buttons opt in with data-confirm="…" (submitted
|
|
via requestSubmit so formaction/name-value are honored); JS flows call
|
|
felhomConfirm(el, question, onYes) directly. NOT for the danger-zone typed-confirm cascade —
|
|
that heavyweight flow stays as is. */
|
|
function felhomConfirm(el,question,onYes){
|
|
if(!el||el.dataset.fcOpen)return;
|
|
el.dataset.fcOpen='1';
|
|
var wrap=document.createElement('span');wrap.className='inline-confirm';
|
|
var q=document.createElement('span');q.className='inline-confirm-q';q.textContent=question;
|
|
var yes=document.createElement('button');yes.type='button';yes.className='btn btn-sm btn-danger';yes.textContent='Igen';
|
|
var no=document.createElement('button');no.type='button';no.className='btn btn-sm btn-outline';no.textContent='Mégse';
|
|
wrap.appendChild(q);wrap.appendChild(yes);wrap.appendChild(no);
|
|
el.style.display='none';el.parentNode.insertBefore(wrap,el.nextSibling);
|
|
function close(){wrap.remove();el.style.display='';delete el.dataset.fcOpen;}
|
|
no.addEventListener('click',close);
|
|
yes.addEventListener('click',function(){close();onYes();});
|
|
}
|
|
document.addEventListener('click',function(e){
|
|
var btn=e.target.closest?e.target.closest('[data-confirm]'):null;
|
|
if(!btn)return;
|
|
e.preventDefault();
|
|
felhomConfirm(btn,btn.getAttribute('data-confirm'),function(){
|
|
var form=btn.closest('form');
|
|
if(form){if(form.requestSubmit)form.requestSubmit(btn);else form.submit();}
|
|
});
|
|
});
|
|
</script>
|
|
{{end}}
|