Changeset 79bba6e in Klonkt for src/views/shell.ejs
- Timestamp:
- 06/17/2026 12:29:16 AM (3 months ago)
- Branches:
- main
- Children:
- cbd1761
- Parents:
- 44cf44d
- File:
-
- 1 edited
-
src/views/shell.ejs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/views/shell.ejs
r44cf44d r79bba6e 419 419 </script> 420 420 421 <!-- Globale link-boost: alle interne navigatie-links lopen via htmx in #pcms-main, 422 zodat de audioplayer (los in document.body) blijft spelen i.p.v. te verspringen 423 bij een full page-load. Werkt overal — Beheer, Account, posts, sites — zonder 424 elke link los htmx te maken. Links die écht een volledige load nodig hebben 425 (uitloggen/auth, downloads, feeds, media, assets, bestanden) worden overgeslagen, 426 net als links die al hun eigen hx-* hebben. --> 427 <script> 428 (function () { 429 if (!window.htmx) return; 430 // Back/forward moet her-ophalen, zodat de OOB-site-chrome (kop) meekomt met de 431 // herstelde pagina — htmx' snapshot-cache zou anders een stale kop tonen. 432 try { window.htmx.config.historyCacheSize = 0; } catch (_) {} 433 434 function fullLoad(a, url) { 435 if (a.hasAttribute('download') || a.hasAttribute('data-full-load')) return true; 436 if (a.hasAttribute('hx-get') || a.hasAttribute('hx-post') || a.hasAttribute('hx-boost')) return true; 437 if (a.target && a.target !== '_self') return true; 438 if (a.getAttribute('rel') === 'external') return true; 439 var p = url.pathname; 440 // Sessie/security/oauth → volledige navigatie (cookies, redirects). 441 if (/^\/(logout|login|auth|oauth)(?:\/|$)/.test(p)) return true; 442 // Feeds, PWA, service-worker, statics, media-streams, downloads. 443 if (/^\/(feed|atom|sitemap|manifest|robots|sw\.js|assets|media|audio|uploads)(?:\/|\.|$)/.test(p)) return true; 444 if (/\.[a-z0-9]{2,5}$/i.test(p)) return true; // bestandsextensie → laat de browser 't halen 445 return false; 446 } 447 448 var lastPath = location.pathname + location.search; 449 450 document.addEventListener('click', function (e) { 451 if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return; 452 var a = e.target.closest('a[href]'); 453 if (!a) return; 454 var href = a.getAttribute('href'); 455 if (!href || href.charAt(0) === '#') return; 456 var url; try { url = new URL(a.href, location.href); } catch (_) { return; } 457 if (url.origin !== location.origin) return; 458 if (fullLoad(a, url)) return; 459 e.preventDefault(); 460 var dest = url.pathname + url.search; 461 if (dest !== lastPath) history.pushState({ b: 1 }, '', dest); 462 lastPath = dest; 463 window.htmx.ajax('GET', dest, { target: '#pcms-main', swap: 'innerHTML' }); 464 try { window.scrollTo(0, 0); } catch (_) {} 465 }); 466 467 window.addEventListener('popstate', function () { 468 var here = location.pathname + location.search; 469 if (here === lastPath) return; 470 lastPath = here; 471 window.htmx.ajax('GET', here, { target: '#pcms-main', swap: 'innerHTML' }); 472 }); 473 })(); 474 </script> 475 421 476 <!-- PWA install prompt — show button when browser fires beforeinstallprompt --> 422 477 <script>
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)