Removed debugging output from console.
This commit is contained in:
parent
2f95b6c80a
commit
45c4b8ad6e
1 changed files with 0 additions and 12 deletions
|
|
@ -11,19 +11,13 @@ const translations = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function parseRef(ref) {
|
function parseRef(ref) {
|
||||||
console.log(ref);
|
|
||||||
ref = ref.replace(/%3[Aa]/, ':').replace(/\+/, ' ');
|
ref = ref.replace(/%3[Aa]/, ':').replace(/\+/, ' ');
|
||||||
console.log(ref);
|
|
||||||
const m = ref.match(/((\d+(\+|\s))?[a-zA-Z]+)(\+|\s)?([0-9]+)?\:?([0-9]+(-?[0-9]+)?)?/);
|
const m = ref.match(/((\d+(\+|\s))?[a-zA-Z]+)(\+|\s)?([0-9]+)?\:?([0-9]+(-?[0-9]+)?)?/);
|
||||||
|
|
||||||
console.log(m);
|
|
||||||
|
|
||||||
const book = m[1].toLowerCase();
|
const book = m[1].toLowerCase();
|
||||||
const chapter = m[5];
|
const chapter = m[5];
|
||||||
const verses = m[6]?.replaceAll(/–/g, '-');
|
const verses = m[6]?.replaceAll(/–/g, '-');
|
||||||
|
|
||||||
console.log(`parseRef: ${book}, ${chapter}, ${verses}`);
|
|
||||||
|
|
||||||
if (book === undefined) {
|
if (book === undefined) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +59,6 @@ function parseRef(ref) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(refdata, book);
|
|
||||||
|
|
||||||
if ('verses' in refdata) {
|
if ('verses' in refdata) {
|
||||||
if (refdata.verses.start < 1) {
|
if (refdata.verses.start < 1) {
|
||||||
|
|
@ -90,8 +83,6 @@ function render(dialog, response, refs) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('render refs:', refs);
|
|
||||||
|
|
||||||
const section = document.createElement('section');
|
const section = document.createElement('section');
|
||||||
const article = dialog?.querySelector('article');
|
const article = dialog?.querySelector('article');
|
||||||
let para = document.createElement('p');
|
let para = document.createElement('p');
|
||||||
|
|
@ -168,15 +159,12 @@ function render(dialog, response, refs) {
|
||||||
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]');
|
||||||
console.log(dialog);
|
|
||||||
elems.forEach((e) => {
|
elems.forEach((e) => {
|
||||||
e.addEventListener('click', (evt) => {
|
e.addEventListener('click', (evt) => {
|
||||||
const scripture = e.attributes.getNamedItem('data-scripture');
|
const scripture = e.attributes.getNamedItem('data-scripture');
|
||||||
const refs = parseRef(scripture.value);
|
const refs = parseRef(scripture.value);
|
||||||
const tx = refs.meta?.tx || 'BSB';
|
const tx = refs.meta?.tx || 'BSB';
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
console.log('scripture:', scripture);
|
|
||||||
console.log('refs:', refs);
|
|
||||||
const uri = `https://bible.helloao.org/api/${tx}/${refs.book.toUpperCase()}/${refs.chapter}.json`;
|
const uri = `https://bible.helloao.org/api/${tx}/${refs.book.toUpperCase()}/${refs.chapter}.json`;
|
||||||
dialog[0]?.showModal();
|
dialog[0]?.showModal();
|
||||||
dialog[0]?.setAttribute('data-scripture', scripture);
|
dialog[0]?.setAttribute('data-scripture', scripture);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue