diff --git a/chrome/content/scaffold/templates/newWeb.js b/chrome/content/scaffold/templates/newWeb.js index 6007816f61..330d79e492 100644 --- a/chrome/content/scaffold/templates/newWeb.js +++ b/chrome/content/scaffold/templates/newWeb.js @@ -57,7 +57,7 @@ async function doWeb(doc, url) { if (items) { await Promise.all( Object.keys(items) - .map(url => requestDocument(url).then(doc => scrape(doc, url))) + .map(url => requestDocument(url).then(scrape)) ); } } @@ -65,3 +65,8 @@ async function doWeb(doc, url) { await scrape(doc, url); } } + +function scrape(doc, url = doc.location.href) { + // TODO: implement or add a scrape function template +} + diff --git a/chrome/content/scaffold/templates/scrapeBibTeX.js b/chrome/content/scaffold/templates/scrapeBibTeX.js index 3d99ddfa72..42f8d7eecf 100644 --- a/chrome/content/scaffold/templates/scrapeBibTeX.js +++ b/chrome/content/scaffold/templates/scrapeBibTeX.js @@ -1,4 +1,4 @@ -async function scrape(doc, url) { +async function scrape(doc, url = doc.location.href) { // TODO adjust the url building let m = url.match(/FId=([\w\d]+)&/); if (m) { diff --git a/chrome/content/scaffold/templates/scrapeEM.js b/chrome/content/scaffold/templates/scrapeEM.js index 44dedb1082..b2b827ee6c 100644 --- a/chrome/content/scaffold/templates/scrapeEM.js +++ b/chrome/content/scaffold/templates/scrapeEM.js @@ -1,4 +1,4 @@ -async function scrape(doc, url) { +async function scrape(doc, url = doc.location.href) { let translator = Zotero.loadTranslator('web'); // Embedded Metadata translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); diff --git a/chrome/content/scaffold/templates/scrapeMARC.js b/chrome/content/scaffold/templates/scrapeMARC.js index edcc6407dd..fa6dda282c 100644 --- a/chrome/content/scaffold/templates/scrapeMARC.js +++ b/chrome/content/scaffold/templates/scrapeMARC.js @@ -1,4 +1,4 @@ -async function scrape(doc, url) { +async function scrape(doc, url = doc.location.href) { // TODO adjust the selector for the lines here let lines = doc.querySelectorAll('table#marcData tr'); diff --git a/chrome/content/scaffold/templates/scrapeRIS.js b/chrome/content/scaffold/templates/scrapeRIS.js index cb480af1bc..d0ed037aa7 100644 --- a/chrome/content/scaffold/templates/scrapeRIS.js +++ b/chrome/content/scaffold/templates/scrapeRIS.js @@ -1,4 +1,4 @@ -async function scrape(doc, url) { +async function scrape(doc, url = doc.location.href) { let DOI = url.match(/\/(10\.[^#?]+)/)[1]; // TODO adjust the URL here let risURL = `http://citation-needed.services.springer.com/v2/references/${DOI}?format=refman&flavour=citation`;