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 () {});
}
});
})();