exists. document.addEventListener('htmx:afterRequest', function(evt) { if (!evt.detail || !evt.detail.successful) return; var refresh = document.getElementById('maincontent-refresh'); if (!refresh) return; refresh.classList.remove('gio-fade-in'); // force reflow so removing then adding re-starts the animation each time void refresh.offsetWidth; refresh.classList.add('gio-fade-in'); }); // Top-of-viewport progress bar shown while an HTMX request is in flight. // Provides immediate visual feedback for taps even before content arrives. document.addEventListener('htmx:beforeRequest', function() { var bar = document.getElementById('gio-progress-bar'); if (bar) bar.classList.add('active'); }); document.addEventListener('htmx:afterRequest', function() { var bar = document.getElementById('gio-progress-bar'); if (bar) bar.classList.remove('active'); }); // Haptic feedback on mobile-native chrome taps: bottom-nav tabs, back // chevron, and the navbar overflow action slot. Uses the shared helpers // from qtutils/appfunctions.qtpl — they no-op on non-Capacitor runtimes, // so this is safe on the plain web too. document.addEventListener('click', function(ev) { if (typeof hapticsSelectionChanged !== 'function') return; var target = ev.target; if (!target || !target.closest) return; if (target.closest('.mobilesidebar-item') || target.closest('#logo a') || target.closest('#header-action-slot a')) { hapticsSelectionChanged(); } }, true);