Added base ref parser.

This commit is contained in:
Benjamin A. Shelton 2026-08-01 14:07:41 -06:00
commit ec727d5e0e
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01

View file

@ -3,6 +3,13 @@ export const modal = (el) => {
}; };
function parseRef(ref) {
console.log(ref);
ref = ref.replace(/%3[Aa]/, ':');
const m = ref.match(/((\d+\+)?[a-zA-Z]+)\+?([0-9]+)?\:([0-9]+(-?[0-9]+)?)?/);
console.log(m);
}
export const bindModals = () => { export const bindModals = () => {
const elems = document.querySelectorAll('a[data-scripture]'); const elems = document.querySelectorAll('a[data-scripture]');
const dialog = document.querySelectorAll('dialog[data-scripture]'); const dialog = document.querySelectorAll('dialog[data-scripture]');
@ -11,14 +18,13 @@ export const bindModals = () => {
const scripture = e.attributes.getNamedItem('data-scripture'); const scripture = e.attributes.getNamedItem('data-scripture');
evt.preventDefault(); evt.preventDefault();
console.log(scripture); console.log(scripture);
console.log(parseRef(scripture.value));
dialog[0]?.showModal(); dialog[0]?.showModal();
dialog[0]?.setAttribute('data-scripture', scripture); dialog[0]?.setAttribute('data-scripture', scripture);
dialog[0]?.classList.remove("hidden"); dialog[0]?.classList.remove("hidden");
//document.body.classList.add("overflow-hidden"); //document.body.classList.add("overflow-hidden");
}); });
}); });
console.log(buildBookMap());
dialog[0]?.addEventListener('click', (evt) => { dialog[0]?.addEventListener('click', (evt) => {
evt.target === dialog[0] && dialog[0]?.close(); evt.target === dialog[0] && dialog[0]?.close();
}); });
@ -241,4 +247,5 @@ function buildBookMap() {
} }
console.log(mp.length); console.log(mp.length);
return mp; return mp;
} }
const _map = buildBookMap();