Changeset 79bba6e in Klonkt for src/views/shell.ejs


Ignore:
Timestamp:
06/17/2026 12:29:16 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
cbd1761
Parents:
44cf44d
Message:

Audio never jumps + hub topnav + Prutter chat mobile-first

  • Global link boost in shell.ejs: all internal navigation links go through htmx into #pcms-main (session/auth/downloads/assets excluded), so the audio player keeps playing everywhere — including clicks within Admin. Back/forward re-fetches (historyCacheSize=0) so the OOB header comes along.
  • Hub-home: the mini topnav bar now shows on the hub landing (no large profile header — the hero is the header); duplicate .hub-nav removed.
  • Prutter conversation: full-height mobile-first chat (bodyClass on-chat → no artist profile header). Page pinned fixed between topnav and the bottom bars; only the thread scrolls. Compact header + clean composer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/shell.ejs

    r44cf44d r79bba6e  
    419419</script>
    420420
     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
    421476<!-- PWA install prompt — show button when browser fires beforeinstallprompt -->
    422477<script>
Note: See TracChangeset for help on using the changeset viewer.