From 96c4427d6c0f63dc59efd83dfe33e2d0060c5b15 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Wed, 17 Aug 2022 16:33:32 -0400 Subject: [PATCH] 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). --- chrome/content/scaffold/templates/newWeb.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/scaffold/templates/newWeb.js b/chrome/content/scaffold/templates/newWeb.js index 330d79e492..e7dd48bad2 100644 --- a/chrome/content/scaffold/templates/newWeb.js +++ b/chrome/content/scaffold/templates/newWeb.js @@ -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 }