Scaffold: Non-async detectWeb and async scrape by default

We don't usually want an async detectWeb, since HTTP requests should only be
used there in very exceptional cases. We do usually want an async scrape (and we
were already - mistakenly - awaiting it).
This commit is contained in:
Abe Jellinek 2022-08-17 16:33:32 -04:00
parent 5a8b5a1829
commit 96c4427d6c

View file

@ -22,7 +22,7 @@
*/
async function detectWeb(doc, url) {
function detectWeb(doc, url) {
// TODO: adjust the logic here
if ($$CURSOR$$url.includes('/article/')) {
return 'newspaperArticle';
@ -52,7 +52,7 @@ function getSearchResults(doc, checkOnly) {
}
async function doWeb(doc, url) {
if (await detectWeb(doc, url) == 'multiple') {
if (detectWeb(doc, url) == 'multiple') {
let items = await Zotero.selectItems(getSearchResults(doc, false));
if (items) {
await Promise.all(
@ -66,7 +66,7 @@ async function doWeb(doc, url) {
}
}
function scrape(doc, url = doc.location.href) {
async function scrape(doc, url = doc.location.href) {
// TODO: implement or add a scrape function template
}