Move dialog open to its own function.
This commit is contained in:
parent
907ad0dd5d
commit
13e66e4f93
1 changed files with 21 additions and 16 deletions
|
|
@ -79,6 +79,8 @@ class RenderScripture {
|
||||||
|
|
||||||
constructor(dialog) {
|
constructor(dialog) {
|
||||||
this.dialog = dialog;
|
this.dialog = dialog;
|
||||||
|
const url = new URL(document.URL);
|
||||||
|
console.log(parseRef(url.searchParams.get('cite')));
|
||||||
|
|
||||||
//history.replaceState({dialog: false}, '');
|
//history.replaceState({dialog: false}, '');
|
||||||
window.addEventListener('popstate', (evt) => {
|
window.addEventListener('popstate', (evt) => {
|
||||||
|
|
@ -129,23 +131,9 @@ class RenderScripture {
|
||||||
}
|
}
|
||||||
|
|
||||||
anchorClick(evt) {
|
anchorClick(evt) {
|
||||||
const scripture = evt.target.attributes.getNamedItem('data-scripture');
|
const scripture = evt.target.attributes.getNamedItem('data-scripture')?.value;
|
||||||
const refs = parseRef(scripture.value);
|
|
||||||
const tx = refs.meta?.tx || 'BSB';
|
|
||||||
this.ref = refs;
|
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
this.dialog[0]?.showModal();
|
this.openDialog(scripture, evt.target.name);
|
||||||
this.dialog[0]?.setAttribute('data-scripture', scripture.value);
|
|
||||||
this.dialog[0]?.classList.remove("hidden");
|
|
||||||
this.dialog[0]?.querySelector('.spinner svg')
|
|
||||||
.classList.remove('hidden');
|
|
||||||
this.buildTranslationList(this.sel);
|
|
||||||
this.readScripture(refs);
|
|
||||||
history.pushState({
|
|
||||||
dialog: true,
|
|
||||||
scripture: scripture.value,
|
|
||||||
tx: this.translation
|
|
||||||
}, '', '#dialog');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTranslationList(sel) {
|
buildTranslationList(sel) {
|
||||||
|
|
@ -173,6 +161,23 @@ class RenderScripture {
|
||||||
//history.back();
|
//history.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openDialog(scripture, hash) {
|
||||||
|
const refs = parseRef(scripture);
|
||||||
|
this.ref = refs;
|
||||||
|
this.dialog[0]?.showModal();
|
||||||
|
this.dialog[0]?.setAttribute('data-scripture', scripture);
|
||||||
|
this.dialog[0]?.classList.remove("hidden");
|
||||||
|
this.dialog[0]?.querySelector('.spinner svg')
|
||||||
|
.classList.remove('hidden');
|
||||||
|
this.buildTranslationList(this.sel);
|
||||||
|
this.readScripture(refs);
|
||||||
|
history.pushState({
|
||||||
|
dialog: true,
|
||||||
|
scripture: scripture.value,
|
||||||
|
tx: this.translation
|
||||||
|
}, '', `?cite=${scripture}#${hash}`);
|
||||||
|
}
|
||||||
|
|
||||||
txnOnChange(evt) {
|
txnOnChange(evt) {
|
||||||
const tx = evt.target.selectedOptions[0].value;
|
const tx = evt.target.selectedOptions[0].value;
|
||||||
this.translation = tx;
|
this.translation = tx;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue