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) {
|
||||
this.dialog = dialog;
|
||||
const url = new URL(document.URL);
|
||||
console.log(parseRef(url.searchParams.get('cite')));
|
||||
|
||||
//history.replaceState({dialog: false}, '');
|
||||
window.addEventListener('popstate', (evt) => {
|
||||
|
|
@ -129,23 +131,9 @@ class RenderScripture {
|
|||
}
|
||||
|
||||
anchorClick(evt) {
|
||||
const scripture = evt.target.attributes.getNamedItem('data-scripture');
|
||||
const refs = parseRef(scripture.value);
|
||||
const tx = refs.meta?.tx || 'BSB';
|
||||
this.ref = refs;
|
||||
const scripture = evt.target.attributes.getNamedItem('data-scripture')?.value;
|
||||
evt.preventDefault();
|
||||
this.dialog[0]?.showModal();
|
||||
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');
|
||||
this.openDialog(scripture, evt.target.name);
|
||||
}
|
||||
|
||||
buildTranslationList(sel) {
|
||||
|
|
@ -173,6 +161,23 @@ class RenderScripture {
|
|||
//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) {
|
||||
const tx = evt.target.selectedOptions[0].value;
|
||||
this.translation = tx;
|
||||
|
|
|
|||
Loading…
Reference in a new issue