From ec727d5e0eee902cbc5f0c3d6ea09a0c4dd4c265 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Shelton" Date: Sat, 1 Aug 2026 14:07:41 -0600 Subject: [PATCH] Added base ref parser. --- src/utils/modal.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/utils/modal.js b/src/utils/modal.js index 85b7884..432f196 100644 --- a/src/utils/modal.js +++ b/src/utils/modal.js @@ -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 = () => { const elems = document.querySelectorAll('a[data-scripture]'); const dialog = document.querySelectorAll('dialog[data-scripture]'); @@ -11,14 +18,13 @@ export const bindModals = () => { const scripture = e.attributes.getNamedItem('data-scripture'); evt.preventDefault(); console.log(scripture); + console.log(parseRef(scripture.value)); dialog[0]?.showModal(); dialog[0]?.setAttribute('data-scripture', scripture); dialog[0]?.classList.remove("hidden"); //document.body.classList.add("overflow-hidden"); }); }); - console.log(buildBookMap()); - dialog[0]?.addEventListener('click', (evt) => { evt.target === dialog[0] && dialog[0]?.close(); }); @@ -241,4 +247,5 @@ function buildBookMap() { } console.log(mp.length); return mp; -} \ No newline at end of file +} +const _map = buildBookMap(); \ No newline at end of file