Changeset 389aa99 in Klonkt
- Timestamp:
- 06/20/2026 03:20:00 AM (3 months ago)
- Branches:
- main
- Children:
- 73b41eb
- Parents:
- 2fc9b7f
- File:
-
- 1 edited
-
src/views/shell.ejs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/views/shell.ejs
r2fc9b7f r389aa99 478 478 479 479 var lastPath = location.pathname + location.search; 480 var navTimer = null; 481 482 // Eén plek voor alle programmatische navigatie-swaps. Annuleert eerst een nog 483 // lopende request op #pcms-main (anti-race: bij snel klikken/terug-gaan kan een 484 // trage oude response anders een nieuwe pagina overschrijven → "kale content"). 485 function doNav(dest) { 486 try { window.htmx.trigger('#pcms-main', 'htmx:abort'); } catch (_) {} 487 window.htmx.ajax('GET', dest, { target: '#pcms-main', swap: 'innerHTML' }); 488 } 480 489 481 490 document.addEventListener('click', function (e) { … … 492 501 if (dest !== lastPath) history.pushState({ b: 1 }, '', dest); 493 502 lastPath = dest; 494 window.htmx.ajax('GET', dest, { target: '#pcms-main', swap: 'innerHTML' }); 503 if (navTimer) { clearTimeout(navTimer); navTimer = null; } 504 doNav(dest); 495 505 try { window.scrollTo(0, 0); } catch (_) {} 496 506 }); … … 500 510 if (here === lastPath) return; 501 511 lastPath = here; 502 window.htmx.ajax('GET', here, { target: '#pcms-main', swap: 'innerHTML' }); 512 // Debounce: bij heel snel/herhaald terug-vooruit niet elke tussenpagina ophalen, 513 // alleen de LAATSTE bestemming. Voorkomt overlappende swaps ("kale content"). 514 if (navTimer) clearTimeout(navTimer); 515 navTimer = setTimeout(function () { 516 navTimer = null; 517 doNav(location.pathname + location.search); 518 }, 90); 503 519 }); 504 520
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)