This commit is contained in:
mark committed 2026-09-09 12:25:24 -04:00
1 parent 057b4be7d7
commit b1f54e2030
3 files changed
+1 -49

No files matched your search

-46
View File
@@ -1,46 +0,0 @@
(function () {
'use strict';
document.body.addEventListener('htmx:afterSwap', function (event) {
var target = event.detail.target;
if (!target) return;
if (target.id === 'reference-verse') return scrollToHash();
if (target.id === 'content') return land();
});
document.body.addEventListener('htmx:historyRestore', function () {
land();
});
function hashTarget() {
if (!location.hash) return null;
return document.getElementById(decodeURIComponent(location.hash.slice(1)));
}
function jumpTo(el) {
el.scrollIntoView({ block: 'start', behavior: 'instant' });
}
function jumpToTop() {
window.scrollTo({ top: 0, behavior: 'instant' });
}
function scrollToHash() {
var el = hashTarget();
if (el) jumpTo(el);
}
function land() {
var el = hashTarget();
if (el) jumpTo(el);
else jumpToTop();
}
document.addEventListener('DOMContentLoaded', function () {
scrollToHash();
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('sw.js').catch(function () {});
}
});
})();
+1 -2
View File
@@ -23,7 +23,6 @@ const PRECACHE = [
'./manifest.webmanifest',
'./css/app.css',
'./css/bootstrap.min.css',
'./js/app.js',
'./js/htmx.min.js',
'./js/bootstrap.bundle.min.js'
].concat(TEMPLATE_URLS);
@@ -265,7 +264,7 @@ router.get('/api/reference', async (call) => {
headers: {
'Content-Type': 'text/html; charset=utf-8',
'Cache-Control': 'no-store',
'HX-Reswap': 'innerHTML settle:0',
'HX-Reswap': 'innerHTML settle:0 show:#' + target + ':top',
'HX-Replace-Url': page.pathname + page.search + '#' + target
}
});
-1
View File
@@ -10,7 +10,6 @@
content='{"historyCacheSize":0,"refreshOnHistoryMiss":false}'>
<script src="js/bootstrap.bundle.min.js" defer></script>
<script src="js/htmx.min.js"></script>
<script src="js/app.js" defer></script>
<link rel="manifest" href="manifest.webmanifest">
<meta name="theme-color" content="#1a202c">
<link rel="apple-touch-icon" href="icons/apple-touch-icon.png">