Skip to content

Commit

Permalink
Testing: Only test URL-specified translators after page is ready.
Browse files Browse the repository at this point in the history
Fixes zotero#20.
  • Loading branch information
zoe-translates committed Mar 26, 2023
1 parent fcb7b8a commit c4ca691
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions testTranslators/testTranslators.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ async function init() {
allOutputView = new OutputView();
allOutputView.setDisplayed(true);

const translatorReadiness = [];
await Promise.all(TRANSLATOR_TYPES.map(async displayType => {
let translatorType = displayType.toLowerCase();

Expand Down Expand Up @@ -474,7 +475,7 @@ async function init() {
// get translators, with code for unsupported translators
if(!viewerMode) {
let translators = await Zotero.Translators.getAllForType(translatorType, true);
haveTranslators(translators, translatorType);
translatorReadiness.push(haveTranslators(translators, translatorType));
}
}));

Expand Down Expand Up @@ -531,6 +532,7 @@ async function init() {
translatorBox.appendChild(lastP);

// Run translators specified in the hash params if any
await Promise.all(translatorReadiness);
runURLSpecifiedTranslators();
}
}
Expand Down Expand Up @@ -650,4 +652,4 @@ function serializeToDownload(e) {
e.preventDefault();
}

window.addEventListener("load", load, false);
window.addEventListener("load", load, false);

0 comments on commit c4ca691

Please sign in to comment.