Servis detalji: glatko osvežavanje bez treperenja i skoka
Sve forme na detaljima (dodavanje/brisanje rada i dela, promena statusa) sada osvežavaju ceo #glavni-sadrzaj preko data-refresh umesto punog reloda: status badge se ažurira odmah, nema skoka na vrh ni treptaja pozadine. AJAX grana dodaje bez-anim reflow (CSS #glavni-sadrzaj.bez-anim) i re-izvršava inline skripte da se combobox pretrage ponovo povežu nakon zamene.
This commit is contained in:
@@ -393,8 +393,20 @@
|
||||
var doc = new DOMParser().parseFromString(html, 'text/html');
|
||||
var novi = doc.querySelector(ciljSel);
|
||||
var stari = document.querySelector(ciljSel);
|
||||
if (novi && stari) stari.replaceWith(novi);
|
||||
f.reset();
|
||||
if (novi && stari) {
|
||||
// bez-anim spречava treptaj re-animacije kartica pri zameni
|
||||
novi.classList.add('bez-anim');
|
||||
stari.replaceWith(novi);
|
||||
void novi.offsetHeight;
|
||||
novi.classList.remove('bez-anim');
|
||||
// replaceWith ne pokreće <script> iz fragmenta — re-izvrši ih
|
||||
// ručno (npr. da se combobox/pretrage ponovo povežu)
|
||||
novi.querySelectorAll('script').forEach(function (old) {
|
||||
var s = document.createElement('script');
|
||||
if (old.src) s.src = old.src; else s.textContent = old.textContent;
|
||||
old.parentNode.replaceChild(s, old);
|
||||
});
|
||||
}
|
||||
if (btn) btn.disabled = false;
|
||||
})
|
||||
.catch(function () { location.href = res.url; });
|
||||
|
||||
Reference in New Issue
Block a user