From 983694bc903bfbdf9133a3792bed9dd1ddd0a698 Mon Sep 17 00:00:00 2001 From: Brendan OConnell Date: Tue, 21 Mar 2023 16:41:15 +0100 Subject: [PATCH 01/14] First commit - added detectWeb and EM import translator --- American Meteorological Society.js | 108 +++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 American Meteorological Society.js diff --git a/American Meteorological Society.js b/American Meteorological Society.js new file mode 100644 index 00000000000..5e9571d8ed0 --- /dev/null +++ b/American Meteorological Society.js @@ -0,0 +1,108 @@ +{ + "translatorID": "fae4a788-7f30-41b1-a1c2-71017d86bfda", + "label": "American Meteorological Society", + "creator": "Brendan O'Connell", + "target": "https://journals.ametsoc.org/view/journals", + "minVersion": "5.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-03-21 15:40:48" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2022 YOUR_NAME <- TODO + + This file is part of Zotero. + + Zotero is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Zotero is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with Zotero. If not, see . + + ***** END LICENSE BLOCK ***** +*/ + + +function detectWeb(doc, url) { + // TODO: adjust the logic here + if (url.includes('/article/')) { + return 'newspaperArticle'; + } + else if (getSearchResults(doc, true)) { + return 'multiple'; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + // TODO: adjust the CSS selector + var rows = doc.querySelectorAll('h2 > a.title[href*="/article/"]'); + for (let row of rows) { + // TODO: check and maybe adjust + let href = row.href; + // TODO: check and maybe adjust + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +async function doWeb(doc, url) { + if (detectWeb(doc, url) == 'multiple') { + let items = await Zotero.selectItems(getSearchResults(doc, false)); + if (!items) return; + for (let url of Object.keys(items)) { + await scrape(await requestDocument(url)); + } + } + else { + await scrape(doc, url); + } +} + +async function scrape(doc, url = doc.location.href) { + // TODO: implement or add a scrape function template + let translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', (_obj, item) => { + // TODO adjust if needed: + item.section = 'News'; + item.complete(); + }); + + let em = await translator.getTranslatorObject(); + em.itemType = 'newspaperArticle'; + // TODO map additional meta tags here, or delete completely + em.addCustomFields({ + 'twitter:description': 'abstractNote' + }); + await em.doWeb(doc, url); +} + +} + +/** BEGIN TEST CASES **/ +var testCases = [ +] +/** END TEST CASES **/ From 3796153a66647710bd6a5f68b727339343b3f0ef Mon Sep 17 00:00:00 2001 From: Brendan OConnell Date: Thu, 23 Mar 2023 14:22:46 +0100 Subject: [PATCH 02/14] Added comments --- American Meteorological Society.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/American Meteorological Society.js b/American Meteorological Society.js index 5e9571d8ed0..a455f0ae2fd 100644 --- a/American Meteorological Society.js +++ b/American Meteorological Society.js @@ -82,9 +82,9 @@ async function scrape(doc, url = doc.location.href) { // TODO: implement or add a scrape function template let translator = Zotero.loadTranslator('web'); // Embedded Metadata - translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); // Embedded Metadata translator.setDocument(doc); - + translator.setHandler('itemDone', (_obj, item) => { // TODO adjust if needed: item.section = 'News'; @@ -100,8 +100,6 @@ async function scrape(doc, url = doc.location.href) { await em.doWeb(doc, url); } -} - /** BEGIN TEST CASES **/ var testCases = [ ] From 856d3e3b0288e2062d4b61f1fd801f58bc3bf961 Mon Sep 17 00:00:00 2001 From: Brendan OConnell Date: Mon, 27 Mar 2023 11:25:26 +0200 Subject: [PATCH 03/14] added selector for multiple --- PubFactory Journals.js | 139 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 PubFactory Journals.js diff --git a/PubFactory Journals.js b/PubFactory Journals.js new file mode 100644 index 00000000000..3efe08c69ff --- /dev/null +++ b/PubFactory Journals.js @@ -0,0 +1,139 @@ +{ + "translatorID": "8d1fb775-df6d-4069-8830-1dfe8e8387dd", + "label": "PubFactory Journals", + "creator": "Brendan O'Connell", + "target": "^https?:\\/\\/(?:[\\w-]+\\.)+[\\w-]+(?:\\/[^\\/\\s]*)+\\.xml(?:\\?.*)?$|^https:\\/\\/(?:[\\w-]+\\.)+[\\w-]+\\/search\\?[^\\/\\s]*source=%2Fjournals%2F\\w+%2F\\w+-overview\\.xml(?:&q=[^&\\s]*)?$", + "minVersion": "5.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-03-24 14:40:09" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2023 Brendan O'Connell + + This file is part of Zotero. + + Zotero is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Zotero is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with Zotero. If not, see . + + ***** END LICENSE BLOCK ***** +*/ + + +function detectWeb(doc, url) { + // Translator only covers multiple, because EM works perfectly on single articles. + if (getSearchResults(doc, true)) { + return 'multiple'; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + // TODO: adjust the CSS selector + var rows = doc.querySelectorAll('h1 > a.c-Button--link'); + for (let row of rows) { + // TODO: check and maybe adjust + let href = row.href; + // TODO: check and maybe adjust + let title = ZU.trimInternal(row.innerText); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} +async function doWeb(doc, url) { + if (detectWeb(doc, url) == 'multiple') { + let items = await Zotero.selectItems(getSearchResults(doc, false)); + if (!items) return; + for (let url of Object.keys(items)) { + await scrape(await requestDocument(url)); + } + } + else { + await 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'); + translator.setDocument(doc); + + translator.setHandler('itemDone', (_obj, item) => { + item.complete(); + }); + // var pdfURL = getContent(doc, 'citation_pdf_url'); + + let em = await translator.getTranslatorObject(); + em.itemType = 'journalArticle'; + await em.doWeb(doc, url); +} + + + + + + +// other examples of journals regexes: +// Atypon Journals.js + + +// issue pages with multiple: +// https://journals.humankinetics.com/view/journals/cssm/cssm-overview.xml +// https://journals.humankinetics.com/view/journals/ijsnem/ijsnem-overview.xml +// https://journals.humankinetics.com/view/journals/jab/jab-overview.xml +// https://journals.ametsoc.org/view/journals/amsm/59/1/amsm.59.issue-1.xml +// https://pubs.nctm.org/view/journals/mte/11/2/mte.11.issue-2.xml +// https://avmajournals.avma.org/view/journals/javma/261/4/javma.261.issue-4.xml +// https://avmajournals.avma.org/view/journals/javma/javma-overview.xml?_gl=1*1mk7zsf*_ga*MTI2MDA0NjE4NS4xNjc5NTc4NzIy*_ga_L7SBEK6H36*MTY3OTU3ODcyMS4xLjEuMTY3OTU3ODg0NS4wLjAuMA.. +// https://www.ajtmh.org/view/journals/tpmd/108/3/tpmd.108.issue-3.xml +// https://journals.ashs.org/hortsci/view/journals/hortsci/hortsci-overview.xml + +// searches: +// https://pubs.nctm.org/search?source=%2Fjournals%2Fmte%2Fmte-overview.xml +// https://journals.ashs.org/search?q1=sugar&searchBtn= +// https://avmajournals.avma.org/search?q=cats&source=%2Fjournals%2Fjavma%2Fjavma-overview.xml + +// facet search: +// https://www.ajtmh.org/browse?access=all&pageSize=10&sort=datedescending&fromDate=2006&toDate=2013 + +// browse all: +// https://www.ajtmh.org/browse + + +// pages and their targets +// https://journals.ametsoc.org/view/journals/eint/27/1/eint.27.issue-1.xml +// a class="c-Button--link" +// https://journals.humankinetics.com/view/journals/cssm/cssm-overview.xml +// same, but with a span inside + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://journals.ametsoc.org/view/journals/amsm/59/1/amsm.59.issue-1.xml", + "items": "multiple" + } +] +/** END TEST CASES **/ From f2dfbcf433cf31e521c2837e899c1df53d5399c3 Mon Sep 17 00:00:00 2001 From: Brendan OConnell Date: Mon, 27 Mar 2023 16:06:18 +0200 Subject: [PATCH 04/14] Added todo for add attached PDFs --- PubFactory Journals.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PubFactory Journals.js b/PubFactory Journals.js index 3efe08c69ff..1f0a57c123d 100644 --- a/PubFactory Journals.js +++ b/PubFactory Journals.js @@ -9,7 +9,7 @@ "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2023-03-24 14:40:09" + "lastUpdated": "2023-03-27 13:59:57" } /* @@ -83,6 +83,7 @@ async function scrape(doc, url = doc.location.href) { translator.setHandler('itemDone', (_obj, item) => { item.complete(); }); + // TODO: add attached PDFs // var pdfURL = getContent(doc, 'citation_pdf_url'); let em = await translator.getTranslatorObject(); From 0dfaa935cbf72e85a05c363290704d13981c10e0 Mon Sep 17 00:00:00 2001 From: Brendan OConnell Date: Wed, 29 Mar 2023 16:01:58 +0200 Subject: [PATCH 05/14] Added PDF saving, test cases, removed Abstract from abstract field --- PubFactory Journals.js | 416 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 367 insertions(+), 49 deletions(-) diff --git a/PubFactory Journals.js b/PubFactory Journals.js index 1f0a57c123d..7b2a741226c 100644 --- a/PubFactory Journals.js +++ b/PubFactory Journals.js @@ -9,7 +9,7 @@ "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2023-03-27 13:59:57" + "lastUpdated": "2023-03-29 13:58:05" } /* @@ -35,10 +35,18 @@ ***** END LICENSE BLOCK ***** */ - -function detectWeb(doc, url) { - // Translator only covers multiple, because EM works perfectly on single articles. - if (getSearchResults(doc, true)) { +function detectWeb(doc) { + // EM works well on single articles, so detectWeb() isn't strictly necessary for them. + // However, single articles are included in this translator + // so that 'multiple' doesn't get called for articles with "Related Items" + // e.g. https://avmajournals.avma.org/view/journals/javma/261/4/javma.22.11.0518.xml + // because there are multiple items that match the rows selector in getSearchResults and + // haven't found a way to write a querySelectorAll() that only matches the main article on single pages + // with related items. + if (doc.querySelector('meta[name="citation_title"]')) { + return "journalArticle"; + } + else if (getSearchResults(doc, true)) { return 'multiple'; } return false; @@ -47,12 +55,9 @@ function detectWeb(doc, url) { function getSearchResults(doc, checkOnly) { var items = {}; var found = false; - // TODO: adjust the CSS selector - var rows = doc.querySelectorAll('h1 > a.c-Button--link'); + var rows = doc.querySelectorAll('a.c-Button--link[href*="/view/journals/"][href$=".xml"][target="_self"]'); for (let row of rows) { - // TODO: check and maybe adjust let href = row.href; - // TODO: check and maybe adjust let title = ZU.trimInternal(row.innerText); if (!href || !title) continue; if (checkOnly) return true; @@ -61,6 +66,7 @@ function getSearchResults(doc, checkOnly) { } return found ? items : false; } + async function doWeb(doc, url) { if (detectWeb(doc, url) == 'multiple') { let items = await Zotero.selectItems(getSearchResults(doc, false)); @@ -75,66 +81,378 @@ async function doWeb(doc, url) { } async function scrape(doc, url = doc.location.href) { + if (doc.querySelector('meta[name="citation_pdf_url"]')) { + var pdfURL = doc.querySelector('meta[name="citation_pdf_url"]').getAttribute("content"); + } let translator = Zotero.loadTranslator('web'); // Embedded Metadata translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); translator.setDocument(doc); translator.setHandler('itemDone', (_obj, item) => { + // remove word "Abstract" from abstract if present, e.g. https://journals.ametsoc.org/view/journals/atsc/72/8/jas-d-14-0363.1.xml + var abstract = doc.querySelector('meta[property="og:description"]').content; + if (abstract.startsWith("Abstract")) { + var cleanAbstract = abstract.substring(8); // remove the first 8 characters ("Abstract ") + item.abstractNote = cleanAbstract; + } + if (pdfURL) { + item.attachments = []; + item.attachments.push({ + url: pdfURL, + title: 'Full Text PDF', + mimeType: 'application/pdf' + }); + } item.complete(); }); - // TODO: add attached PDFs - // var pdfURL = getContent(doc, 'citation_pdf_url'); let em = await translator.getTranslatorObject(); em.itemType = 'journalArticle'; await em.doWeb(doc, url); } - - - - - -// other examples of journals regexes: -// Atypon Journals.js - - -// issue pages with multiple: -// https://journals.humankinetics.com/view/journals/cssm/cssm-overview.xml -// https://journals.humankinetics.com/view/journals/ijsnem/ijsnem-overview.xml -// https://journals.humankinetics.com/view/journals/jab/jab-overview.xml -// https://journals.ametsoc.org/view/journals/amsm/59/1/amsm.59.issue-1.xml -// https://pubs.nctm.org/view/journals/mte/11/2/mte.11.issue-2.xml -// https://avmajournals.avma.org/view/journals/javma/261/4/javma.261.issue-4.xml -// https://avmajournals.avma.org/view/journals/javma/javma-overview.xml?_gl=1*1mk7zsf*_ga*MTI2MDA0NjE4NS4xNjc5NTc4NzIy*_ga_L7SBEK6H36*MTY3OTU3ODcyMS4xLjEuMTY3OTU3ODg0NS4wLjAuMA.. -// https://www.ajtmh.org/view/journals/tpmd/108/3/tpmd.108.issue-3.xml -// https://journals.ashs.org/hortsci/view/journals/hortsci/hortsci-overview.xml - -// searches: -// https://pubs.nctm.org/search?source=%2Fjournals%2Fmte%2Fmte-overview.xml -// https://journals.ashs.org/search?q1=sugar&searchBtn= -// https://avmajournals.avma.org/search?q=cats&source=%2Fjournals%2Fjavma%2Fjavma-overview.xml - -// facet search: -// https://www.ajtmh.org/browse?access=all&pageSize=10&sort=datedescending&fromDate=2006&toDate=2013 - -// browse all: -// https://www.ajtmh.org/browse - - -// pages and their targets -// https://journals.ametsoc.org/view/journals/eint/27/1/eint.27.issue-1.xml -// a class="c-Button--link" -// https://journals.humankinetics.com/view/journals/cssm/cssm-overview.xml -// same, but with a span inside - /** BEGIN TEST CASES **/ var testCases = [ { "type": "web", "url": "https://journals.ametsoc.org/view/journals/amsm/59/1/amsm.59.issue-1.xml", "items": "multiple" + }, + { + "type": "web", + "url": "https://journals.humankinetics.com/view/journals/cssm/12/1/cssm.2022-0019.xml", + "items": [ + { + "itemType": "journalArticle", + "title": "Learning How to Make Decisions in a Nonprofit Sport Organization: An Application of Strategic Decision-Making Theory", + "creators": [ + { + "firstName": "Erik L.", + "lastName": "Lachance", + "creatorType": "author" + } + ], + "date": "2023/01/01", + "DOI": "10.1123/cssm.2022-0019", + "ISSN": "2167-2458, 2372-5540", + "abstractNote": "This teaching-based case study tasks students with analyzing a strategic decision. This analysis is guided by a script describing a strategic decision undertaken in a fictional nonprofit sport organization (i.e., Canadian Ice Tennis Federation). Students’ analysis is achieved by applying strategic decision-making theory, including its five central constructs: centrality, duration, flow, interaction, and scrutiny. Knowledge is gained by analyzing a strategic decision according to its level of authorization, length, delays, negotiations, and information sources. This teaching-based case study is intended for undergraduate students in general sport management and/or strategy/strategic management courses. The benefit of this teaching-based case study resides in its ability to teach students how to make decisions, a central and ubiquitous task in organizational life, and their future endeavors in the sport industry.", + "issue": "1", + "language": "en", + "libraryCatalog": "journals.humankinetics.com", + "pages": "1-5", + "publicationTitle": "Case Studies in Sport Management", + "shortTitle": "Learning How to Make Decisions in a Nonprofit Sport Organization", + "url": "https://journals.humankinetics.com/view/journals/cssm/12/1/cssm.2022-0019.xml", + "volume": "12", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "decision-making process" + }, + { + "tag": "not-for-profit sport organizations" + }, + { + "tag": "strategic decisions" + }, + { + "tag": "strategic management" + }, + { + "tag": "strategy" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://journals.humankinetics.com/view/journals/jab/jab-overview.xml", + "items": "multiple" + }, + { + "type": "web", + "url": "https://avmajournals.avma.org/view/journals/javma/javma-overview.xml?_gl=1*1mk7zsf*_ga*MTI2MDA0NjE4NS4xNjc5NTc4NzIy*_ga_L7SBEK6H36*MTY3OTU3ODcyMS4xLjEuMTY3OTU3ODg0NS4wLjAuMA..", + "items": "multiple" + }, + { + "type": "web", + "url": "https://journals.humankinetics.com/view/journals/ijsnem/33/2/ijsnem.2022-0142.xml", + "items": [ + { + "itemType": "journalArticle", + "title": "Fasted Sprint Interval Training Results in Some Beneficial Skeletal Muscle Metabolic, but Similar Metabolomic and Performance Adaptations Compared With Carbohydrate-Fed Training in Recreationally Active Male", + "creators": [ + { + "firstName": "Tom P.", + "lastName": "Aird", + "creatorType": "author" + }, + { + "firstName": "Andrew J.", + "lastName": "Farquharson", + "creatorType": "author" + }, + { + "firstName": "Kate M.", + "lastName": "Bermingham", + "creatorType": "author" + }, + { + "firstName": "Aifric", + "lastName": "O’Sullivan", + "creatorType": "author" + }, + { + "firstName": "Janice E.", + "lastName": "Drew", + "creatorType": "author" + }, + { + "firstName": "Brian P.", + "lastName": "Carson", + "creatorType": "author" + } + ], + "date": "2023/03/01", + "DOI": "10.1123/ijsnem.2022-0142", + "ISSN": "1543-2742, 1526-484X", + "abstractNote": "Endurance training in fasted conditions (FAST) induces favorable skeletal muscle metabolic adaptations compared with carbohydrate feeding (CHO), manifesting in improved exercise performance over time. Sprint interval training (SIT) is a potent metabolic stimulus, however nutritional strategies to optimize adaptations to SIT are poorly characterized. Here we investigated the efficacy of FAST versus CHO SIT (4–6 × 30-s Wingate sprints interspersed with 4-min rest) on muscle metabolic, serum metabolome and exercise performance adaptations in a double-blind parallel group design in recreationally active males. Following acute SIT, we observed exercise-induced increases in pan-acetylation and several genes associated with mitochondrial biogenesis, fatty acid oxidation, and NAD+-biosynthesis, along with favorable regulation of PDK4 (p = .004), NAMPT (p = .0013), and NNMT (p = .001) in FAST. Following 3 weeks of SIT, NRF2 (p = .029) was favorably regulated in FAST, with augmented pan-acetylation in CHO but not FAST (p = .033). SIT induced increases in maximal citrate synthase activity were evident with no effect of nutrition, while 3-hydroxyacyl-CoA dehydrogenase activity did not change. Despite no difference in the overall serum metabolome, training-induced changes in C3:1 (p = .013) and C4:1 (p = .010) which increased in FAST, and C16:1 (p = .046) and glutamine (p = .021) which increased in CHO, were different between groups. Training-induced increases in anaerobic (p = .898) and aerobic power (p = .249) were not influenced by nutrition. These findings suggest some beneficial muscle metabolic adaptations are evident in FAST versus CHO SIT following acute exercise and 3 weeks of SIT. However, this stimulus did not manifest in differential exercise performance adaptations.", + "issue": "2", + "language": "en", + "libraryCatalog": "journals.humankinetics.com", + "pages": "73-83", + "publicationTitle": "International Journal of Sport Nutrition and Exercise Metabolism", + "url": "https://journals.humankinetics.com/view/journals/ijsnem/33/2/ijsnem.2022-0142.xml", + "volume": "33", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "exercise" + }, + { + "tag": "fasted" + }, + { + "tag": "fasting" + }, + { + "tag": "metabolism" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://thejns.org/view/journals/j-neurosurg/138/3/article-p587.xml", + "items": [ + { + "itemType": "journalArticle", + "title": "Intraoperative confocal laser endomicroscopy: prospective in vivo feasibility study of a clinical-grade system for brain tumors", + "creators": [ + { + "firstName": "Irakliy", + "lastName": "Abramov", + "creatorType": "author" + }, + { + "firstName": "Marian T.", + "lastName": "Park", + "creatorType": "author" + }, + { + "firstName": "Evgenii", + "lastName": "Belykh", + "creatorType": "author" + }, + { + "firstName": "Alexander B.", + "lastName": "Dru", + "creatorType": "author" + }, + { + "firstName": "Yuan", + "lastName": "Xu", + "creatorType": "author" + }, + { + "firstName": "Timothy C.", + "lastName": "Gooldy", + "creatorType": "author" + }, + { + "firstName": "Lea", + "lastName": "Scherschinski", + "creatorType": "author" + }, + { + "firstName": "S. Harrison", + "lastName": "Farber", + "creatorType": "author" + }, + { + "firstName": "Andrew S.", + "lastName": "Little", + "creatorType": "author" + }, + { + "firstName": "Randall W.", + "lastName": "Porter", + "creatorType": "author" + }, + { + "firstName": "Kris A.", + "lastName": "Smith", + "creatorType": "author" + }, + { + "firstName": "Michael T.", + "lastName": "Lawton", + "creatorType": "author" + }, + { + "firstName": "Jennifer M.", + "lastName": "Eschbacher", + "creatorType": "author" + }, + { + "firstName": "Mark C.", + "lastName": "Preul", + "creatorType": "author" + } + ], + "date": "2022/07/08", + "DOI": "10.3171/2022.5.JNS2282", + "ISSN": "1933-0693, 0022-3085", + "abstractNote": "OBJECTIVE The authors evaluated the feasibility of using the first clinical-grade confocal laser endomicroscopy (CLE) system using fluorescein sodium for intraoperative in vivo imaging of brain tumors. METHODS A CLE system cleared by the FDA was used in 30 prospectively enrolled patients with 31 brain tumors (13 gliomas, 5 meningiomas, 6 other primary tumors, 3 metastases, and 4 reactive brain tissue). A neuropathologist classified CLE images as interpretable or noninterpretable. Images were compared with corresponding frozen and permanent histology sections, with image correlation to biopsy location using neuronavigation. The specificities and sensitivities of CLE images and frozen sections were calculated using permanent histological sections as the standard for comparison. A recently developed surgical telepathology software platform was used in 11 cases to provide real-time intraoperative consultation with a neuropathologist. RESULTS Overall, 10,713 CLE images from 335 regions of interest were acquired. The mean duration of the use of the CLE system was 7 minutes (range 3–18 minutes). Interpretable CLE images were obtained in all cases. The first interpretable image was acquired within a mean of 6 (SD 10) images and within the first 5 (SD 13) seconds of imaging; 4896 images (46%) were interpretable. Interpretable image acquisition was positively correlated with study progression, number of cases per surgeon, cumulative length of CLE time, and CLE time per case (p ≤ 0.01). The diagnostic accuracy, sensitivity, and specificity of CLE compared with frozen sections were 94%, 94%, and 100%, respectively, and the diagnostic accuracy, sensitivity, and specificity of CLE compared with permanent histological sections were 92%, 90%, and 94%, respectively. No difference was observed between lesion types for the time to first interpretable image (p = 0.35). Deeply located lesions were associated with a higher percentage of interpretable images than superficial lesions (p = 0.02). The study met the primary end points, confirming the safety and feasibility and acquisition of noninvasive digital biopsies in all cases. The study met the secondary end points for the duration of CLE use necessary to obtain interpretable images. A neuropathologist could interpret the CLE images in 29 (97%) of 30 cases. CONCLUSIONS The clinical-grade CLE system allows in vivo, intraoperative, high-resolution cellular visualization of tissue microstructure and identification of lesional tissue patterns in real time, without the need for tissue preparation.", + "issue": "3", + "language": "EN", + "libraryCatalog": "thejns.org", + "pages": "587-597", + "publicationTitle": "Journal of Neurosurgery", + "shortTitle": "Intraoperative confocal laser endomicroscopy", + "url": "https://thejns.org/view/journals/j-neurosurg/138/3/article-p587.xml", + "volume": "138", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "confocal laser endomicroscopy" + }, + { + "tag": "fluorescence-guided surgery" + }, + { + "tag": "intraoperative diagnosis" + }, + { + "tag": "neuropathology" + }, + { + "tag": "neurosurgery" + }, + { + "tag": "oncology" + }, + { + "tag": "telemedicine" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://journals.ametsoc.org/view/journals/atsc/72/8/jas-d-14-0363.1.xml", + "items": [ + { + "itemType": "journalArticle", + "title": "Observations of Ice Microphysics through the Melting Layer", + "creators": [ + { + "firstName": "Andrew J.", + "lastName": "Heymsfield", + "creatorType": "author" + }, + { + "firstName": "Aaron", + "lastName": "Bansemer", + "creatorType": "author" + }, + { + "firstName": "Michael R.", + "lastName": "Poellot", + "creatorType": "author" + }, + { + "firstName": "Norm", + "lastName": "Wood", + "creatorType": "author" + } + ], + "date": "2015/08/01", + "DOI": "10.1175/JAS-D-14-0363.1", + "ISSN": "0022-4928, 1520-0469", + "abstractNote": "The detailed microphysical processes and properties within the melting layer (ML)—the continued growth of the aggregates by the collection of the small particles, the breakup of these aggregates, the effects of relative humidity on particle melting—are largely unresolved. This study focuses on addressing these questions for in-cloud heights from just above to just below the ML. Observations from four field programs employing in situ measurements from above to below the ML are used to characterize the microphysics through this region. With increasing temperatures from about −4° to +1°C, and for saturated conditions, slope and intercept parameters of exponential fits to the particle size distributions (PSD) fitted to the data continue to decrease downward, the maximum particle size (largest particle sampled for each 5-s PSD) increases, and melting proceeds from the smallest to the largest particles. With increasing temperature from about −4° to +2°C for highly subsaturated conditions, the PSD slope and intercept continue to decrease downward, the maximum particle size increases, and there is relatively little melting, but all particles experience sublimation.", + "issue": "8", + "language": "EN", + "libraryCatalog": "journals.ametsoc.org", + "pages": "2902-2928", + "publicationTitle": "Journal of the Atmospheric Sciences", + "url": "https://journals.ametsoc.org/view/journals/atsc/72/8/jas-d-14-0363.1.xml", + "volume": "72", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Cloud microphysics" + }, + { + "tag": "Cloud retrieval" + }, + { + "tag": "Cloud water/phase" + }, + { + "tag": "Ice crystals" + }, + { + "tag": "Ice particles" + }, + { + "tag": "In situ atmospheric observations" + } + ], + "notes": [], + "seeAlso": [] + } + ] } ] /** END TEST CASES **/ From 1e988ba47ba07c76336e2325381bcdf9c3733f5f Mon Sep 17 00:00:00 2001 From: Brendan OConnell Date: Wed, 29 Mar 2023 16:11:35 +0200 Subject: [PATCH 06/14] Deleted out-of-date AMS translator file --- American Meteorological Society.js | 106 ----------------------------- 1 file changed, 106 deletions(-) delete mode 100644 American Meteorological Society.js diff --git a/American Meteorological Society.js b/American Meteorological Society.js deleted file mode 100644 index a455f0ae2fd..00000000000 --- a/American Meteorological Society.js +++ /dev/null @@ -1,106 +0,0 @@ -{ - "translatorID": "fae4a788-7f30-41b1-a1c2-71017d86bfda", - "label": "American Meteorological Society", - "creator": "Brendan O'Connell", - "target": "https://journals.ametsoc.org/view/journals", - "minVersion": "5.0", - "maxVersion": "", - "priority": 100, - "inRepository": true, - "translatorType": 4, - "browserSupport": "gcsibv", - "lastUpdated": "2023-03-21 15:40:48" -} - -/* - ***** BEGIN LICENSE BLOCK ***** - - Copyright © 2022 YOUR_NAME <- TODO - - This file is part of Zotero. - - Zotero is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Zotero is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with Zotero. If not, see . - - ***** END LICENSE BLOCK ***** -*/ - - -function detectWeb(doc, url) { - // TODO: adjust the logic here - if (url.includes('/article/')) { - return 'newspaperArticle'; - } - else if (getSearchResults(doc, true)) { - return 'multiple'; - } - return false; -} - -function getSearchResults(doc, checkOnly) { - var items = {}; - var found = false; - // TODO: adjust the CSS selector - var rows = doc.querySelectorAll('h2 > a.title[href*="/article/"]'); - for (let row of rows) { - // TODO: check and maybe adjust - let href = row.href; - // TODO: check and maybe adjust - let title = ZU.trimInternal(row.textContent); - if (!href || !title) continue; - if (checkOnly) return true; - found = true; - items[href] = title; - } - return found ? items : false; -} - -async function doWeb(doc, url) { - if (detectWeb(doc, url) == 'multiple') { - let items = await Zotero.selectItems(getSearchResults(doc, false)); - if (!items) return; - for (let url of Object.keys(items)) { - await scrape(await requestDocument(url)); - } - } - else { - await scrape(doc, url); - } -} - -async function scrape(doc, url = doc.location.href) { - // TODO: implement or add a scrape function template - let translator = Zotero.loadTranslator('web'); - // Embedded Metadata - translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); // Embedded Metadata - translator.setDocument(doc); - - translator.setHandler('itemDone', (_obj, item) => { - // TODO adjust if needed: - item.section = 'News'; - item.complete(); - }); - - let em = await translator.getTranslatorObject(); - em.itemType = 'newspaperArticle'; - // TODO map additional meta tags here, or delete completely - em.addCustomFields({ - 'twitter:description': 'abstractNote' - }); - await em.doWeb(doc, url); -} - -/** BEGIN TEST CASES **/ -var testCases = [ -] -/** END TEST CASES **/ From 8a12de90461881e39151fbd63a8b7ab378bd489b Mon Sep 17 00:00:00 2001 From: Brendan OConnell Date: Thu, 6 Jul 2023 16:05:39 +0200 Subject: [PATCH 07/14] Added reviewer changes: new regex, improved selector for detectWeb, cleaner code --- PubFactory Journals.js | 289 ++++++++++++++++++++++++++++++++--------- 1 file changed, 225 insertions(+), 64 deletions(-) diff --git a/PubFactory Journals.js b/PubFactory Journals.js index 7b2a741226c..f17eb5c2f8c 100644 --- a/PubFactory Journals.js +++ b/PubFactory Journals.js @@ -2,14 +2,14 @@ "translatorID": "8d1fb775-df6d-4069-8830-1dfe8e8387dd", "label": "PubFactory Journals", "creator": "Brendan O'Connell", - "target": "^https?:\\/\\/(?:[\\w-]+\\.)+[\\w-]+(?:\\/[^\\/\\s]*)+\\.xml(?:\\?.*)?$|^https:\\/\\/(?:[\\w-]+\\.)+[\\w-]+\\/search\\?[^\\/\\s]*source=%2Fjournals%2F\\w+%2F\\w+-overview\\.xml(?:&q=[^&\\s]*)?$", + "target": "^https://([^/]+/view/journals/.+\\.xml|[^.]*journals\\.[^/]+/search)\\b", "minVersion": "5.0", "maxVersion": "", "priority": 100, "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2023-03-29 13:58:05" + "lastUpdated": "2023-07-06 14:02:57" } /* @@ -43,7 +43,7 @@ function detectWeb(doc) { // because there are multiple items that match the rows selector in getSearchResults and // haven't found a way to write a querySelectorAll() that only matches the main article on single pages // with related items. - if (doc.querySelector('meta[name="citation_title"]')) { + if (doc.querySelector('meta[property="og:type"][content="article"]')) { return "journalArticle"; } else if (getSearchResults(doc, true)) { @@ -55,11 +55,23 @@ function detectWeb(doc) { function getSearchResults(doc, checkOnly) { var items = {}; var found = false; - var rows = doc.querySelectorAll('a.c-Button--link[href*="/view/journals/"][href$=".xml"][target="_self"]'); + // var rows = doc.querySelectorAll('a.c-Button--link[href*="/view/journals/"][href$=".xml"][target="_self"]'); + // // var rows = doc.querySelectorAll('.content-box h1 a[href*=".xml"]'); + // for (let row of rows) { + // let href = row.href; + // let title = ZU.trimInternal(row.innerText); + // if (!href || !title) continue; + // if (checkOnly) return true; + // found = true; + // items[href] = title; + // } + // return found ? items : false; + let linkSelector = 'a.c-Button--link[href^="/"][href*=".xml"]'; + let rows = doc.querySelectorAll(`#searchContent ${linkSelector}, .issue-toc ${linkSelector}`); for (let row of rows) { let href = row.href; let title = ZU.trimInternal(row.innerText); - if (!href || !title) continue; + if (!href || !title || /\bissue-.+\.xml\b/.test(href)) continue; if (checkOnly) return true; found = true; items[href] = title; @@ -82,7 +94,8 @@ async function doWeb(doc, url) { async function scrape(doc, url = doc.location.href) { if (doc.querySelector('meta[name="citation_pdf_url"]')) { - var pdfURL = doc.querySelector('meta[name="citation_pdf_url"]').getAttribute("content"); + // var pdfURL = doc.querySelector('meta[name="citation_pdf_url"]').getAttribute("content"); + var pdfURL = attr(doc, 'meta[name="citation_pdf_url"]', "content"); } let translator = Zotero.loadTranslator('web'); // Embedded Metadata @@ -91,11 +104,13 @@ async function scrape(doc, url = doc.location.href) { translator.setHandler('itemDone', (_obj, item) => { // remove word "Abstract" from abstract if present, e.g. https://journals.ametsoc.org/view/journals/atsc/72/8/jas-d-14-0363.1.xml - var abstract = doc.querySelector('meta[property="og:description"]').content; - if (abstract.startsWith("Abstract")) { - var cleanAbstract = abstract.substring(8); // remove the first 8 characters ("Abstract ") + // var abstract = doc.querySelector('meta[property="og:description"]').content; + var abstract = attr(doc, 'meta[property="og:description"]', "content"); + var cleanAbstract = abstract.replace(/^Abstract\s+/i, ""); + // if (abstract.startsWith("Abstract")) { + // var cleanAbstract = abstract.substring(8); // remove the first 8 characters ("Abstract ") item.abstractNote = cleanAbstract; - } + // } if (pdfURL) { item.attachments = []; item.attachments.push({ @@ -119,60 +134,6 @@ var testCases = [ "url": "https://journals.ametsoc.org/view/journals/amsm/59/1/amsm.59.issue-1.xml", "items": "multiple" }, - { - "type": "web", - "url": "https://journals.humankinetics.com/view/journals/cssm/12/1/cssm.2022-0019.xml", - "items": [ - { - "itemType": "journalArticle", - "title": "Learning How to Make Decisions in a Nonprofit Sport Organization: An Application of Strategic Decision-Making Theory", - "creators": [ - { - "firstName": "Erik L.", - "lastName": "Lachance", - "creatorType": "author" - } - ], - "date": "2023/01/01", - "DOI": "10.1123/cssm.2022-0019", - "ISSN": "2167-2458, 2372-5540", - "abstractNote": "This teaching-based case study tasks students with analyzing a strategic decision. This analysis is guided by a script describing a strategic decision undertaken in a fictional nonprofit sport organization (i.e., Canadian Ice Tennis Federation). Students’ analysis is achieved by applying strategic decision-making theory, including its five central constructs: centrality, duration, flow, interaction, and scrutiny. Knowledge is gained by analyzing a strategic decision according to its level of authorization, length, delays, negotiations, and information sources. This teaching-based case study is intended for undergraduate students in general sport management and/or strategy/strategic management courses. The benefit of this teaching-based case study resides in its ability to teach students how to make decisions, a central and ubiquitous task in organizational life, and their future endeavors in the sport industry.", - "issue": "1", - "language": "en", - "libraryCatalog": "journals.humankinetics.com", - "pages": "1-5", - "publicationTitle": "Case Studies in Sport Management", - "shortTitle": "Learning How to Make Decisions in a Nonprofit Sport Organization", - "url": "https://journals.humankinetics.com/view/journals/cssm/12/1/cssm.2022-0019.xml", - "volume": "12", - "attachments": [ - { - "title": "Full Text PDF", - "mimeType": "application/pdf" - } - ], - "tags": [ - { - "tag": "decision-making process" - }, - { - "tag": "not-for-profit sport organizations" - }, - { - "tag": "strategic decisions" - }, - { - "tag": "strategic management" - }, - { - "tag": "strategy" - } - ], - "notes": [], - "seeAlso": [] - } - ] - }, { "type": "web", "url": "https://journals.humankinetics.com/view/journals/jab/jab-overview.xml", @@ -453,6 +414,206 @@ var testCases = [ "seeAlso": [] } ] + }, + { + "type": "web", + "url": "https://akjournals.com/view/journals/2006/12/2/article-p303.xml?rskey=lLnjOM&result=2", + "items": [ + { + "itemType": "journalArticle", + "title": "Thinking beyond cut-off scores in the assessment of potentially addictive behaviors: A brief illustration in the context of binge-watching", + "creators": [ + { + "firstName": "Pauline", + "lastName": "Billaux", + "creatorType": "author" + }, + { + "firstName": "Joël", + "lastName": "Billieux", + "creatorType": "author" + }, + { + "firstName": "Stéphanie", + "lastName": "Baggio", + "creatorType": "author" + }, + { + "firstName": "Pierre", + "lastName": "Maurage", + "creatorType": "author" + }, + { + "firstName": "Maèva", + "lastName": "Flayelle", + "creatorType": "author" + } + ], + "date": "2023/06/30", + "DOI": "10.1556/2006.2023.00032", + "ISSN": "2063-5303, 2062-5871", + "abstractNote": "While applying a diagnostic approach (i.e., comparing “clinical” cases with “healthy” controls) is part of our methodological habits as researchers and clinicians, this approach has been particularly criticized in the behavioral addictions research field, in which a lot of studies are conducted on “emerging” conditions. Here we exemplify the pitfalls of using a cut-off-based approach in the context of binge-watching (i.e., watching multiple episodes of series back-to-back) by demonstrating that no reliable cut-off scores could be determined with a widely used assessment instrument measuring binge-watching.", + "issue": "2", + "language": "en", + "libraryCatalog": "akjournals.com", + "pages": "303-308", + "publicationTitle": "Journal of Behavioral Addictions", + "shortTitle": "Thinking beyond cut-off scores in the assessment of potentially addictive behaviors", + "url": "https://akjournals.com/view/journals/2006/12/2/article-p303.xml", + "volume": "12", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "addictive behaviors" + }, + { + "tag": "behavioral addictions" + }, + { + "tag": "binge-watching" + }, + { + "tag": "cut-off scores" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://akjournals.com/view/journals/2006/12/2/2006.12.issue-2.xml", + "items": "multiple" + }, + { + "type": "web", + "url": "https://akjournals.com/view/journals/606/aop/issue.xml", + "items": "multiple" + }, + { + "type": "web", + "url": "https://jnccn.org/view/journals/jnccn/21/6/jnccn.21.issue-6.xml", + "items": "multiple" + }, + { + "type": "web", + "url": "https://jnccn.org/view/journals/jnccn/21/6/article-p685.xml", + "items": [ + { + "itemType": "journalArticle", + "title": "Increasing Private Payer and Medicare Coverage of Circulating Tumor DNA Tests: What’s at Stake?", + "creators": [ + { + "firstName": "Mariana P.", + "lastName": "Socal", + "creatorType": "author" + } + ], + "date": "2023/06/01", + "DOI": "10.6004/jnccn.2023.7038", + "ISSN": "1540-1405, 1540-1413", + "abstractNote": "\"Increasing Private Payer and Medicare Coverage of Circulating Tumor DNA Tests: What’s at Stake?\" published on Jun 2023 by National Comprehensive Cancer Network.", + "issue": "6", + "language": "EN", + "libraryCatalog": "jnccn.org", + "pages": "685-686", + "publicationTitle": "Journal of the National Comprehensive Cancer Network", + "shortTitle": "Increasing Private Payer and Medicare Coverage of Circulating Tumor DNA Tests", + "url": "https://jnccn.org/view/journals/jnccn/21/6/article-p685.xml", + "volume": "21", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.ajtmh.org/view/journals/tpmd/109/1/tpmd.109.issue-1.xml", + "items": "multiple" + }, + { + "type": "web", + "url": "https://akjournals.com/view/journals/2006/12/2/article-p303.xml?rskey=lLnjOM&result=2", + "items": [ + { + "itemType": "journalArticle", + "title": "Thinking beyond cut-off scores in the assessment of potentially addictive behaviors: A brief illustration in the context of binge-watching", + "creators": [ + { + "firstName": "Pauline", + "lastName": "Billaux", + "creatorType": "author" + }, + { + "firstName": "Joël", + "lastName": "Billieux", + "creatorType": "author" + }, + { + "firstName": "Stéphanie", + "lastName": "Baggio", + "creatorType": "author" + }, + { + "firstName": "Pierre", + "lastName": "Maurage", + "creatorType": "author" + }, + { + "firstName": "Maèva", + "lastName": "Flayelle", + "creatorType": "author" + } + ], + "date": "2023/06/30", + "DOI": "10.1556/2006.2023.00032", + "ISSN": "2063-5303, 2062-5871", + "abstractNote": "While applying a diagnostic approach (i.e., comparing “clinical” cases with “healthy” controls) is part of our methodological habits as researchers and clinicians, this approach has been particularly criticized in the behavioral addictions research field, in which a lot of studies are conducted on “emerging” conditions. Here we exemplify the pitfalls of using a cut-off-based approach in the context of binge-watching (i.e., watching multiple episodes of series back-to-back) by demonstrating that no reliable cut-off scores could be determined with a widely used assessment instrument measuring binge-watching.", + "issue": "2", + "language": "en", + "libraryCatalog": "akjournals.com", + "pages": "303-308", + "publicationTitle": "Journal of Behavioral Addictions", + "shortTitle": "Thinking beyond cut-off scores in the assessment of potentially addictive behaviors", + "url": "https://akjournals.com/view/journals/2006/12/2/article-p303.xml", + "volume": "12", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "addictive behaviors" + }, + { + "tag": "behavioral addictions" + }, + { + "tag": "binge-watching" + }, + { + "tag": "cut-off scores" + } + ], + "notes": [], + "seeAlso": [] + } + ] } ] /** END TEST CASES **/ From e30938e76a52c5b19983d674729cc47a642d4d88 Mon Sep 17 00:00:00 2001 From: Brendan OConnell Date: Fri, 7 Jul 2023 11:00:56 +0200 Subject: [PATCH 08/14] Attempting to fix error with multiple not retrieving metadata --- PubFactory Journals.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/PubFactory Journals.js b/PubFactory Journals.js index f17eb5c2f8c..d4f0919f07a 100644 --- a/PubFactory Journals.js +++ b/PubFactory Journals.js @@ -9,7 +9,7 @@ "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2023-07-06 14:02:57" + "lastUpdated": "2023-07-07 08:29:31" } /* @@ -56,7 +56,7 @@ function getSearchResults(doc, checkOnly) { var items = {}; var found = false; // var rows = doc.querySelectorAll('a.c-Button--link[href*="/view/journals/"][href$=".xml"][target="_self"]'); - // // var rows = doc.querySelectorAll('.content-box h1 a[href*=".xml"]'); + // // var rows = doc.querySelectorAll('.content-box h1 a[href*=".xml"]'); // for (let row of rows) { // let href = row.href; // let title = ZU.trimInternal(row.innerText); @@ -66,7 +66,7 @@ function getSearchResults(doc, checkOnly) { // items[href] = title; // } // return found ? items : false; - let linkSelector = 'a.c-Button--link[href^="/"][href*=".xml"]'; + let linkSelector = 'a.c-Button--link[href^="/"][href*=".xml"]'; let rows = doc.querySelectorAll(`#searchContent ${linkSelector}, .issue-toc ${linkSelector}`); for (let row of rows) { let href = row.href; @@ -81,9 +81,12 @@ function getSearchResults(doc, checkOnly) { async function doWeb(doc, url) { if (detectWeb(doc, url) == 'multiple') { + Z.debug("running doWeb multiple items"); let items = await Zotero.selectItems(getSearchResults(doc, false)); + // if (items) Z.debug("there are items"); if (!items) return; for (let url of Object.keys(items)) { + Z.debug(url); await scrape(await requestDocument(url)); } } @@ -93,9 +96,14 @@ async function doWeb(doc, url) { } async function scrape(doc, url = doc.location.href) { + // Z.debug("scrape"); + // Z.debug(doc); + // TODO: why is metadata so bad on multiple? + // if I import this directly, it works great: https://journals.humankinetics.com/view/journals/jab/39/3/article-p199.xml + // but imported as a multiple from here, it's terrible: https://journals.humankinetics.com/view/journals/jab/39/3/jab.39.issue-3.xml if (doc.querySelector('meta[name="citation_pdf_url"]')) { // var pdfURL = doc.querySelector('meta[name="citation_pdf_url"]').getAttribute("content"); - var pdfURL = attr(doc, 'meta[name="citation_pdf_url"]', "content"); + var pdfURL = attr(doc, 'meta[name="citation_pdf_url"]', "content"); } let translator = Zotero.loadTranslator('web'); // Embedded Metadata @@ -107,9 +115,10 @@ async function scrape(doc, url = doc.location.href) { // var abstract = doc.querySelector('meta[property="og:description"]').content; var abstract = attr(doc, 'meta[property="og:description"]', "content"); var cleanAbstract = abstract.replace(/^Abstract\s+/i, ""); + // Z.debug(item.publicationTitle); // if (abstract.startsWith("Abstract")) { // var cleanAbstract = abstract.substring(8); // remove the first 8 characters ("Abstract ") - item.abstractNote = cleanAbstract; + item.abstractNote = cleanAbstract; // } if (pdfURL) { item.attachments = []; @@ -614,6 +623,11 @@ var testCases = [ "seeAlso": [] } ] + }, + { + "type": "web", + "url": "https://journals.humankinetics.com/view/journals/jab/39/3/jab.39.issue-3.xml", + "items": "multiple" } ] /** END TEST CASES **/ From 848d70fbd3e247dd547bc8a9962be412fb56132b Mon Sep 17 00:00:00 2001 From: Brendan OConnell Date: Tue, 18 Jul 2023 10:45:25 +0200 Subject: [PATCH 09/14] Incorporated review changes. Multiple still not working well --- PubFactory Journals.js | 114 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 111 insertions(+), 3 deletions(-) diff --git a/PubFactory Journals.js b/PubFactory Journals.js index d4f0919f07a..36d11db43ef 100644 --- a/PubFactory Journals.js +++ b/PubFactory Journals.js @@ -5,11 +5,11 @@ "target": "^https://([^/]+/view/journals/.+\\.xml|[^.]*journals\\.[^/]+/search)\\b", "minVersion": "5.0", "maxVersion": "", - "priority": 100, + "priority": 200, "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2023-07-07 08:29:31" + "lastUpdated": "2023-07-18 08:25:36" } /* @@ -100,7 +100,12 @@ async function scrape(doc, url = doc.location.href) { // Z.debug(doc); // TODO: why is metadata so bad on multiple? // if I import this directly, it works great: https://journals.humankinetics.com/view/journals/jab/39/3/article-p199.xml - // but imported as a multiple from here, it's terrible: https://journals.humankinetics.com/view/journals/jab/39/3/jab.39.issue-3.xml + // but imported as a multiple from here, it only imports title and abstract: https://journals.humankinetics.com/view/journals/jab/39/3/jab.39.issue-3.xml + // this is probably it's bad: https://groups.google.com/g/zotero-dev/c/yIVWbu0xNlQ/m/THjnupckAwAJ + // also here: https://groups.google.com/g/zotero-dev/c/EnC5teZkSP8/m/dmygGUMIBQAJ + // so the solution for multiple is we need to get the page data from an API or JSON so that web translator can read it + // however, looking at the network traffic, I don't see an API call... just the page load + // https://groups.google.com/g/zotero-dev/c/2gCD5-mM_Cg/m/tbJH6siaUWkJ if (doc.querySelector('meta[name="citation_pdf_url"]')) { // var pdfURL = doc.querySelector('meta[name="citation_pdf_url"]').getAttribute("content"); var pdfURL = attr(doc, 'meta[name="citation_pdf_url"]', "content"); @@ -628,6 +633,109 @@ var testCases = [ "type": "web", "url": "https://journals.humankinetics.com/view/journals/jab/39/3/jab.39.issue-3.xml", "items": "multiple" + }, + { + "type": "web", + "url": "https://journals.ametsoc.org/view/journals/amsm/59/1/amsmonographs-d-18-0006.1.xml?tab_body=abstract-display", + "items": [ + { + "itemType": "journalArticle", + "title": "100 Years of Progress in Atmospheric Observing Systems", + "creators": [ + { + "firstName": "Jeffrey L.", + "lastName": "Stith", + "creatorType": "author" + }, + { + "firstName": "Darrel", + "lastName": "Baumgardner", + "creatorType": "author" + }, + { + "firstName": "Julie", + "lastName": "Haggerty", + "creatorType": "author" + }, + { + "firstName": "R. Michael", + "lastName": "Hardesty", + "creatorType": "author" + }, + { + "firstName": "Wen-Chau", + "lastName": "Lee", + "creatorType": "author" + }, + { + "firstName": "Donald", + "lastName": "Lenschow", + "creatorType": "author" + }, + { + "firstName": "Peter", + "lastName": "Pilewskie", + "creatorType": "author" + }, + { + "firstName": "Paul L.", + "lastName": "Smith", + "creatorType": "author" + }, + { + "firstName": "Matthias", + "lastName": "Steiner", + "creatorType": "author" + }, + { + "firstName": "Holger", + "lastName": "Vömel", + "creatorType": "author" + } + ], + "date": "2018/01/01", + "DOI": "10.1175/AMSMONOGRAPHS-D-18-0006.1", + "abstractNote": "Although atmospheric observing systems were already an important part of meteorology before the American Meteorological Society was established in 1919, the past 100 years have seen a steady increase in their numbers and types. Examples of how observing systems were developed and how they have enabled major scientific discoveries are presented. These examples include observing systems associated with the boundary layer, the upper air, clouds and precipitation, and solar and terrestrial radiation. Widely used specialized observing systems such as radar, lidar, and research aircraft are discussed, and examples of applications to weather forecasting and climate are given. Examples drawn from specific types of chemical measurements, such as ozone and carbon dioxide, are included. Sources of information on observing systems, including other chapters of this monograph, are also discussed. The past 100 years has been characterized by synergism between societal needs for weather observations and the needs of fundamental meteorological research into atmospheric processes. In the latter half of the period, observing system improvements have been driven by the increasing demands for higher-resolution data for numerical models, the need for long-term measurements, and for more global coverage. This has resulted in a growing demand for data access and for integrating data from an increasingly wide variety of observing system types and networks. These trends will likely continue.", + "issue": "1", + "language": "EN", + "libraryCatalog": "journals.ametsoc.org", + "pages": "2.1-2.55", + "publicationTitle": "Meteorological Monographs", + "url": "https://journals.ametsoc.org/view/journals/amsm/59/1/amsmonographs-d-18-0006.1.xml", + "volume": "59", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Aircraft observations" + }, + { + "tag": "Automatic weather stations" + }, + { + "tag": "Dropsondes" + }, + { + "tag": "Profilers" + }, + { + "tag": "Radars/Radar observations" + }, + { + "tag": "Radiosonde observations" + }, + { + "tag": "atmospheric" + } + ], + "notes": [], + "seeAlso": [] + } + ] } ] /** END TEST CASES **/ From 6195d77978ed0b3e2ab0f6e4c19ad1564c4a6e30 Mon Sep 17 00:00:00 2001 From: Brendan OConnell Date: Thu, 20 Jul 2023 13:18:27 +0200 Subject: [PATCH 10/14] Added comments to code --- PubFactory Journals.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PubFactory Journals.js b/PubFactory Journals.js index 36d11db43ef..9b2f1d69a36 100644 --- a/PubFactory Journals.js +++ b/PubFactory Journals.js @@ -101,7 +101,7 @@ async function scrape(doc, url = doc.location.href) { // TODO: why is metadata so bad on multiple? // if I import this directly, it works great: https://journals.humankinetics.com/view/journals/jab/39/3/article-p199.xml // but imported as a multiple from here, it only imports title and abstract: https://journals.humankinetics.com/view/journals/jab/39/3/jab.39.issue-3.xml - // this is probably it's bad: https://groups.google.com/g/zotero-dev/c/yIVWbu0xNlQ/m/THjnupckAwAJ + // this is probably why it's bad: https://groups.google.com/g/zotero-dev/c/yIVWbu0xNlQ/m/THjnupckAwAJ // also here: https://groups.google.com/g/zotero-dev/c/EnC5teZkSP8/m/dmygGUMIBQAJ // so the solution for multiple is we need to get the page data from an API or JSON so that web translator can read it // however, looking at the network traffic, I don't see an API call... just the page load From 5e764ae26f3e132c5c721c1bf6485f897734e128 Mon Sep 17 00:00:00 2001 From: Brendan OConnell Date: Tue, 29 Aug 2023 13:07:44 +0200 Subject: [PATCH 11/14] Added searchForMetaTagsInBody to save multiple items --- PubFactory Journals.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PubFactory Journals.js b/PubFactory Journals.js index 9b2f1d69a36..070c0bd68b4 100644 --- a/PubFactory Journals.js +++ b/PubFactory Journals.js @@ -9,7 +9,7 @@ "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2023-07-18 08:25:36" + "lastUpdated": "2023-08-29 11:01:36" } /* @@ -138,6 +138,9 @@ async function scrape(doc, url = doc.location.href) { let em = await translator.getTranslatorObject(); em.itemType = 'journalArticle'; + if (doc.querySelector("body > meta")) { + em.searchForMetaTagsInBody = true; + } await em.doWeb(doc, url); } From 0f259dd702ed1c83fc3f4e9f2932d0fee9ad2579 Mon Sep 17 00:00:00 2001 From: Brendan OConnell Date: Tue, 29 Aug 2023 13:12:32 +0200 Subject: [PATCH 12/14] Removed extraneous comments --- PubFactory Journals.js | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/PubFactory Journals.js b/PubFactory Journals.js index 070c0bd68b4..c5518a6785d 100644 --- a/PubFactory Journals.js +++ b/PubFactory Journals.js @@ -55,17 +55,6 @@ function detectWeb(doc) { function getSearchResults(doc, checkOnly) { var items = {}; var found = false; - // var rows = doc.querySelectorAll('a.c-Button--link[href*="/view/journals/"][href$=".xml"][target="_self"]'); - // // var rows = doc.querySelectorAll('.content-box h1 a[href*=".xml"]'); - // for (let row of rows) { - // let href = row.href; - // let title = ZU.trimInternal(row.innerText); - // if (!href || !title) continue; - // if (checkOnly) return true; - // found = true; - // items[href] = title; - // } - // return found ? items : false; let linkSelector = 'a.c-Button--link[href^="/"][href*=".xml"]'; let rows = doc.querySelectorAll(`#searchContent ${linkSelector}, .issue-toc ${linkSelector}`); for (let row of rows) { @@ -81,12 +70,9 @@ function getSearchResults(doc, checkOnly) { async function doWeb(doc, url) { if (detectWeb(doc, url) == 'multiple') { - Z.debug("running doWeb multiple items"); let items = await Zotero.selectItems(getSearchResults(doc, false)); - // if (items) Z.debug("there are items"); if (!items) return; for (let url of Object.keys(items)) { - Z.debug(url); await scrape(await requestDocument(url)); } } @@ -96,18 +82,7 @@ async function doWeb(doc, url) { } async function scrape(doc, url = doc.location.href) { - // Z.debug("scrape"); - // Z.debug(doc); - // TODO: why is metadata so bad on multiple? - // if I import this directly, it works great: https://journals.humankinetics.com/view/journals/jab/39/3/article-p199.xml - // but imported as a multiple from here, it only imports title and abstract: https://journals.humankinetics.com/view/journals/jab/39/3/jab.39.issue-3.xml - // this is probably why it's bad: https://groups.google.com/g/zotero-dev/c/yIVWbu0xNlQ/m/THjnupckAwAJ - // also here: https://groups.google.com/g/zotero-dev/c/EnC5teZkSP8/m/dmygGUMIBQAJ - // so the solution for multiple is we need to get the page data from an API or JSON so that web translator can read it - // however, looking at the network traffic, I don't see an API call... just the page load - // https://groups.google.com/g/zotero-dev/c/2gCD5-mM_Cg/m/tbJH6siaUWkJ if (doc.querySelector('meta[name="citation_pdf_url"]')) { - // var pdfURL = doc.querySelector('meta[name="citation_pdf_url"]').getAttribute("content"); var pdfURL = attr(doc, 'meta[name="citation_pdf_url"]', "content"); } let translator = Zotero.loadTranslator('web'); @@ -117,14 +92,9 @@ async function scrape(doc, url = doc.location.href) { translator.setHandler('itemDone', (_obj, item) => { // remove word "Abstract" from abstract if present, e.g. https://journals.ametsoc.org/view/journals/atsc/72/8/jas-d-14-0363.1.xml - // var abstract = doc.querySelector('meta[property="og:description"]').content; var abstract = attr(doc, 'meta[property="og:description"]', "content"); var cleanAbstract = abstract.replace(/^Abstract\s+/i, ""); - // Z.debug(item.publicationTitle); - // if (abstract.startsWith("Abstract")) { - // var cleanAbstract = abstract.substring(8); // remove the first 8 characters ("Abstract ") item.abstractNote = cleanAbstract; - // } if (pdfURL) { item.attachments = []; item.attachments.push({ @@ -138,6 +108,8 @@ async function scrape(doc, url = doc.location.href) { let em = await translator.getTranslatorObject(); em.itemType = 'journalArticle'; + // fix when meta elements are incorrectly placed in body on journal pages + // https://github.com/zotero/translators/pull/3009#discussion_r1268956903 if (doc.querySelector("body > meta")) { em.searchForMetaTagsInBody = true; } From e2cd5e93235327668911d49e1822c4b394399d31 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Tue, 4 Jun 2024 14:11:28 -0400 Subject: [PATCH 13/14] Make detect condition more specific And update tests. --- PubFactory Journals.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/PubFactory Journals.js b/PubFactory Journals.js index c5518a6785d..4e702daca2a 100644 --- a/PubFactory Journals.js +++ b/PubFactory Journals.js @@ -9,7 +9,7 @@ "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2023-08-29 11:01:36" + "lastUpdated": "2024-06-04 18:11:19" } /* @@ -43,7 +43,8 @@ function detectWeb(doc) { // because there are multiple items that match the rows selector in getSearchResults and // haven't found a way to write a querySelectorAll() that only matches the main article on single pages // with related items. - if (doc.querySelector('meta[property="og:type"][content="article"]')) { + if (doc.querySelector('meta[property="og:type"][content="article"]') + && text(doc, '#footerWrap').includes('PubFactory')) { return "journalArticle"; } else if (getSearchResults(doc, true)) { @@ -130,12 +131,12 @@ var testCases = [ }, { "type": "web", - "url": "https://avmajournals.avma.org/view/journals/javma/javma-overview.xml?_gl=1*1mk7zsf*_ga*MTI2MDA0NjE4NS4xNjc5NTc4NzIy*_ga_L7SBEK6H36*MTY3OTU3ODcyMS4xLjEuMTY3OTU3ODg0NS4wLjAuMA..", + "url": "https://avmajournals.avma.org/view/journals/javma/javma-overview.xml", "items": "multiple" }, { "type": "web", - "url": "https://journals.humankinetics.com/view/journals/ijsnem/33/2/ijsnem.2022-0142.xml", + "url": "https://journals.humankinetics.com/view/journals/ijsnem/33/2/article-p73.xml", "items": [ { "itemType": "journalArticle", @@ -172,7 +173,7 @@ var testCases = [ "creatorType": "author" } ], - "date": "2023/03/01", + "date": "2022/12/26", "DOI": "10.1123/ijsnem.2022-0142", "ISSN": "1543-2742, 1526-484X", "abstractNote": "Endurance training in fasted conditions (FAST) induces favorable skeletal muscle metabolic adaptations compared with carbohydrate feeding (CHO), manifesting in improved exercise performance over time. Sprint interval training (SIT) is a potent metabolic stimulus, however nutritional strategies to optimize adaptations to SIT are poorly characterized. Here we investigated the efficacy of FAST versus CHO SIT (4–6 × 30-s Wingate sprints interspersed with 4-min rest) on muscle metabolic, serum metabolome and exercise performance adaptations in a double-blind parallel group design in recreationally active males. Following acute SIT, we observed exercise-induced increases in pan-acetylation and several genes associated with mitochondrial biogenesis, fatty acid oxidation, and NAD+-biosynthesis, along with favorable regulation of PDK4 (p = .004), NAMPT (p = .0013), and NNMT (p = .001) in FAST. Following 3 weeks of SIT, NRF2 (p = .029) was favorably regulated in FAST, with augmented pan-acetylation in CHO but not FAST (p = .033). SIT induced increases in maximal citrate synthase activity were evident with no effect of nutrition, while 3-hydroxyacyl-CoA dehydrogenase activity did not change. Despite no difference in the overall serum metabolome, training-induced changes in C3:1 (p = .013) and C4:1 (p = .010) which increased in FAST, and C16:1 (p = .046) and glutamine (p = .021) which increased in CHO, were different between groups. Training-induced increases in anaerobic (p = .898) and aerobic power (p = .249) were not influenced by nutrition. These findings suggest some beneficial muscle metabolic adaptations are evident in FAST versus CHO SIT following acute exercise and 3 weeks of SIT. However, this stimulus did not manifest in differential exercise performance adaptations.", @@ -181,7 +182,7 @@ var testCases = [ "libraryCatalog": "journals.humankinetics.com", "pages": "73-83", "publicationTitle": "International Journal of Sport Nutrition and Exercise Metabolism", - "url": "https://journals.humankinetics.com/view/journals/ijsnem/33/2/ijsnem.2022-0142.xml", + "url": "https://journals.humankinetics.com/view/journals/ijsnem/33/2/article-p73.xml", "volume": "33", "attachments": [ { From 8d9887a522fb9e70601a053f4eb6742aef8e93d2 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Tue, 4 Jun 2024 14:14:42 -0400 Subject: [PATCH 14/14] Generalize result selector --- PubFactory Journals.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PubFactory Journals.js b/PubFactory Journals.js index 4e702daca2a..32bca32f485 100644 --- a/PubFactory Journals.js +++ b/PubFactory Journals.js @@ -56,7 +56,7 @@ function detectWeb(doc) { function getSearchResults(doc, checkOnly) { var items = {}; var found = false; - let linkSelector = 'a.c-Button--link[href^="/"][href*=".xml"]'; + let linkSelector = 'a[href^="/"][href*=".xml"]'; let rows = doc.querySelectorAll(`#searchContent ${linkSelector}, .issue-toc ${linkSelector}`); for (let row of rows) { let href = row.href;