commit a5f30a65e6bb7d0edd47c34cb05fbc1bd24b2845 Author: fzzinchemical Date: Sat Dec 6 09:50:25 2025 +0100 Initial Commit diff --git a/locate/Google Scholar.ico b/locate/Google Scholar.ico new file mode 100644 index 0000000..85d0c66 Binary files /dev/null and b/locate/Google Scholar.ico differ diff --git a/locate/engines.json b/locate/engines.json new file mode 100644 index 0000000..b654e5f --- /dev/null +++ b/locate/engines.json @@ -0,0 +1,17 @@ +[ + { + "_name": "Google Scholar", + "_alias": "Untitled", + "_description": "Google Scholar Search", + "_icon": "file:///home/fzzin/Zotero/locate/Google%20Scholar.ico", + "_hidden": false, + "_urlTemplate": "https://scholar.google.com/scholar?as_q=&as_epq={z:title}&as_occt=title&as_sauthors={rft:aufirst?}+{rft:aulast?}&as_ylo={z:year?}&as_yhi={z:year?}&as_sdt=1.&as_sdtp=on&as_sdtf=&as_sdts=22&", + "_urlParams": [], + "_urlNamespaces": { + "rft": "info:ofi/fmt:kev:mtx:journal", + "z": "http://www.zotero.org/namespaces/openSearch#", + "": "http://a9.com/-/spec/opensearch/1.1/" + }, + "_iconSourceURI": "chrome://zotero/skin/logos/google-scholar.ico" + } +] \ No newline at end of file diff --git a/styles/american-chemical-society.csl b/styles/american-chemical-society.csl new file mode 100644 index 0000000..fafb861 --- /dev/null +++ b/styles/american-chemical-society.csl @@ -0,0 +1,302 @@ + + diff --git a/styles/american-medical-association.csl b/styles/american-medical-association.csl new file mode 100644 index 0000000..42a4dcb --- /dev/null +++ b/styles/american-medical-association.csl @@ -0,0 +1,301 @@ + + diff --git a/styles/american-political-science-association.csl b/styles/american-political-science-association.csl new file mode 100644 index 0000000..27c1876 --- /dev/null +++ b/styles/american-political-science-association.csl @@ -0,0 +1,244 @@ + + diff --git a/styles/american-sociological-association.csl b/styles/american-sociological-association.csl new file mode 100644 index 0000000..2c2fe49 --- /dev/null +++ b/styles/american-sociological-association.csl @@ -0,0 +1,370 @@ + + diff --git a/styles/apa.csl b/styles/apa.csl new file mode 100644 index 0000000..9d1dd72 --- /dev/null +++ b/styles/apa.csl @@ -0,0 +1,2133 @@ + + diff --git a/styles/chicago-author-date.csl b/styles/chicago-author-date.csl new file mode 100644 index 0000000..db266cb --- /dev/null +++ b/styles/chicago-author-date.csl @@ -0,0 +1,3924 @@ + + diff --git a/styles/chicago-notes-bibliography.csl b/styles/chicago-notes-bibliography.csl new file mode 100644 index 0000000..5970d82 --- /dev/null +++ b/styles/chicago-notes-bibliography.csl @@ -0,0 +1,5940 @@ + + diff --git a/styles/chicago-shortened-notes-bibliography.csl b/styles/chicago-shortened-notes-bibliography.csl new file mode 100644 index 0000000..85c68cc --- /dev/null +++ b/styles/chicago-shortened-notes-bibliography.csl @@ -0,0 +1,4064 @@ + + diff --git a/styles/elsevier-harvard.csl b/styles/elsevier-harvard.csl new file mode 100644 index 0000000..ea92a9a --- /dev/null +++ b/styles/elsevier-harvard.csl @@ -0,0 +1,238 @@ + + diff --git a/styles/harvard-cite-them-right.csl b/styles/harvard-cite-them-right.csl new file mode 100644 index 0000000..ea5c82a --- /dev/null +++ b/styles/harvard-cite-them-right.csl @@ -0,0 +1,321 @@ + + diff --git a/styles/ieee.csl b/styles/ieee.csl new file mode 100644 index 0000000..8099619 --- /dev/null +++ b/styles/ieee.csl @@ -0,0 +1,512 @@ + + diff --git a/styles/modern-humanities-research-association-notes.csl b/styles/modern-humanities-research-association-notes.csl new file mode 100644 index 0000000..f62d54b --- /dev/null +++ b/styles/modern-humanities-research-association-notes.csl @@ -0,0 +1,3111 @@ + + diff --git a/styles/modern-language-association.csl b/styles/modern-language-association.csl new file mode 100644 index 0000000..dbc8612 --- /dev/null +++ b/styles/modern-language-association.csl @@ -0,0 +1,1221 @@ + + diff --git a/styles/nature.csl b/styles/nature.csl new file mode 100644 index 0000000..5abb666 --- /dev/null +++ b/styles/nature.csl @@ -0,0 +1,189 @@ + + diff --git a/styles/vancouver.csl b/styles/vancouver.csl new file mode 100644 index 0000000..4926bb0 --- /dev/null +++ b/styles/vancouver.csl @@ -0,0 +1,377 @@ + + diff --git a/translators/ABC News Australia.js b/translators/ABC News Australia.js new file mode 100644 index 0000000..edf003c --- /dev/null +++ b/translators/ABC News Australia.js @@ -0,0 +1,224 @@ +{ + "translatorID": "92d45016-5f7b-4bcf-bb63-193033f02f2b", + "label": "ABC News Australia", + "creator": "Joyce Chia", + "target": "https?://(www\\.)?abc\\.net\\.au/news/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-07-23 00:29:10" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2020-2021 Joyce Chia + + 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) { + let contentType = attr(doc, 'meta[property="ABC.ContentType"]', 'content'); + if (contentType == 'CMChannel' && getSearchResults(doc, true)) { + return 'multiple'; + } + else if (contentType == 'Video') { + return 'videoRecording'; + } + else if (contentType == 'Article') { + return 'newspaperArticle'; + } + return false; +} + + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('h3 a'); + for (var i = 0; i < rows.length; i++) { + var href = rows[i].href; + var title = ZU.trimInternal(rows[i].textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (!items) return; + ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', function (obj, item) { + item.language = "en-AU"; + // og:url does not preserve https prefixes, so use canonical link until fixed + var canonical = doc.querySelector('link[rel="canonical"]'); + if (canonical) { + item.url = canonical.href; + } + + if (item.itemType == 'videoRecording') { + item.studio = "ABC News"; // i guess this is correct... + } + else { + item.publicationTitle = "ABC News"; + } + + item.language = "en-AU"; + + if (item.date) { + item.date = ZU.strToISO(item.date); + } + else { + item.date = ZU.strToISO(attr(doc, 'time', 'datetime')); + } + + var authors = text(doc, '[data-component="Byline"] p'); + if (authors && item.creators.length <= 1) { + authors = authors.replace(/^By /, ''); + if (authors == authors.toUpperCase()) { // convert to title case if all caps + authors = ZU.capitalizeTitle(authors, true); + } + item.creators = []; + var authorsList = authors.split(/,|\band\b/); + for (let i = 0; i < authorsList.length; i++) { + item.creators.push(ZU.cleanAuthor(authorsList[i], "author")); + } + } + + item.complete(); + }); + + translator.getTranslatorObject(function (trans) { + trans.itemType = detectWeb(doc, url); + trans.doWeb(doc, url); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.abc.net.au/news/2020-05-22/nt-government-coronavirus-recovery-commission-michael-gunner/12276832?section=politics", + "items": [ + { + "itemType": "newspaperArticle", + "title": "NT 'uniquely positioned' to solve Australia's economic woes post-COVID-19, says Chief Minister", + "creators": [ + { + "firstName": "Lauren", + "lastName": "Roberts", + "creatorType": "author" + } + ], + "date": "2020-05-22", + "abstractNote": "The NT Labor Government establishes a new commission to help it financially recover from the coronavirus pandemic, with the former opposition leader and a former chief minister in key roles.", + "language": "en-AU", + "libraryCatalog": "www.abc.net.au", + "publicationTitle": "ABC News", + "url": "https://www.abc.net.au/news/2020-05-22/nt-government-coronavirus-recovery-commission-michael-gunner/12276832", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "chief minister michael gunner" + }, + { + "tag": "coronavirus budget" + }, + { + "tag": "nt budget" + }, + { + "tag": "parliament house" + }, + { + "tag": "territory economic reconstruction commission" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.abc.net.au/news/2021-07-23/tracey-holmes-on-the-ground-in-tokyo/13467310", + "items": [ + { + "itemType": "videoRecording", + "title": "Tracey Holmes on the ground in Tokyo", + "creators": [ + { + "firstName": "Tracey", + "lastName": "Holmes", + "creatorType": "author" + } + ], + "date": "2021-07-22", + "abstractNote": "Brisbane is named the host of the 2032 Olympics, Tracey speaks with Federal Sports Minister Richard Colbeck to get his reaction. Plus we look at the COVID safety measures athletes, officials and the media are subjected to as they land in the Japanese capital.", + "language": "en-AU", + "libraryCatalog": "www.abc.net.au", + "studio": "ABC News", + "url": "https://www.abc.net.au/news/2021-07-23/tracey-holmes-on-the-ground-in-tokyo/13467310", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "olympics" + }, + { + "tag": "tokyo olympics 2021" + } + ], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/ACLS Humanities EBook.js b/translators/ACLS Humanities EBook.js new file mode 100644 index 0000000..e6f3db6 --- /dev/null +++ b/translators/ACLS Humanities EBook.js @@ -0,0 +1,165 @@ +{ + "translatorID": "2553b683-dc1b-4a1e-833a-7a7755326186", + "label": "ACLS Humanities EBook", + "creator": "Abe Jellinek", + "target": "^https?://www\\.fulcrum\\.org/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-08-03 01:54:15" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (doc.querySelector('meta[name="citation_title"]')) { + return "book"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('.document a'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(text(row, 'h3')); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', function (obj, item) { + item.libraryCatalog = 'ACLS Humanities EBook'; + item.complete(); + }); + + translator.getTranslatorObject(function (trans) { + trans.doWeb(doc, url); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.fulcrum.org/concern/monographs/79408038k?locale=en", + "items": [ + { + "itemType": "book", + "title": "Empire, Architecture, and the City: French-Ottoman Encounters, 1830-1914", + "creators": [ + { + "firstName": "Zeynep", + "lastName": "Celik", + "creatorType": "author" + } + ], + "date": "2008", + "ISBN": "9780295987798", + "language": "en", + "libraryCatalog": "ACLS Humanities EBook", + "publisher": "U of Washington Press", + "shortTitle": "Empire, Architecture, and the City", + "url": "https://hdl.handle.net/2027/heb.33994", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.fulcrum.org/concern/monographs/9z9032224?locale=en", + "items": [ + { + "itemType": "book", + "title": "Black Rock: Mining Folklore of the Pennsylvania Dutch", + "creators": [ + { + "firstName": "George", + "lastName": "Korson", + "creatorType": "author" + } + ], + "date": "1960", + "ISBN": "9780801803451", + "language": "en", + "libraryCatalog": "ACLS Humanities EBook", + "publisher": "Johns Hopkins UP", + "shortTitle": "Black Rock", + "url": "https://hdl.handle.net/2027/heb.33116", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.fulcrum.org/heb?utf8=%E2%9C%93&press=heb&q=istanbul", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/ACLWeb.js b/translators/ACLWeb.js new file mode 100644 index 0000000..6f35052 --- /dev/null +++ b/translators/ACLWeb.js @@ -0,0 +1,600 @@ +{ + "translatorID": "f4a5876a-3e53-40e2-9032-d99a30d7a6fc", + "label": "ACLWeb", + "creator": "Guy Aglionby", + "target": "^https?://(www\\.)?(aclanthology\\.org|aclweb\\.org/anthology)/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2022-11-10 10:36:48" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2018 Guy Aglionby + 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 ***** +*/ + +var ext2mime = { + gz: 'application/gzip', + tgz: 'application/gzip', + pdf: 'application/pdf', + zip: 'application/zip', + tar: 'application/x-tar', + txt: 'text/plain', + rar: 'application/x-rar-compressed', + rtf: 'application/rtf', + bz2: 'application/x-bzip2', + bz: 'application/x-bzip', + doc: 'application/msword', + docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + ppt: 'application/vnd.ms-powerpoint', + pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + xls: 'application/vnd.ms-excel', + xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + html: 'text/html', + png: 'image/png', + gif: 'image/gif', + jpg: 'image/jpeg', + jpeg: 'image/jpeg', + mp4: 'video/mp4', + tsv: 'text/tab-separated-values', + csv: 'text/csv', + py: 'text/x-python', + tex: 'text/x-tex', + bbl: 'text/x-tex' +}; + +function detectWeb(doc, url) { + let paperIdRegex = /([A-Z])\d{2}-\d{4}|\d{4}\.([\w\d]+)-[\w\d]+\.\d+/; + let paperMatch = url.match(paperIdRegex); + if (paperMatch) { + let venue = paperMatch[1] ? paperMatch[1] : paperMatch[2]; + venue = venue.toLowerCase(); + if (venue == 'j' || venue == 'q' || venue == 'tacl' || venue == 'cl') { + return 'journalArticle'; + } + else { + return 'conferencePaper'; + } + } + else if ((url.includes('/events/') || url.includes('/people/') + || url.includes('/volumes/') || url.includes('/search/')) + && getSearchResults(doc, url)) { + return 'multiple'; + } + return false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) === 'multiple') { + Zotero.selectItems(getSearchResults(doc, url), function (selected) { + if (selected) { + ZU.processDocuments(Object.keys(selected), scrape); + } + }); + } + else if (url.endsWith('.bib')) { + let paperURL = url.slice(0, -'.bib'.length); + ZU.processDocuments(paperURL, scrape); + } + else if (url.endsWith('.pdf')) { + // e.g. http://aclweb.org/anthology/P18-1001.pdf + let paperURL = url.slice(0, -'.pdf'.length); + ZU.processDocuments(paperURL, scrape); + } + else { + scrape(doc); + } +} + +function scrape(doc) { + let bibtex = ZU.xpath(doc, '//pre[@id = "citeBibtexContent"]')[0].textContent; + let pdfURL = ZU.xpath(doc, '//a[span[contains(text(), "PDF")]]/@href')[0].value; + let translator = Zotero.loadTranslator("import"); + translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4"); + translator.setString(bibtex); + translator.setHandler("itemDone", function (obj, item) { + item.attachments.push({ + url: pdfURL, + title: 'Full Text PDF', + mimeType: 'application/pdf' + }); + delete item.itemID; + + if (item.date) { + item.date = ZU.strToISO(item.date); + } + + if (item.abstractNote) { + item.abstractNote = ZU.cleanTags(item.abstractNote); + } + + if (item.itemType == 'conferencePaper') { + item.conferenceName = getVenue(doc, item.publicationTitle); + } + + if (Z.getHiddenPref('attachSupplementary')) { + let supplementaries = ZU.xpath(doc, '//div[contains(@class, "acl-paper-link-block")]//a[contains(@class, "btn-attachment")]'); + + supplementaries.forEach(function (supplementary) { + let ext = supplementary.href.split('.').pop(); + let supplementaryMime = Z.getHiddenPref('supplementaryAsLink') ? 'text/html' : ext2mime[ext]; + item.attachments.push({ + url: supplementary.href, + title: supplementary.text, + mimeType: supplementaryMime || 'text/html', + snapshot: !Z.getHiddenPref('supplementaryAsLink') + }); + }); + } + + item.complete(); + }); + translator.translate(); +} + +function getVenue(doc, pubTitle) { + let venueElements = ZU.xpath(doc, '//dt[contains(text(), "Venue")]//following::dd[1]/a'); + let venues = venueElements.map(function (v) { + return v.innerText.trim(); + }); + + if (!venues.length) { + return ''; + } + + let year = ZU.xpath(doc, '//dt[contains(text(), "Year")]/following::dd[1]')[0].textContent; + let venueString = venues.join('-') + ' ' + year; + + if (pubTitle.includes('Student') || pubTitle.includes('Demonstration') || pubTitle.includes('Tutorial')) { + // better to use full proceedingsTitle to cite these publications + return ''; + } + if (venueString.includes('SemEval')) { + if (pubTitle.includes('SENSEVAL')) { + return 'SENSEVAL ' + year; + } + else if (pubTitle.includes('Evaluation') && !pubTitle.includes('Joint')) { + return 'SemEval ' + year; + } + else if (!pubTitle.includes('Evaluation') && pubTitle.includes('Joint')) { + return '*SEM ' + year; + } + else if (pubTitle.includes('Volume 1') && pubTitle.includes('Volume 2')) { + return '*SEM/SemEval ' + year; + } + else if (pubTitle.includes('SemEval')) { + return 'SemEval ' + year; + } + else { + return '*SEM ' + year; + } + } + else if (venueString.includes('WS')) { + // better to use full proceedingsTitle to cite these publications + return ''; + } + else if (!venueString.includes("HLT") && pubTitle.match('HLT|Human Language Technolog(y|ies)')) { + return venues.join('-') + '-HLT ' + year; + } + return venueString; +} + +function getSearchResults(doc, url) { + let items = {}; + if (url.includes('/search/')) { + // e.g. https://www.aclweb.org/anthology/search/?q=foo+bar + let results = ZU.xpath(doc, '//div[contains(@class, "gsc-webResult")]//div[contains(@class, "gs-title")]/a'); + let paperRegex = /[A-Z]\d{2}-\d{4}|\d{4}\.[\w\d]+-[\w\d]+\.\d+/; + for (let result of results) { + let url = result.href; + if (url.match(paperRegex)) { + if (url.endsWith('.pdf')) { + url = url.slice(0, -'.pdf'.length); + } + items[url] = result.text; + } + } + } + else { + let papers = ZU.xpath(doc, '//section[@id="main"]//strong/a'); + for (let paper of papers) { + items[paper.href] = paper.text; + } + } + return Object.keys(items).length ? items : false; +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.aclanthology.org/events/acl-2018/", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.aclanthology.org/volumes/P18-1/", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.aclanthology.org/people/i/iryna-gurevych/", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.aclanthology.org/Q18-1001/", + "items": [ + { + "itemType": "journalArticle", + "title": "Whodunnit? Crime Drama as a Case for Natural Language Understanding", + "creators": [ + { + "firstName": "Lea", + "lastName": "Frermann", + "creatorType": "author" + }, + { + "firstName": "Shay B.", + "lastName": "Cohen", + "creatorType": "author" + }, + { + "firstName": "Mirella", + "lastName": "Lapata", + "creatorType": "author" + } + ], + "date": "2018", + "DOI": "10.1162/tacl_a_00001", + "abstractNote": "In this paper we argue that crime drama exemplified in television programs such as CSI: Crime Scene Investigation is an ideal testbed for approximating real-world natural language understanding and the complex inferences associated with it. We propose to treat crime drama as a new inference task, capitalizing on the fact that each episode poses the same basic question (i.e., who committed the crime) and naturally provides the answer when the perpetrator is revealed. We develop a new dataset based on CSI episodes, formalize perpetrator identification as a sequence labeling problem, and develop an LSTM-based model which learns from multi-modal data. Experimental results show that an incremental inference strategy is key to making accurate guesses as well as learning from representations fusing textual, visual, and acoustic input.", + "libraryCatalog": "ACLWeb", + "pages": "1–15", + "publicationTitle": "Transactions of the Association for Computational Linguistics", + "shortTitle": "Whodunnit?", + "url": "https://www.aclweb.org/anthology/Q18-1001", + "volume": "6", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.aclanthology.org/W04-0801/", + "items": [ + { + "itemType": "conferencePaper", + "title": "The Basque lexical-sample task", + "creators": [ + { + "firstName": "Eneko", + "lastName": "Agirre", + "creatorType": "author" + }, + { + "firstName": "Itziar", + "lastName": "Aldabe", + "creatorType": "author" + }, + { + "firstName": "Mikel", + "lastName": "Lersundi", + "creatorType": "author" + }, + { + "firstName": "David", + "lastName": "Martínez", + "creatorType": "author" + }, + { + "firstName": "Eli", + "lastName": "Pociello", + "creatorType": "author" + }, + { + "firstName": "Larraitz", + "lastName": "Uria", + "creatorType": "author" + } + ], + "date": "2004-07", + "conferenceName": "SENSEVAL 2004", + "libraryCatalog": "ACLWeb", + "pages": "1–4", + "place": "Barcelona, Spain", + "proceedingsTitle": "Proceedings of SENSEVAL-3, the Third International Workshop on the Evaluation of Systems for the Semantic Analysis of Text", + "publisher": "Association for Computational Linguistics", + "url": "https://www.aclweb.org/anthology/W04-0801", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.aclanthology.org/W19-0101/", + "items": [ + { + "itemType": "conferencePaper", + "title": "Can Entropy Explain Successor Surprisal Effects in Reading?", + "creators": [ + { + "firstName": "Marten", + "lastName": "van Schijndel", + "creatorType": "author" + }, + { + "firstName": "Tal", + "lastName": "Linzen", + "creatorType": "author" + } + ], + "date": "2019", + "DOI": "10.7275/qtbb-9d05", + "libraryCatalog": "ACLWeb", + "pages": "1–7", + "proceedingsTitle": "Proceedings of the Society for Computation in Linguistics (SCiL) 2019", + "url": "https://www.aclweb.org/anthology/W19-0101", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.aclanthology.org/N12-2001/", + "items": [ + { + "itemType": "conferencePaper", + "title": "Finding the Right Supervisor: Expert-Finding in a University Domain", + "creators": [ + { + "firstName": "Fawaz", + "lastName": "Alarfaj", + "creatorType": "author" + }, + { + "firstName": "Udo", + "lastName": "Kruschwitz", + "creatorType": "author" + }, + { + "firstName": "David", + "lastName": "Hunter", + "creatorType": "author" + }, + { + "firstName": "Chris", + "lastName": "Fox", + "creatorType": "author" + } + ], + "date": "2012-06", + "libraryCatalog": "ACLWeb", + "pages": "1–6", + "place": "Montréal, Canada", + "proceedingsTitle": "Proceedings of the NAACL HLT 2012 Student Research Workshop", + "publisher": "Association for Computational Linguistics", + "shortTitle": "Finding the Right Supervisor", + "url": "https://www.aclweb.org/anthology/N12-2001", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.aclanthology.org/N18-1001/", + "items": [ + { + "itemType": "conferencePaper", + "title": "Label-Aware Double Transfer Learning for Cross-Specialty Medical Named Entity Recognition", + "creators": [ + { + "firstName": "Zhenghui", + "lastName": "Wang", + "creatorType": "author" + }, + { + "firstName": "Yanru", + "lastName": "Qu", + "creatorType": "author" + }, + { + "firstName": "Liheng", + "lastName": "Chen", + "creatorType": "author" + }, + { + "firstName": "Jian", + "lastName": "Shen", + "creatorType": "author" + }, + { + "firstName": "Weinan", + "lastName": "Zhang", + "creatorType": "author" + }, + { + "firstName": "Shaodian", + "lastName": "Zhang", + "creatorType": "author" + }, + { + "firstName": "Yimei", + "lastName": "Gao", + "creatorType": "author" + }, + { + "firstName": "Gen", + "lastName": "Gu", + "creatorType": "author" + }, + { + "firstName": "Ken", + "lastName": "Chen", + "creatorType": "author" + }, + { + "firstName": "Yong", + "lastName": "Yu", + "creatorType": "author" + } + ], + "date": "2018-06", + "DOI": "10.18653/v1/N18-1001", + "abstractNote": "We study the problem of named entity recognition (NER) from electronic medical records, which is one of the most fundamental and critical problems for medical text mining. Medical records which are written by clinicians from different specialties usually contain quite different terminologies and writing styles. The difference of specialties and the cost of human annotation makes it particularly difficult to train a universal medical NER system. In this paper, we propose a label-aware double transfer learning framework (La-DTL) for cross-specialty NER, so that a medical NER system designed for one specialty could be conveniently applied to another one with minimal annotation efforts. The transferability is guaranteed by two components: (i) we propose label-aware MMD for feature representation transfer, and (ii) we perform parameter transfer with a theoretical upper bound which is also label aware. We conduct extensive experiments on 12 cross-specialty NER tasks. The experimental results demonstrate that La-DTL provides consistent accuracy improvement over strong baselines. Besides, the promising experimental results on non-medical NER scenarios indicate that La-DTL is potential to be seamlessly adapted to a wide range of NER tasks.", + "conferenceName": "NAACL-HLT 2018", + "libraryCatalog": "ACLWeb", + "pages": "1–15", + "place": "New Orleans, Louisiana", + "proceedingsTitle": "Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers)", + "publisher": "Association for Computational Linguistics", + "url": "https://www.aclweb.org/anthology/N18-1001", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.aclanthology.org/2020.lrec-1.2/", + "items": [ + { + "itemType": "conferencePaper", + "title": "A Cluster Ranking Model for Full Anaphora Resolution", + "creators": [ + { + "firstName": "Juntao", + "lastName": "Yu", + "creatorType": "author" + }, + { + "firstName": "Alexandra", + "lastName": "Uma", + "creatorType": "author" + }, + { + "firstName": "Massimo", + "lastName": "Poesio", + "creatorType": "author" + } + ], + "date": "2020-05", + "ISBN": "9791095546344", + "abstractNote": "Anaphora resolution (coreference) systems designed for the CONLL 2012 dataset typically cannot handle key aspects of the full anaphora resolution task such as the identification of singletons and of certain types of non-referring expressions (e.g., expletives), as these aspects are not annotated in that corpus. However, the recently released dataset for the CRAC 2018 Shared Task can now be used for that purpose. In this paper, we introduce an architecture to simultaneously identify non-referring expressions (including expletives, predicative s, and other types) and build coreference chains, including singletons. Our cluster-ranking system uses an attention mechanism to determine the relative importance of the mentions in the same cluster. Additional classifiers are used to identify singletons and non-referring markables. Our contributions are as follows. First all, we report the first result on the CRAC data using system mentions; our result is 5.8% better than the shared task baseline system, which used gold mentions. Second, we demonstrate that the availability of singleton clusters and non-referring expressions can lead to substantially improved performance on non-singleton clusters as well. Third, we show that despite our model not being designed specifically for the CONLL data, it achieves a score equivalent to that of the state-of-the-art system by Kantor and Globerson (2019) on that dataset.", + "conferenceName": "LREC 2020", + "language": "English", + "libraryCatalog": "ACLWeb", + "pages": "11–20", + "place": "Marseille, France", + "proceedingsTitle": "Proceedings of the 12th Language Resources and Evaluation Conference", + "publisher": "European Language Resources Association", + "url": "https://www.aclweb.org/anthology/2020.lrec-1.2", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.aclanthology.org/volumes/2020.lrec-1/", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.aclanthology.org/T87-1010.bib", + "items": [ + { + "itemType": "conferencePaper", + "title": "Unification and the new grammatism", + "creators": [ + { + "firstName": "Steve", + "lastName": "Pulman", + "creatorType": "author" + } + ], + "date": "1987", + "conferenceName": "TINLAP 1987", + "libraryCatalog": "ACLWeb", + "proceedingsTitle": "Theoretical Issues in Natural Language Processing 3", + "url": "https://www.aclweb.org/anthology/T87-1010", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/ACM Digital Library.js b/translators/ACM Digital Library.js new file mode 100644 index 0000000..dea6d23 --- /dev/null +++ b/translators/ACM Digital Library.js @@ -0,0 +1,710 @@ +{ + "translatorID": "f3f092bf-ae09-4be6-8855-a22ddd817925", + "label": "ACM Digital Library", + "creator": "Guy Aglionby", + "target": "^https://dl\\.acm\\.org/(doi|do|profile|toc|topic|keyword|action/doSearch|acmbooks|browse)", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2024-07-30 05:19:59" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2019 Guy Aglionby + 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) { + if (isContentUrl(url)) { + let subtypeMatch = getItemSubtype(doc); + if (!subtypeMatch) { + return 'journalArticle'; + } + let subtype = subtypeMatch[1].toLowerCase(); + + if (subtype == 'conference') { + return 'conferencePaper'; + } + else if (subtype == 'journal' || subtype == 'periodical' || subtype == 'magazine' || subtype == 'newsletter') { + return 'journalArticle'; + } + else if (subtype == 'report' || subtype == 'rfc') { + return 'report'; + } + else if (subtype == 'thesis') { + return 'thesis'; + } + else if (subtype == 'software') { + return 'computerProgram'; + } + else if (subtype == 'dataset') { + return 'document'; + } + else if (subtype == 'book') { + let bookTypeRegex = /page:string:([\w ]+)/; + let extractedContext = attr(doc, 'meta[name=pbContext]', 'content'); + let bookType = extractedContext.match(bookTypeRegex); + if (bookType && bookType[1].toLowerCase() == 'book page') { + return 'book'; + } + else { + return 'bookSection'; + } + } + return 'journalArticle'; + } + else if (getSearchResults(doc, false)) { + return 'multiple'; + } + return false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == 'multiple') { + Zotero.selectItems(getSearchResults(doc), function (selected) { + if (selected) { + ZU.processDocuments(Object.keys(selected), scrape); + } + }); + } + else { + scrape(doc); + } +} + +function getItemSubtype(doc) { + let extractedContext = attr(doc, 'meta[name=pbContext]', 'content'); + let subtypeRegex = /csubtype:string:(\w+)/; + return extractedContext.match(subtypeRegex); +} + +function isContentUrl(url) { + return (url.includes('/doi/') || url.includes('/do/')) && !url.includes('/doi/proceedings'); +} + +function getSearchResults(doc, checkOnly) { + let items = {}; + let found = false; + let results = doc.querySelectorAll('h5.issue-item__title a'); + + for (let i = 0; i < results.length; i++) { + let url = results[i].href; + let title = ZU.trimInternal(results[i].textContent); + if (!title || !url) { + continue; + } + + if (!isContentUrl(url)) { + continue; + } + + if (checkOnly) { + return true; + } + found = true; + items[url] = title; + } + + return found ? items : false; +} + +function scrape(doc) { + let doi = attr(doc, 'input[name=doiVal]', 'value'); + let lookupEndpoint = 'https://dl.acm.org/action/exportCiteProcCitation'; + let postBody = 'targetFile=custom-bibtex&format=bibTex&dois=' + encodeURIComponent(doi); + + ZU.doPost(lookupEndpoint, postBody, function (returnedText) { + let json = JSON.parse(returnedText); + let cslItem = json.items[0][doi]; + cslItem.type = cslItem.type.toLowerCase().replace('_', '-'); + + // Some pages use ARTICLE rather than ARTICLE_JOURNAL + // https://github.com/zotero/translators/issues/2162 + if (cslItem.type == 'article') { + cslItem.type = 'article-journal'; + } + else if (cslItem.type == 'thesis') { + // The advisor is indicated as an editor in CSL which + // ZU.itemFromCSLJSON incorrectly extracts as an author. + delete cslItem.editor; + // The (co-)chair(s) or supervisor(s) are included in CSL as additional authors. + cslItem.author.splice(1); + } + + if (cslItem.source && (cslItem.source.includes('19') || cslItem.source.includes('20'))) { + // Issue date sometimes goes in source (libraryCatalog) + delete cslItem.source; + } + + let item = new Zotero.Item(); + ZU.itemFromCSLJSON(item, cslItem); + + item.title = ZU.unescapeHTML(item.title); + + let abstractElements = doc.querySelectorAll('div.article__abstract p, div.abstractSection p'); + let abstract = Array.from(abstractElements).map(x => x.textContent).join('\n\n'); + if (abstract.length && abstract.toLowerCase() != 'no abstract available.') { + item.abstractNote = ZU.trimInternal(abstract); + } + + let pdfElement = doc.querySelector('a[title="View PDF"]'); + if (pdfElement) { + item.attachments.push({ + url: pdfElement.href, + title: 'Full Text PDF', + mimeType: 'application/pdf' + }); + if (item.DOI) { + item.url = 'https://dl.acm.org/doi/' + ZU.cleanDOI(item.DOI); + } + } + + if (item.itemType == 'journalArticle') { + // Publication name in the CSL is shortened; scrape from page to get full title. + let expandedTitle = text(doc, 'span.epub-section__title'); + if (expandedTitle) { + item.journalAbbreviation = item.publicationTitle; + item.publicationTitle = expandedTitle; + } + // Article number 46 --> pages = 46:1–46:22 + if (cslItem.number) { + let number = cslItem.number.replace("Article", "").trim(); + if (item.pages) { + item.pages = item.pages.split("–").map(x => number + ":" + x).join("–"); + } + else { + item.pages = number; + } + } + } + + if (!item.creators.length) { + // There are cases where authors are not included in the CSL + // (for example, a chapter of a book) so we must scrape them. + // e.g. https://dl.acm.org/doi/abs/10.5555/3336323.C5474411 + let authorElements = doc.querySelectorAll('div.citation span.loa__author-name'); + authorElements.forEach(function (element) { + item.creators.push(ZU.cleanAuthor(element.textContent, 'author')); + }); + } + + if (!item.ISBN && cslItem.ISBN) { + let isbnLength = cslItem.ISBN.replace('-', '').length; + let isbnText = 'ISBN-' + isbnLength + ': ' + cslItem.ISBN; + item.extra = item.extra ? item.extra + '\n' + isbnText : isbnText; + } + + let numPages = text(doc, 'div.pages-info span'); + if (numPages && !item.numPages) { + item.numPages = numPages; + } + + let tagElements = doc.querySelectorAll('div.tags-widget a'); + tagElements.forEach(function (tag) { + item.tags.push(tag.textContent); + }); + + if (getItemSubtype(doc) == 'dataset') { + item.extra = item.extra ? item.extra + '\nitemType: data' : 'itemType: data'; + } + + delete item.callNumber; + + item.complete(); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://dl.acm.org/doi/abs/10.1145/1596655.1596682", + "detectedItemType": "conferencePaper", + "items": [ + { + "itemType": "conferencePaper", + "title": "Tracking performance across software revisions", + "creators": [ + { + "lastName": "Mostafa", + "firstName": "Nagy", + "creatorTypeID": 8, + "creatorType": "author" + }, + { + "lastName": "Krintz", + "firstName": "Chandra", + "creatorTypeID": 8, + "creatorType": "author" + } + ], + "date": "August 27, 2009", + "DOI": "10.1145/1596655.1596682", + "ISBN": "9781605585987", + "abstractNote": "Repository-based revision control systems such as CVS, RCS, Subversion, and GIT, are extremely useful tools that enable software developers to concurrently modify source code, manage conflicting changes, and commit updates as new revisions. Such systems facilitate collaboration with and concurrent contribution to shared source code by large developer bases. In this work, we investigate a framework for \"performance-aware\" repository and revision control for Java programs. Our system automatically tracks behavioral differences across revisions to provide developers with feedback as to how their change impacts performance of the application. It does so as part of the repository commit process by profiling the performance of the program or component, and performing automatic analyses that identify differences in the dynamic behavior or performance between two code revisions. In this paper, we present our system that is based upon and extends prior work on calling context tree (CCT) profiling and performance differencing. Our framework couples the use of precise CCT information annotated with performance metrics and call-site information, with a simple tree comparison technique and novel heuristics that together target the cause of performance differences between code revisions without knowledge of program semantics. We evaluate the efficacy of the framework using a number of open source Java applications and present a case study in which we use the framework to distinguish two revisions of the popular FindBugs application.", + "itemID": "10.1145/1596655.1596682", + "libraryCatalog": "ACM Digital Library", + "pages": "162–171", + "place": "New York, NY, USA", + "proceedingsTitle": "Proceedings of the 7th International Conference on Principles and Practice of Programming in Java", + "publisher": "Association for Computing Machinery", + "series": "PPPJ '09", + "url": "https://dl.acm.org/doi/10.1145/1596655.1596682", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "calling context tree" + }, + { + "tag": "performance-aware revision control" + }, + { + "tag": "profiling" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://dl.acm.org/doi/10.5555/1717186", + "detectedItemType": "book", + "items": [ + { + "itemType": "book", + "title": "Version Control with Git: Powerful Tools and Techniques for Collaborative Software Development", + "creators": [ + { + "lastName": "Loeliger", + "firstName": "Jon", + "creatorTypeID": 8, + "creatorType": "author" + } + ], + "date": "2009", + "ISBN": "9780596520120", + "abstractNote": "Version Control with Git takes you step-by-step through ways to track, merge, and manage software projects, using this highly flexible, open source version control system. Git permits virtually an infinite variety of methods for development and collaboration. Created by Linus Torvalds to manage development of the Linux kernel, it's become the principal tool for distributed version control. But Git's flexibility also means that some users don't understand how to use it to their best advantage. Version Control with Git offers tutorials on the most effective ways to use it, as well as friendly yet rigorous advice to help you navigate Git's many functions. With this book, you will: Learn how to use Git in several real-world development environments Gain insight into Git's common-use cases, initial tasks, and basic functions Understand how to use Git for both centralized and distributed version control Use Git to manage patches, diffs, merges, and conflicts Acquire advanced techniques such as rebasing, hooks, and ways to handle submodules (subprojects) Learn how to use Git with Subversion Git has earned the respect of developers around the world. Find out how you can benefit from this amazing tool with Version Control with Git.", + "edition": "1st", + "itemID": "10.5555/1717186", + "libraryCatalog": "ACM Digital Library", + "numPages": "336", + "publisher": "O'Reilly Media, Inc.", + "shortTitle": "Version Control with Git", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://dl.acm.org/doi/abs/10.1023/A:1008286901817", + "detectedItemType": "journalArticle", + "items": [ + { + "itemType": "journalArticle", + "title": "Simulation Techniques for the Manufacturing Test of MCMs", + "creators": [ + { + "lastName": "Tegethoff", + "firstName": "Mick", + "creatorTypeID": 8, + "creatorType": "author" + }, + { + "lastName": "Chen", + "firstName": "Tom", + "creatorTypeID": 8, + "creatorType": "author" + } + ], + "date": "February 1, 1997", + "DOI": "10.1023/A:1008286901817", + "ISSN": "0923-8174", + "abstractNote": "Simulation techniques used in the Manufacturing Test SIMulator (MTSIM) are described. MTSIM is a Concurrent Engineering tool used to simulate the manufacturing test and repair aspects of boards and MCMs from design concept through manufacturing release. MTSIM helps designers select assembly process, specify Design For Test (DFT) features, select board test coverage, specify ASIC defect level goals, establish product feasibility, and predict manufacturing quality and cost goals. A new yield model for boards and MCMs which accounts for the clustering of solder defects is introduced and used to predict the yield at each test step. In addition, MTSIM estimates the average number of defects per board detected at each test step, and estimates costs incurred in test execution, fault isolation and repair. MTSIM models were validated with high performance assemblies at Hewlett-Packard (HP).", + "issue": "1-2", + "itemID": "10.1023/A:1008286901817", + "journalAbbreviation": "J. Electron. Test.", + "libraryCatalog": "ACM Digital Library", + "pages": "137–149", + "publicationTitle": "Journal of Electronic Testing: Theory and Applications", + "url": "https://doi.org/10.1023/A:1008286901817", + "volume": "10", + "attachments": [], + "tags": [ + { + "tag": "DFM" + }, + { + "tag": "DFT" + }, + { + "tag": "MCM" + }, + { + "tag": "SMT" + }, + { + "tag": "board" + }, + { + "tag": "simulation" + }, + { + "tag": "test" + }, + { + "tag": "yield" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://dl.acm.org/doi/abs/10.1145/258948.258973", + "detectedItemType": "conferencePaper", + "items": [ + { + "itemType": "conferencePaper", + "title": "Functional reactive animation", + "creators": [ + { + "lastName": "Elliott", + "firstName": "Conal", + "creatorTypeID": 8, + "creatorType": "author" + }, + { + "lastName": "Hudak", + "firstName": "Paul", + "creatorTypeID": 8, + "creatorType": "author" + } + ], + "date": "August 1, 1997", + "DOI": "10.1145/258948.258973", + "ISBN": "9780897919180", + "abstractNote": "Fran (Functional Reactive Animation) is a collection of data types and functions for composing richly interactive, multimedia animations. The key ideas in Fran are its notions of behaviors and events. Behaviors are time-varying, reactive values, while events are sets of arbitrarily complex conditions, carrying possibly rich information. Most traditional values can be treated as behaviors, and when images are thus treated, they become animations. Although these notions are captured as data types rather than a programming language, we provide them with a denotational semantics, including a proper treatment of real time, to guide reasoning and implementation. A method to effectively and efficiently perform event detection using interval analysis is also described, which relies on the partial information structure on the domain of event times. Fran has been implemented in Hugs, yielding surprisingly good performance for an interpreter-based system. Several examples are given, including the ability to describe physical phenomena involving gravity, springs, velocity, acceleration, etc. using ordinary differential equations.", + "itemID": "10.1145/258948.258973", + "libraryCatalog": "ACM Digital Library", + "pages": "263–273", + "place": "New York, NY, USA", + "proceedingsTitle": "Proceedings of the second ACM SIGPLAN international conference on Functional programming", + "publisher": "Association for Computing Machinery", + "series": "ICFP '97", + "url": "https://dl.acm.org/doi/10.1145/258948.258973", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://dl.acm.org/doi/abs/10.1145/2566617", + "detectedItemType": "journalArticle", + "items": [ + { + "itemType": "journalArticle", + "title": "Check-ins in “Blau Space”: Applying Blau’s Macrosociological Theory to Foursquare Check-ins from New York City", + "creators": [ + { + "lastName": "Joseph", + "firstName": "Kenneth", + "creatorTypeID": 8, + "creatorType": "author" + }, + { + "lastName": "Carley", + "firstName": "Kathleen M.", + "creatorTypeID": 8, + "creatorType": "author" + }, + { + "lastName": "Hong", + "firstName": "Jason I.", + "creatorTypeID": 8, + "creatorType": "author" + } + ], + "date": "September 18, 2014", + "DOI": "10.1145/2566617", + "ISSN": "2157-6904", + "abstractNote": "Peter Blau was one of the first to define a latent social space and utilize it to provide concrete hypotheses. Blau defines social structure via social “parameters” (constraints). Actors that are closer together (more homogenous) in this social parameter space are more likely to interact. One of Blau’s most important hypotheses resulting from this work was that the consolidation of parameters could lead to isolated social groups. For example, the consolidation of race and income might lead to segregation. In the present work, we use Foursquare data from New York City to explore evidence of homogeneity along certain social parameters and consolidation that breeds social isolation in communities of locations checked in to by similar users. More specifically, we first test the extent to which communities detected via Latent Dirichlet Allocation are homogenous across a set of four social constraints—racial homophily, income homophily, personal interest homophily and physical space. Using a bootstrapping approach, we find that 14 (of 20) communities are statistically, and all but one qualitatively, homogenous along one of these social constraints, showing the relevance of Blau’s latent space model in venue communities determined via user check-in behavior. We then consider the extent to which communities with consolidated parameters, those homogenous on more than one parameter, represent socially isolated populations. We find communities homogenous on multiple parameters, including a homosexual community and a “hipster” community, that show support for Blau’s hypothesis that consolidation breeds social isolation. We consider these results in the context of mediated communication, in particular in the context of self-representation on social media.", + "issue": "3", + "itemID": "10.1145/2566617", + "journalAbbreviation": "ACM Trans. Intell. Syst. Technol.", + "libraryCatalog": "ACM Digital Library", + "pages": "46:1–46:22", + "publicationTitle": "ACM Transactions on Intelligent Systems and Technology", + "shortTitle": "Check-ins in “Blau Space”", + "url": "https://dl.acm.org/doi/10.1145/2566617", + "volume": "5", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Foursquare" + }, + { + "tag": "community structure" + }, + { + "tag": "latent social space" + }, + { + "tag": "urban analytics" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://dl.acm.org/doi/abs/10.5555/3336323.C5474411", + "detectedItemType": "bookSection", + "items": [ + { + "itemType": "bookSection", + "title": "2007--2016", + "creators": [ + { + "firstName": "Peter A.", + "lastName": "Freeman", + "creatorType": "author" + }, + { + "firstName": "W. Richards", + "lastName": "Adrion", + "creatorType": "author" + }, + { + "firstName": "William", + "lastName": "Aspray", + "creatorType": "author" + } + ], + "date": "November 20, 2019", + "ISBN": "9781450372763", + "abstractNote": "This organizational history relates the role of the National Science Foundation (NSF) in the development of modern computing. Drawing upon new and existing oral histories, extensive use of NSF documents, and the experience of two of the authors as senior managers, this book describes how NSF's programmatic activities originated and evolved to become the primary source of funding for fundamental research in computing and information technologies.The book traces how NSF's support has provided facilities and education for computing usage by all scientific disciplines, aided in institution and professional community building, supported fundamental research in computer science and allied disciplines, and led the efforts to broaden participation in computing by all segments of society.Today, the research and infrastructure facilitated by NSF computing programs are significant economic drivers of American society and industry. For example, NSF supported work that led to the first widelyused web browser, Netscape; sponsored the creation of algorithms at the core of the Google search engine; facilitated the growth of the public Internet; and funded research on the scientific basis for countless other applications and technologies. NSF has advanced the development of human capital and ideas for future advances in computing and its applications.This account is the first comprehensive coverage of NSF's role in the extraordinary growth and expansion of modern computing and its use. It will appeal to historians of computing, policy makers and leaders in government and academia, and individuals interested in the history and development of computing and the NSF.", + "bookTitle": "Computing and the National Science Foundation, 1950--2016: Building a Foundation for Modern Computing", + "itemID": "10.5555/3336323.C5474411", + "libraryCatalog": "ACM Digital Library", + "place": "New York, NY, USA", + "publisher": "Association for Computing Machinery", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://dl.acm.org/doi/10.1145/3264631.3264634", + "detectedItemType": "journalArticle", + "items": [ + { + "itemType": "journalArticle", + "title": "Beyond screen and voice: augmenting aural navigation with screenless access", + "creators": [ + { + "lastName": "Gross", + "firstName": "Mikaylah", + "creatorTypeID": 8, + "creatorType": "author" + }, + { + "lastName": "Bolchini", + "firstName": "Davide", + "creatorTypeID": 8, + "creatorType": "author" + } + ], + "date": "August 2, 2018", + "DOI": "10.1145/3264631.3264634", + "ISSN": "1558-2337", + "abstractNote": "The current interaction paradigm to access the mobile web forces people who are blind to hold out their phone at all times, thus increasing the risk for the device to fall or be robbed. Moreover, such continuous, two-handed interaction on a small screen hampers the ability of people who are blind to keep their hands free to control aiding devices (e.g., cane) or touch objects nearby, especially on-the-go. To investigate alternative paradigms, we are exploring and reifying strategies for \"screenless access\": a browsing approach that enables users to interact touch-free with aural navigation architectures using one-handed, in-air gestures recognized by an off-the-shelf armband. In this article, we summarize key highlights from an exploratory study with ten participants who are blind or visually impaired who experienced our screenless access prototype. We observed proficient navigation performance after basic training, users conceptual fit with a screen-free paradigm, and low levels of cognitive load, notwithstanding the errors and limits of the design and system proposed. The full paper appeared in W4A2018 [1].", + "issue": "121", + "itemID": "10.1145/3264631.3264634", + "journalAbbreviation": "SIGACCESS Access. Comput.", + "libraryCatalog": "ACM Digital Library", + "pages": "3:1", + "publicationTitle": "ACM SIGACCESS Accessibility and Computing", + "shortTitle": "Beyond screen and voice", + "url": "https://doi.org/10.1145/3264631.3264634", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://dl.acm.org/doi/10.1145/2854146", + "detectedItemType": "journalArticle", + "items": [ + { + "itemType": "journalArticle", + "title": "Why Google stores billions of lines of code in a single repository", + "creators": [ + { + "lastName": "Potvin", + "firstName": "Rachel", + "creatorTypeID": 8, + "creatorType": "author" + }, + { + "lastName": "Levenberg", + "firstName": "Josh", + "creatorTypeID": 8, + "creatorType": "author" + } + ], + "date": "June 24, 2016", + "DOI": "10.1145/2854146", + "ISSN": "0001-0782", + "abstractNote": "Google's monolithic repository provides a common source of truth for tens of thousands of developers around the world.", + "issue": "7", + "itemID": "10.1145/2854146", + "journalAbbreviation": "Commun. ACM", + "libraryCatalog": "ACM Digital Library", + "pages": "78–87", + "publicationTitle": "Communications of the ACM", + "url": "https://dl.acm.org/doi/10.1145/2854146", + "volume": "59", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://dl.acm.org/doi/book/10.5555/1087674", + "detectedItemType": "thesis", + "items": [ + { + "itemType": "thesis", + "title": "A \"void-trimming\" methodology of generating shrink-wrapped mesh for component-based complex \"dirty\" geometry", + "creators": [ + { + "lastName": "Yuan", + "firstName": "Wei", + "creatorTypeID": 8, + "creatorType": "author" + } + ], + "date": "2005", + "abstractNote": "The geometric surface model generated by common CAD tools is often “dirty” (cracks, small gaps, small holes, surface penetration, inconsistent surface orientation, bad edge-face connectivity, etc.). Also, problems of component overlapping, island components, and patch duplication exist in a component-based system. The process of traditional geometric healing and repairing methods is time-consuming (weeks or months), and often time fails when dealing with a complex “dirty” geometric model. In this dissertation, a new methodology based on “void volume trimming” is presented to resolve problems stated above. The meshing process starts from generating a Cartesian volume mesh using the 2 N tree (instead of the traditional Octree) data structure. With this structure, several mesh adaptation methods based on geometric features coupled with a smoothing algorithm between neighbor cells are developed to generate the preferred mesh sizes at desired regions while ensuring the gradual transition between dense and coarse meshes. In the process of constructing surface mesh for “dirty” geometric components, an effective “surface orientation free” algorithm is proposed. For resolving of “mesh leak” at cracks and small gap regions, the continuous “intersecting cell” set is used instead of geometric surfaces as the domain bound. The major contribution of this dissertation is the development of “void volume trimming” algorithm. With this methodology, the watertight feature can be promised, and the axis-aligned surface mesh is gradually adjusted to be geometric aligned while maintaining high mesh quality. Meanwhile, the surface mesh is pushed towards the geometry for satisfaction of mapping criteria. The constrained smoothing algorithm presented in this dissertation further improves the mesh quality while shrinking the surface mesh closer to geometry components. At the same time, the use of the SPP (Shortest Path Projection) algorithm coupled with the ADT (Alternating Digital Tree) data structure has been shown that it is efficient when generating body-fitted surface meshes for complex “dirty” geometries while maintaining high performance. The present critical feature preservation method has shown its capability of capturing the detailed features, while the introduced patch mapping method can topologically maintain the geometric model property. Case studies and application results have demonstrated that the current methodology is efficient for handling the component-based complex “dirty” geometric model.", + "extra": "AAI3164056\nISBN-10: 0496987127", + "itemID": "10.5555/1087674", + "libraryCatalog": "ACM Digital Library", + "numPages": "118", + "place": "USA", + "thesisType": "phd", + "university": "University of Alabama in Huntsville", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://dl.acm.org/profile/81460641152/publications?Role=author", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dl.acm.org/toc/interactions/2016/24/1", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dl.acm.org/topic/ccs2012/10010147.10010341.10010342.10010343", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dl.acm.org/doi/proceedings/10.1145/2342541", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dl.acm.org/keyword/pesq", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dl.acm.org/action/doSearch?AllField=Zotero", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dl.acm.org/browse/book", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dl.acm.org/subject/mobile", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/ACM Queue.js b/translators/ACM Queue.js new file mode 100644 index 0000000..bd7c4c7 --- /dev/null +++ b/translators/ACM Queue.js @@ -0,0 +1,391 @@ +{ + "translatorID": "212ffcc8-927c-4e84-a097-bd24fd4a44b6", + "translatorType": 4, + "label": "ACM Queue", + "creator": "Bogdan Lynn", + "target": "^https://queue\\.acm\\.org/", + "minVersion": "5.0", + "maxVersion": null, + "priority": 100, + "inRepository": true, + "browserSupport": "gcsibv", + "lastUpdated": "2025-12-04 20:10:00" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2025 Bogdan Lynn + + 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) { + if (url.includes('detail.cfm?id=')) { + return 'journalArticle'; + } + else if (getSearchResults(doc, true)) { + return 'multiple'; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('a[href*="detail.cfm?id="]'); + for (let row of rows) { + let href = row.href; + // Skip links to specific parts of the article, like #comments, + // since those normally appear below the actual top-level link + if (href.includes("#")) continue; + 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) { + // DOI can be found in the URL of the PDF link + let pdfUrl = doc.querySelector('a[href*="/doi/pdf"]'); + let doi = pdfUrl.href.split("/pdf/")[1]; + let translate = Zotero.loadTranslator("search"); + // DOI Content Negotiation translator + translate.setTranslator("b28d0d42-8549-4c6d-83fc-8382874a5cb9"); + translate.setSearch({ itemType: "journalArticle", DOI: doi }); + + // Do nothing on error + translate.setHandler("error", () => {}); + translate.setHandler("itemDone", (obj, item) => { + item.publicationTitle = "ACM Queue"; + item.publisher = "Association for Computing Machinery"; + + // 'DOI Content Negotiation' translator does not add attachments + let pdfUrl = doc.querySelector('a[href*="/doi/pdf"]'); + item.attachments.push({ + url: pdfUrl.href, + title: 'Full Text PDF', + mimeType: 'application/pdf' + }); + item.complete(); + }); + + // Try to resolve the DOI, and if it does not work, scrape the DOM. + try { + await translate.translate(); + return; + } + catch (e) { + Zotero.debug(`Failed to resolve DOI. Scrape the page.`); + } + await scrapeDocument(doc, url); +} + + +async function scrapeDocument(doc, url) { + let item = new Zotero.Item("journalArticle"); + item.title = text(doc, "h1"); + item.publicationTitle = "ACM Queue"; + item.publisher = "Association for Computing Machinery"; + item.journalAbbreviation = "Queue"; + item.language = "en"; + item.ISSN = "1542-7730"; + item.url = url; + + // Extract volume and issue from "Volume X, issue Y" at the top + let descriptor = text(doc, ".descriptor").toLowerCase(); + let re = /^volume\s+(\d+),\s*issue\s+(\d+)\s*$/i; + let matches = descriptor.match(re) || []; + item.volume = matches[1]; + item.issue = matches[2]; + + // Add PDF attachment and DOI + let pdfUrl = doc.querySelector('a[href*="/doi/pdf"]'); + let doi = pdfUrl.href.split("/pdf/")[1]; + item.DOI = doi; + item.attachments.push({ + url: pdfUrl.href, + title: 'Full Text PDF', + mimeType: 'application/pdf' + }); + + // Some info needs to be fetched from the page of the entire issue + // because it appears in difference places on the article page + let issueDoc = await requestDocument(attr(doc, ".descriptor", "href")); + + // Fetch date + let dateContainer = text(issueDoc, "#lead p"); + let date = dateContainer.split(" ").slice(-2).join(" "); + if (date.includes("/")) { + date = date.split("/")[1]; + } + item.date = date; + + // Find link to the article on the page of the issue + let searchParams = new URLSearchParams(url.split("?")[1]); + let id = searchParams.get("id"); + let articleLinkOnissueDoc = issueDoc.querySelector(`a[href*="detail.cfm?id=${id}"]`); + // Fetch abstract below the link + item.abstractNote = articleLinkOnissueDoc.parentNode.nextElementSibling.textContent; + // Fetch creators below the abstract + let potentialAuthors = articleLinkOnissueDoc.parentNode.nextElementSibling.nextElementSibling; + if (potentialAuthors?.classList.contains("meta")) { + let creators = potentialAuthors.textContent.split(","); + for (let creator of creators) { + item.creators.push(ZU.cleanAuthor(creator, "author")); + } + } + + item.complete(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://queue.acm.org/detail.cfm?id=3664275", + "items": [ + { + "itemType": "journalArticle", + "title": "Make Two Trips: Larry David's New Year's resolution works for IT too.", + "creators": [ + { + "creatorType": "author", + "firstName": "Thomas A.", + "lastName": "Limoncelli" + } + ], + "date": "2024-04-30", + "DOI": "10.1145/3664275", + "ISSN": "1542-7730, 1542-7749", + "abstractNote": "Whether your project is as simple as carrying groceries into the house or as complex as a multiyear engineering project, \"make two trips\" can simplify the project, reduce the chance of error, improve the probability of success, and lead to easier explanations.", + "issue": "2", + "journalAbbreviation": "Queue", + "language": "en", + "libraryCatalog": "DOI.org (Crossref)", + "pages": "5-14", + "publicationTitle": "ACM Queue", + "shortTitle": "Make Two Trips", + "url": "https://dl.acm.org/doi/10.1145/3664275", + "volume": "22", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://queue.acm.org/detail.cfm?id=3762991", + "items": [ + { + "itemType": "journalArticle", + "title": "Understanding the Harm Teens Experience on Social Media", + "creators": [ + { + "firstName": "Arturo", + "lastName": "Béjar", + "creatorType": "author" + } + ], + "date": "August 2025", + "DOI": "10.1145/3762991", + "ISSN": "1542-7730", + "abstractNote": "The current approach to online safety, focusing on objectively harmful content and deletion or downranking, is necessary but not sufficient, as it addresses only a small fraction of the harm that teens experience. In order to understand harm, it is essential to understand it from their perspective by surveying and creating safety tools and reporting that make it easy to capture what happens and provide immediate help. Many of the recommendations in this article come from what you learn when you analyze behavioral correlates: that you need approaches that rely on conduct in context, better personalization, and providing feedback to actors.", + "issue": "4", + "journalAbbreviation": "Queue", + "language": "en", + "libraryCatalog": "ACM Queue", + "publicationTitle": "ACM Queue", + "url": "https://queue.acm.org/detail.cfm?id=3762991", + "volume": "23", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://queue.acm.org/detail.cfm?id=3546935", + "items": [ + { + "itemType": "journalArticle", + "title": "I'm Probably Less Deterministic Than I Used to Be: Embracing randomness is necessary in cloud environments.", + "creators": [ + { + "creatorType": "author", + "firstName": "Pat", + "lastName": "Helland" + } + ], + "date": "2022-06-30", + "DOI": "10.1145/3546935", + "ISSN": "1542-7730, 1542-7749", + "abstractNote": "In my youth, I thought the universe was ruled by cause and effect like a big clock. In this light, computing made sense. Now I see that both life and computing can be a crapshoot, and that has given me a new peace.", + "issue": "3", + "journalAbbreviation": "Queue", + "language": "en", + "libraryCatalog": "DOI.org (Crossref)", + "pages": "5-13", + "publicationTitle": "ACM Queue", + "shortTitle": "I'm Probably Less Deterministic Than I Used to Be", + "url": "https://dl.acm.org/doi/10.1145/3546935", + "volume": "20", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://queue.acm.org/detail.cfm?id=3501293", + "items": [ + { + "itemType": "journalArticle", + "title": "Federated Learning and Privacy", + "creators": [ + { + "firstName": "Kallista", + "lastName": "Bonawitz", + "creatorType": "author" + }, + { + "firstName": "Peter", + "lastName": "Kairouz", + "creatorType": "author" + }, + { + "firstName": "Brendan", + "lastName": "McMahan", + "creatorType": "author" + }, + { + "firstName": "Daniel", + "lastName": "Ramage", + "creatorType": "author" + } + ], + "date": "September-October 2021", + "DOI": "10.1145/3494834.3501293", + "ISSN": "1542-7730", + "abstractNote": "Centralized data collection can expose individuals to privacy risks and organizations to legal risks if data is not properly managed. Federated learning is a machine learning setting where multiple entities collaborate in solving a machine learning problem, under the coordination of a central server or service provider. Each client's raw data is stored locally and not exchanged or transferred; instead, focused updates intended for immediate aggregation are used to achieve the learning objective. This article provides a brief introduction to key concepts in federated learning and analytics with an emphasis on how privacy technologies may be combined in real-world systems and how their use charts a path toward societal benefit from aggregate statistics in new domains and with minimized risk to individuals and to the organizations who are custodians of the data.", + "issue": "5", + "journalAbbreviation": "Queue", + "language": "en", + "libraryCatalog": "ACM Queue", + "publicationTitle": "ACM Queue", + "url": "https://queue.acm.org/detail.cfm?id=3501293", + "volume": "19", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://queue.acm.org/detail.cfm?id=3773095", + "items": [ + { + "itemType": "journalArticle", + "title": "Memory Safety for Skeptics", + "creators": [ + { + "firstName": "Andrew Lilley", + "lastName": "Brinker", + "creatorType": "author" + } + ], + "date": "October 2025", + "DOI": "10.1145/3773095", + "ISSN": "1542-7730", + "abstractNote": "The state of possibility with memory safety today is similar to the state of automobile safety just prior to the widespread adoption of mandatory seat-belt laws. As car manufacturers began to integrate seat belts as a standard feature across their model lines and states began to require that drivers wear seat belts while driving, the rate of traffic fatalities and severity of traffic-related injuries dropped drastically. Seat belts did not solve automobile safety, but they credibly improved it, and at remarkably low cost.", + "issue": "5", + "journalAbbreviation": "Queue", + "language": "en", + "libraryCatalog": "ACM Queue", + "publicationTitle": "ACM Queue", + "url": "https://queue.acm.org/detail.cfm?id=3773095", + "volume": "23", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://queue.acm.org/issuedetail.cfm?issue=2838344", + "items": "multiple" + }, + { + "type": "web", + "url": "https://queue.acm.org/listing.cfm?item_topic=Blockchain&qc_type=theme_list&filter=Blockchain&page_title=Blockchain&order=desc", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/ACS Publications.js b/translators/ACS Publications.js new file mode 100644 index 0000000..a8578e1 --- /dev/null +++ b/translators/ACS Publications.js @@ -0,0 +1,633 @@ +{ + "translatorID": "938ebe32-2b2e-4349-a5b3-b3a05d3de627", + "label": "ACS Publications", + "creator": "Sean Takats, Michael Berkowitz, Santawort, and Aurimas Vinckevicius", + "target": "^https?://pubs\\.acs\\.org/(toc/|journal/|topic/|isbn/\\d|doi/(full/|abs/|epdf/|book/)?10\\.|action/(doSearch\\?|showCitFormats\\?.*doi))", + "minVersion": "4.0.5", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2024-09-30 13:50:18" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2008 Sean Takats, Michael Berkowitz, Santawort, Aurimas + Vinckevicius, Philipp Zumstein, and other contributors. + + 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 getSearchResults(doc, checkOnly) { + var items = {}, found = false; + var rows = doc.querySelectorAll('.issue-item_title a, .teaser_title a'); + for (let i = 0; i < rows.length; i++) { + var href = rows[i].href; + var title = ZU.trimInternal(rows[i].textContent); + if (!href || !title) continue; + var doi = getDoi(href); + if (!doi) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + + return found ? items : false; +} + +// Return the DOI indicated by the URL, or null when no DOI is found +// The input should be a properly encoded URL +function getDoi(url) { + let urlObj = new URL(url); + let doi = decodeURIComponent(urlObj.pathname).match(/^\/doi\/(?:.+\/)?(10\.\d{4,}\/.+)$/); + if (doi) { + doi = doi[1]; + } + else { + doi = urlObj.searchParams.get("doi"); + } + return doi; +} + +/** *************************** + * BEGIN: Supplementary data * + *****************************/ + +var suppTypeMap = { + txt: 'text/plain', + csv: 'text/csv', + bz2: 'application/x-bzip2', + gz: 'application/gzip', + zip: 'application/zip', + pdf: 'application/pdf', + doc: 'application/msword', + docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + xls: 'application/vnd.ms-excel', + xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' +}; + +function getSupplements(doc, supplementAsLink = false) { + let supplements = []; + // Note that the lists of supplements are duplicated in the main + // content side and right-side panel (if any). We want to confine it to + // one (or the only) side in order to avoid having to deduplicate. + let supplementLinks = doc.querySelectorAll(".article_content-left .suppl-anchor"); + for (let i = 0; i < supplementLinks.length; i++) { + let elem = supplementLinks[i]; + let url = elem.href; + if (!url) continue; + let pathComponents = url.replace(/[?#].+$/, "").split("."); + // possible location of file extension (following the last dot) + let ext = pathComponents[pathComponents.length - 1].toLowerCase(); + let mimeType = suppTypeMap[ext]; + // Only save file when MIME type is known *and* when we aren't + // specifically told otherwise + let snapshot = Boolean(!supplementAsLink && mimeType); + // The "title" (text describing what the supplement file is for) can be + // substantially long, while the filename is redundant (and it doesn't + // inform the user that the file is meant to be a supplement). We + // simply number them in the order they appear. + let title = `Supplement ${i + 1}`; + let attachment = { title, url, snapshot }; + if (mimeType) attachment.mimeType = mimeType; + supplements.push(attachment); + } + return supplements; +} + +/** ************************* + * END: Supplementary data * + ***************************/ + +function detectWeb(doc, url) { + if (getSearchResults(doc, true)) { + return "multiple"; + } + let urlObj = new URL(url); + // standalone "download citation" page + if (urlObj.pathname === "/action/showCitFormats" + && urlObj.searchParams.get("doi")) { + // May be inaccurate, but better than not detecting + return "journalArticle"; + } + // epdf viewer web app + if (urlObj.pathname.startsWith("/doi/epdf/")) { + // TODO: check if "epdf" viewer is always for journal articles + return "journalArticle"; + } + // books such as https://pubs.acs.org/doi/book/10.1021/acsguide + if (urlObj.pathname.startsWith("/doi/book/")) { + return "book"; + } + if (doc.querySelector("#returnToBook")) { + // Some of them may be conference articles, but the RIS doesn't say so + return "bookSection"; + } + else if (getDoi(url)) { + // TODO: check if this block still works + var type = doc.getElementsByClassName("content-navigation__contentType"); + if (type.length && type[0].textContent.includes("Chapter")) { + return "bookSection"; + } + else { + return "journalArticle"; + } + } + return false; +} + +function cleanNumberField(item, field) { + if (item[field]) { + let n = parseInt(item[field]); + if (n <= 0 || isNaN(n)) { + delete item[field]; + } + } +} + +// In most cases the URL contains the DOI which is sufficient for obtaining the +// RIS, so there's no need to download the document if it's not already there. +// But when supplements as attachments are desired, we need the actual document +// for the supplement links. Our convention here is to pass falsy as the "doc" +// argument when supplements are not requested, and the actual doc (maybe +// fetched by us) when we want the supplements. + +async function doWeb(doc, url) { + let attachSupplement = false; + let supplementAsLink = false; + // reduce some overhead by fetching these only once + if (Z.getHiddenPref) { + attachSupplement = Z.getHiddenPref("attachSupplementary"); + supplementAsLink = Z.getHiddenPref("supplementaryAsLink"); + } + + if (detectWeb(doc, url) == "multiple") { // search + let items = await Z.selectItems(getSearchResults(doc)); + if (!items) return; + for (let url of Object.keys(items)) { + await scrape( + attachSupplement && await requestDocument(url), + url, + supplementAsLink + ); + await delay(500); + } + } + else { + // single article + await scrape(attachSupplement && doc, url, supplementAsLink); + } +} + +function delay(milliseconds) { + return new Promise(resolve => setTimeout(resolve, milliseconds)); +} + +async function scrape(doc, url, supplementAsLink) { + let doi = getDoi(url); + + if (doc && /\/action\/showCitFormats\?|\/doi\/epdf\//.test(url)) { + // standalone "export citation" page or "epdf viewer", *and* + // supplements are desired; we need to fetch the actual article page + // and scrape that + url = `https://pubs.acs.org/doi/${doi}`; + doc = await requestDocument(url); + } + + let risURL = new URL("/action/downloadCitation?include=abs&format=ris&direct=true", url); + risURL.searchParams.set("doi", doi); + risURL.searchParams.set("downloadFileName", doi.replace(/^10\.\d{4,}\//, "")); + let risText = await requestText(risURL.href, { headers: { Referer: url } }); + // Delete redundant DOI info + risText = risText.replace(/\nN1 {2}- doi:[^\n]+/, ""); + // Fix noise in DO field + risText = risText.replace("\nDO - doi:", "\nDO - "); + // Fix the wrong mapping for journal abbreviations + risText = risText.replace("\nJO -", "\nJ2 -"); + // Use publication date when available + if (risText.includes("\nDA -")) { + risText = risText.replace(/\nY1 {2}- [^\n]*/, "") + .replace("\nDA -", "\nY1 -"); + } + + let translator = Zotero.loadTranslator("import"); + // RIS + translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); + translator.setString(risText); + translator.setHandler("itemDone", function (obj, item) { + if (item.date) { + item.date = ZU.strToISO(item.date); + } + item.attachments = []; + if (/\/doi\/book\//.test(url)) { + // books as standalone items don't have full pdfs (TODO: verify) + if (doc) { + item.attachments.push({ + title: "Snapshot", + url: url, + mimeType: "text/html" + }); + } + } + else { + // standard pdf + item.attachments.push({ + title: "Full Text PDF", + url: `/doi/pdf/${doi}`, + mimeType: "application/pdf" + }); + } + // supplements + if (doc) { + item.attachments.push(...getSupplements(doc, supplementAsLink)); + } + // Cleanup fields that may contain invalid numeric values + cleanNumberField(item, "numberOfVolumes"); + cleanNumberField(item, "numPages"); + item.complete(); + }); + await translator.translate(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://pubs.acs.org/doi/10.1021/es103607c", + "items": [ + { + "itemType": "journalArticle", + "title": "Life Cycle Environmental Assessment of Lithium-Ion and Nickel Metal Hydride Batteries for Plug-In Hybrid and Battery Electric Vehicles", + "creators": [ + { + "lastName": "Majeau-Bettez", + "firstName": "Guillaume", + "creatorType": "author" + }, + { + "lastName": "Hawkins", + "firstName": "Troy R.", + "creatorType": "author" + }, + { + "lastName": "Strømman", + "firstName": "Anders Hammer", + "creatorType": "author" + } + ], + "date": "2011-05-15", + "DOI": "10.1021/es103607c", + "ISSN": "0013-936X", + "abstractNote": "This study presents the life cycle assessment (LCA) of three batteries for plug-in hybrid and full performance battery electric vehicles. A transparent life cycle inventory (LCI) was compiled in a component-wise manner for nickel metal hydride (NiMH), nickel cobalt manganese lithium-ion (NCM), and iron phosphate lithium-ion (LFP) batteries. The battery systems were investigated with a functional unit based on energy storage, and environmental impacts were analyzed using midpoint indicators. On a per-storage basis, the NiMH technology was found to have the highest environmental impact, followed by NCM and then LFP, for all categories considered except ozone depletion potential. We found higher life cycle global warming emissions than have been previously reported. Detailed contribution and structural path analyses allowed for the identification of the different processes and value-chains most directly responsible for these emissions. This article contributes a public and detailed inventory, which can be easily be adapted to any powertrain, along with readily usable environmental performance assessments.", + "issue": "10", + "journalAbbreviation": "Environ. Sci. Technol.", + "libraryCatalog": "ACS Publications", + "pages": "4548-4554", + "publicationTitle": "Environmental Science & Technology", + "url": "https://doi.org/10.1021/es103607c", + "volume": "45", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://pubs.acs.org/toc/nalefd/12/6", + "items": "multiple" + }, + { + "type": "web", + "url": "https://pubs.acs.org/doi/abs/10.1021/bk-2011-1071.ch005", + "items": [ + { + "itemType": "bookSection", + "title": "Redox Chemistry and Natural Organic Matter (NOM): Geochemists’ Dream, Analytical Chemists’ Nightmare", + "creators": [ + { + "lastName": "Macalady", + "firstName": "Donald L.", + "creatorType": "author" + }, + { + "lastName": "Walton-Day", + "firstName": "Katherine", + "creatorType": "author" + } + ], + "date": "2011-01-01", + "ISBN": "9780841226524", + "abstractNote": "Natural organic matter (NOM) is an inherently complex mixture of polyfunctional organic molecules. Because of their universality and chemical reversibility, oxidation/reductions (redox) reactions of NOM have an especially interesting and important role in geochemistry. Variabilities in NOM composition and chemistry make studies of its redox chemistry particularly challenging, and details of NOM-mediated redox reactions are only partially understood. This is in large part due to the analytical difficulties associated with NOM characterization and the wide range of reagents and experimental systems used to study NOM redox reactions. This chapter provides a summary of the ongoing efforts to provide a coherent comprehension of aqueous redox chemistry involving NOM and of techniques for chemical characterization of NOM. It also describes some attempts to confirm the roles of different structural moieties in redox reactions. In addition, we discuss some of the operational parameters used to describe NOM redox capacities and redox states, and describe nomenclature of NOM redox chemistry. Several relatively facile experimental methods applicable to predictions of the NOM redox activity and redox states of NOM samples are discussed, with special attention to the proposed use of fluorescence spectroscopy to predict relevant redox characteristics of NOM samples.", + "bookTitle": "Aquatic Redox Chemistry", + "extra": "DOI: 10.1021/bk-2011-1071.ch005", + "libraryCatalog": "ACS Publications", + "pages": "85-111", + "publisher": "American Chemical Society", + "series": "ACS Symposium Series", + "seriesNumber": "1071", + "shortTitle": "Redox Chemistry and Natural Organic Matter (NOM)", + "url": "https://doi.org/10.1021/bk-2011-1071.ch005", + "volume": "1071", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://pubs.acs.org/doi/abs/10.1021/jp000606%2B", + "items": [ + { + "itemType": "journalArticle", + "title": "Theory of Charge Transport in Polypeptides", + "creators": [ + { + "lastName": "Schlag", + "firstName": "E. W.", + "creatorType": "author" + }, + { + "lastName": "Sheu", + "firstName": "Sheh-Yi", + "creatorType": "author" + }, + { + "lastName": "Yang", + "firstName": "Dah-Yen", + "creatorType": "author" + }, + { + "lastName": "Selzle", + "firstName": "H. L.", + "creatorType": "author" + }, + { + "lastName": "Lin", + "firstName": "S. H.", + "creatorType": "author" + } + ], + "date": "2000-08-01", + "DOI": "10.1021/jp000606+", + "ISSN": "1520-6106", + "abstractNote": "We have derived phase space and diffusion theories for a new hopping model of charge transport in polypeptides and thence for distal chemical kinetics. The charge is transferred between two carbamide groups on each side of the Cα atom hinging two amino acid groups. When the torsional angles on the hinge approach a certain region of the Ramachandran plot, the charge transfer has zero barrier height and makes charge transfer the result of strong electronic correlation. The mean first passage time calculated from this analytic model of some 164 fs is in reasonable agreement with prior molecular dynamics calculation of some 140 fs and supports this new bifunctional model for charge transport and chemical reactions in polypeptides.", + "issue": "32", + "journalAbbreviation": "J. Phys. Chem. B", + "libraryCatalog": "ACS Publications", + "pages": "7790-7794", + "publicationTitle": "The Journal of Physical Chemistry B", + "url": "https://doi.org/10.1021/jp000606+", + "volume": "104", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://pubs.acs.org/journal/acbcct", + "items": "multiple" + }, + { + "type": "web", + "url": "https://pubs.acs.org/action/doSearch?text1=zotero&field1=AllField", + "items": "multiple" + }, + { + "type": "web", + "url": "https://pubs.acs.org/doi/book/10.1021/acsguide", + "items": [ + { + "itemType": "book", + "title": "The ACS Guide to Scholarly Communication", + "creators": [ + { + "lastName": "Banik", + "firstName": "Gregory M.", + "creatorType": "author" + }, + { + "lastName": "Baysinger", + "firstName": "Grace", + "creatorType": "author" + }, + { + "lastName": "Kamat", + "firstName": "Prashant V.", + "creatorType": "author" + }, + { + "lastName": "Pienta", + "firstName": "Norbert", + "creatorType": "author" + } + ], + "date": "2019-10-02", + "ISBN": "9780841235861", + "extra": "DOI: 10.1021/acsguide", + "libraryCatalog": "ACS Publications", + "publisher": "American Chemical Society", + "series": "ACS Guide to Scholarly Communication", + "url": "https://doi.org/10.1021/acsguide", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://pubs.acs.org/action/showCitFormats?doi=10.1021%2Facscentsci.3c00243", + "items": [ + { + "itemType": "journalArticle", + "title": "Generic Platform for the Multiplexed Targeted Electrochemical Detection of Osteoporosis-Associated Single Nucleotide Polymorphisms Using Recombinase Polymerase Solid-Phase Primer Elongation and Ferrocene-Modified Nucleoside Triphosphates", + "creators": [ + { + "lastName": "Ortiz", + "firstName": "Mayreli", + "creatorType": "author" + }, + { + "lastName": "Jauset-Rubio", + "firstName": "Miriam", + "creatorType": "author" + }, + { + "lastName": "Trummer", + "firstName": "Olivia", + "creatorType": "author" + }, + { + "lastName": "Foessl", + "firstName": "Ines", + "creatorType": "author" + }, + { + "lastName": "Kodr", + "firstName": "David", + "creatorType": "author" + }, + { + "lastName": "Acero", + "firstName": "Josep Lluís", + "creatorType": "author" + }, + { + "lastName": "Botero", + "firstName": "Mary Luz", + "creatorType": "author" + }, + { + "lastName": "Biggs", + "firstName": "Phil", + "creatorType": "author" + }, + { + "lastName": "Lenartowicz", + "firstName": "Daniel", + "creatorType": "author" + }, + { + "lastName": "Trajanoska", + "firstName": "Katerina", + "creatorType": "author" + }, + { + "lastName": "Rivadeneira", + "firstName": "Fernando", + "creatorType": "author" + }, + { + "lastName": "Hocek", + "firstName": "Michal", + "creatorType": "author" + }, + { + "lastName": "Obermayer-Pietsch", + "firstName": "Barbara", + "creatorType": "author" + }, + { + "lastName": "O’Sullivan", + "firstName": "Ciara K.", + "creatorType": "author" + } + ], + "date": "2023-08-23", + "DOI": "10.1021/acscentsci.3c00243", + "ISSN": "2374-7943", + "abstractNote": "Osteoporosis is a multifactorial disease influenced by genetic and environmental factors, which contributes to an increased risk of bone fracture, but early diagnosis of this disease cannot be achieved using current techniques. We describe a generic platform for the targeted electrochemical genotyping of SNPs identified by genome-wide association studies to be associated with a genetic predisposition to osteoporosis. The platform exploits isothermal solid-phase primer elongation with ferrocene-labeled nucleoside triphosphates. Thiolated reverse primers designed for each SNP were immobilized on individual gold electrodes of an array. These primers are designed to hybridize to the SNP site at their 3′OH terminal, and primer elongation occurs only where there is 100% complementarity, facilitating the identification and heterozygosity of each SNP under interrogation. The platform was applied to real blood samples, which were thermally lysed and directly used without the need for DNA extraction or purification. The results were validated using Taqman SNP genotyping assays and Sanger sequencing. The assay is complete in just 15 min with a total cost of 0.3€ per electrode. The platform is completely generic and has immense potential for deployment at the point of need in an automated device for targeted SNP genotyping with the only required end-user intervention being sample addition.", + "issue": "8", + "journalAbbreviation": "ACS Cent. Sci.", + "libraryCatalog": "ACS Publications", + "pages": "1591-1602", + "publicationTitle": "ACS Central Science", + "url": "https://doi.org/10.1021/acscentsci.3c00243", + "volume": "9", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://pubs.acs.org/doi/epdf/10.1021/acscentsci.3c00323", + "items": [ + { + "itemType": "journalArticle", + "title": "Dynamics of Rayleigh Fission Processes in ∼100 nm Charged Aqueous Nanodrops", + "creators": [ + { + "lastName": "Hanozin", + "firstName": "Emeline", + "creatorType": "author" + }, + { + "lastName": "Harper", + "firstName": "Conner C.", + "creatorType": "author" + }, + { + "lastName": "McPartlan", + "firstName": "Matthew S.", + "creatorType": "author" + }, + { + "lastName": "Williams", + "firstName": "Evan R.", + "creatorType": "author" + } + ], + "date": "2023-08-23", + "DOI": "10.1021/acscentsci.3c00323", + "ISSN": "2374-7943", + "abstractNote": "Fission of micron-size charged droplets has been observed using optical methods, but little is known about fission dynamics and breakup of smaller nanosize droplets that are important in a variety of natural and industrial processes. Here, spontaneous fission of individual aqueous nanodrops formed by electrospray is investigated using charge detection mass spectrometry. Fission processes ranging from formation of just two progeny droplets in 2 ms to production of dozens of progeny droplets over 100+ ms are observed for nanodrops that are charged above the Rayleigh limit. These results indicate that Rayleigh fission is a continuum of processes that produce progeny droplets that vary widely in charge, mass, and number.", + "issue": "8", + "journalAbbreviation": "ACS Cent. Sci.", + "libraryCatalog": "ACS Publications", + "pages": "1611-1622", + "publicationTitle": "ACS Central Science", + "url": "https://doi.org/10.1021/acscentsci.3c00323", + "volume": "9", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/ADS Bibcode.js b/translators/ADS Bibcode.js new file mode 100644 index 0000000..7cc8bca --- /dev/null +++ b/translators/ADS Bibcode.js @@ -0,0 +1,664 @@ +{ + "translatorID": "09bd8037-a9bb-4f9a-b3b9-d18b2564b49e", + "label": "ADS Bibcode", + "creator": "Abe Jellinek", + "target": "", + "minVersion": "6.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 8, + "lastUpdated": "2025-04-29 03:02:00" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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 ***** +*/ + +// Logic for accurate type detection. In general, the type in the RIS export is +// fairly accurate. However, it may misidentify a proceedings book as JOUR (but +// usually identifies conference papers fine). Theses are also identified as +// JOUR in the RIS file. Preprints are usually correctly identified. +function getRealType(bibStem, exportType) { + if (/^(PhDT|MsT)/.test(bibStem)) { + return "thesis"; + } + + // Fix misidentifying full proceedings book as JOUR + let volume = bibStem.substring(5, 9); + if (volume === "conf" && exportType === "journalArticle") { + return "book"; + } + + return exportType; +} + +// https://github.com/yymao/adstex/blob/64989c9e75d7401ea2b33b546664cbc34cce6a27/adstex.py +const bibcodeRe = /^\d{4}\D\S{13}[A-Z.:]$/; + +function detectSearch(items) { + return !!filterQuery(items).length; +} + +async function doSearch(items) { + let bibcodes = filterQuery(items); + if (!bibcodes.length) return; + await scrape(bibcodes); +} + +function filterQuery(items) { + if (!items) return []; + + if (!items.length) items = [items]; + + // filter out invalid queries + let bibcodes = []; + for (let item of items) { + if (item.adsBibcode && typeof item.adsBibcode == 'string') { + let bibcode = item.adsBibcode.trim(); + if (bibcodeRe.test(bibcode)) { + bibcodes.push(bibcode); + } + } + } + return bibcodes; +} + +function extractId(url) { + let m = url.match(/\/abs\/([^/]+)/); + return m && decodeURIComponent(m[1]); +} + +function makePdfUrl(id) { + return "https://ui.adsabs.harvard.edu/link_gateway/" + id + "/ARTICLE"; +} + +// Detect if an item is from arXiv. This is necessary because bibcodes of older +// arXiv preprints don't start with "arXiv" +function isArXiv(item, bibStem) { + if (item.DOI && item.DOI.startsWith("10.48550/")) return true; + if (bibStem.startsWith("arXiv")) return true; + return false; +} + +async function scrape(ids) { + let bootstrap = await requestJSON("https://api.adsabs.harvard.edu/v1/accounts/bootstrap"); + if (!bootstrap || !bootstrap.access_token) { + throw new Error("ADS Bibcode: cannot obtain access token"); + } + let body = JSON.stringify({ bibcode: ids, sort: ['no sort'] }); + let response = await requestJSON("https://api.adsabs.harvard.edu/v1/export/ris", { + method: "POST", + body, + headers: { + Accept: "application/json", + Authorization: `Bearer ${bootstrap.access_token}`, + "Content-Type": "application/json", + }, + }); + + let translator = Zotero.loadTranslator("import"); + translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); // RIS + translator.setString(response.export); + translator.setHandler("itemDone", function (obj, item) { + let id = extractId(item.url); + let bibStem = id.slice(4); + + let type = getRealType(bibStem, item.itemType); + if (type !== item.itemType) { + Z.debug(`ADS Bibcode: changing item type: ${item.itemType} -> ${type}`); + item.itemType = type; + } + + if (isArXiv(item, bibStem)) { + item.itemType = "preprint"; + item.publisher = "arXiv"; + delete item.pages; + delete item.publicationTitle; + delete item.journalAbbreviation; + } + + item.extra = (item.extra || '') + `\nADS Bibcode: ${id}`; + + // for thesis-type terminology, see + // https://adsabs.harvard.edu/abs_doc/journals1.html + if (item.itemType === "thesis") { + if (bibStem.startsWith("PhDT")) { + item.thesisType = "Ph.D. thesis"; + } + else if (bibStem.startsWith("MsT")) { + item.thesisType = "Masters thesis"; + } + delete item.journalAbbreviation; // from spurious JO tag + delete item.publicationTitle; + } + + item.attachments.push({ + url: makePdfUrl(id), + title: "Full Text PDF", + mimeType: "application/pdf" + }); + + if (item.journalAbbreviation == item.publicationTitle) { + delete item.journalAbbreviation; + } + + if (item.date) { + item.date = ZU.strToISO(item.date); + } + + item.libraryCatalog = 'NASA ADS'; + + item.complete(); + }); + await translator.translate(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "search", + "input": { + "adsBibcode": "2022MSSP..16208070W" + }, + "items": [ + { + "itemType": "journalArticle", + "title": "Research and application of neural network for tread wear prediction and optimization", + "creators": [ + { + "lastName": "Wang", + "firstName": "Meiqi", + "creatorType": "author" + }, + { + "lastName": "Jia", + "firstName": "Sixian", + "creatorType": "author" + }, + { + "lastName": "Chen", + "firstName": "Enli", + "creatorType": "author" + }, + { + "lastName": "Yang", + "firstName": "Shaopu", + "creatorType": "author" + }, + { + "lastName": "Liu", + "firstName": "Pengfei", + "creatorType": "author" + }, + { + "lastName": "Qi", + "firstName": "Zhuang", + "creatorType": "author" + } + ], + "date": "2022-01-01", + "DOI": "10.1016/j.ymssp.2021.108070", + "ISSN": "0888-3270", + "abstractNote": "The wheel tread wear of heavy haul freight car in operation leads to shortened wheel turning period, reduced operation life, and poor train operation performance. In addition, wheel rail wear is a complex non-linear problem that integrates multiple disciplines. Thus, using a single physical or mathematical model to accurately describe and predict it is difficult. How to establish a model that could accurately predict wheel tread wear is an urgent problem and challenge that needs to be solved. In this paper, a tread wear prediction and optimization method based on chaotic quantum particle swarm optimization (CQPSO)-optimized derived extreme learning machine (DELM), namely CQPSO-DELM, is proposed to overcome this problem. First, an extreme learning machine model with derivative characteristics is proposed (DELM). Next, the chaos algorithm is introduced into the quantum particle swarm optimization algorithm to optimize the parameters of DELM. Then, through the CQPSO-DELM prediction model, the vehicle dynamics model simulates the maximum wheel tread wear under different test parameters to train and predict. Results show that the error performance index of the CQPSO-DELM prediction model is smaller than that of other algorithms. Thus, it could better reflect the influence of different parameters on the value of wheel tread wear. CQPSO is used to optimize the tread coordinates to obtain a wheel profile with low wear. The optimized wheel profile is fitted and reconstructed by the cubic non-uniform rational B-spline (NURBS) theory, and the optimized wear value of the tread is compared with the original wear value. The optimized wear value is less than the original wear value, thus verifying the effectiveness of the optimization model. The CQPSO-DELM model proposed in this paper could predict the wear value of different working conditions and tree shapes and solve the problem that different operating conditions and complex environment could have a considerable effect on the prediction of tread wear value. The optimization of wheel tread and the wear prediction of different tread shapes are realized from the angle of artificial intelligence for the first time.", + "extra": "ADS Bibcode: 2022MSSP..16208070W", + "libraryCatalog": "NASA ADS", + "pages": "108070", + "publicationTitle": "Mechanical Systems and Signal Processing", + "url": "https://ui.adsabs.harvard.edu/abs/2022MSSP..16208070W", + "volume": "162", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "00-01" + }, + { + "tag": "99-00" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "adsBibcode": "2021PhDT.........5C" + }, + "items": [ + { + "itemType": "thesis", + "title": "Searching for the Astrophysical Gravitational-Wave Background and Prompt Radio Emission from Compact Binaries", + "creators": [ + { + "lastName": "Callister", + "firstName": "Thomas A.", + "creatorType": "author" + } + ], + "date": "2021-06-01", + "abstractNote": "Gravitational-wave astronomy is now a reality. During my time at Caltech, the Advanced LIGO and Virgo observatories have detected gravitational waves from dozens of compact binary coalescences. All of these gravitational-wave events occurred in the relatively local Universe. In the first part of this thesis, I will instead look towards the remote Universe, investigating what LIGO and Virgo may be able to learn about cosmologically-distant compact binaries via observation of the stochastic gravitational-wave background. The stochastic gravitational-wave background is composed of the incoherent superposition of all distant, individually-unresolvable gravitational-wave sources. I explore what we learn from study of the gravitational-wave background, both about the astrophysics of compact binaries and the fundamental nature of gravitational waves. Of course, before we can study the gravitational-wave background we must first detect it. I therefore present searches for the gravitational-wave background using data from Advanced LIGO's first two observing runs, obtaining the most stringent upper limits to date on strength of the stochastic background. Finally, I consider how one might validate an apparent detection of the gravitational-wave background, confidently distinguishing a true astrophysical signal from spurious terrestrial artifacts. The second part of this thesis concerns the search for electromagnetic counterparts to gravitational-wave events. The binary neutron star merger GW170817 was accompanied by a rich set of electromagnetic counterparts spanning nearly the entire electromagnetic spectrum. Beyond these counterparts, compact binaries may additionally generate powerful radio transients at or near their time of merger. First, I consider whether there is a plausible connection between this so-called \"prompt radio emission\" and fast radio bursts — enigmatic radio transients of unknown origin. Next, I present the first direct search for prompt radio emission from a compact binary merger using the Owens Valley Radio Observatory Long Wavelength Array (OVRO-LWA). While no plausible candidates are identified, this effort successfully demonstrates the prompt radio follow-up of a gravitational-wave source, providing a blueprint for LIGO and Virgo follow-up in their O3 observing run and beyond.", + "extra": "ADS Bibcode: 2021PhDT.........5C", + "libraryCatalog": "NASA ADS", + "thesisType": "Ph.D. thesis", + "url": "https://ui.adsabs.harvard.edu/abs/2021PhDT.........5C", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "adsBibcode": "2021wfc..rept....8D" + }, + "items": [ + { + "itemType": "report", + "title": "WFC3 IR Blob Classification with Machine Learning", + "creators": [ + { + "lastName": "Dauphin", + "firstName": "F.", + "creatorType": "author" + }, + { + "lastName": "Medina", + "firstName": "J. V.", + "creatorType": "author" + }, + { + "lastName": "McCullough", + "firstName": "P. R.", + "creatorType": "author" + } + ], + "date": "2021-06-01", + "abstractNote": "IR blobs are small, circular, dark artifacts in WFC3 IR images caused by particulates that occasionally are deposited on a flat mirror that is nearly optically conjugate to the IR detector. Machine learning can potentially reduce the effort currently devoted to visually inspecting blobs. We describe how machine learning (ML) techniques have been implemented to develop software that will automatically find new IR blobs and notify the WFC3 Quicklook team. This report describes the data preparation, development of the ML model, and criteria for success. The results of our latest test cases demonstrate that the model finds blobs reliably, with the model correctly classifying blob and non-blob images 94% and 88% of the time, respectively. We also report tips and lessons learned from our experience in machine learning as a result of this project.", + "extra": "ADS Bibcode: 2021wfc..rept....8D", + "libraryCatalog": "NASA ADS", + "pages": "8", + "url": "https://ui.adsabs.harvard.edu/abs/2021wfc..rept....8D", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Blobs" + }, + { + "tag": "Convolutional Neural Networks" + }, + { + "tag": "HST" + }, + { + "tag": "Hubble Space Telescope" + }, + { + "tag": "IR" + }, + { + "tag": "Machine Learning" + }, + { + "tag": "STScI" + }, + { + "tag": "Space Telescope Science Institute" + }, + { + "tag": "WFC3" + }, + { + "tag": "Wide Field Camera 3" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "adsBibcode": "2021sti..book.....P" + }, + "items": [ + { + "itemType": "book", + "title": "Stochastic Thermodynamics: An Introduction", + "creators": [ + { + "lastName": "Peliti", + "firstName": "Luca", + "creatorType": "author" + }, + { + "lastName": "Pigolotti", + "firstName": "Simone", + "creatorType": "author" + } + ], + "date": "2021-07-01", + "abstractNote": "The first comprehensive graduate-level introduction to stochastic thermodynamics. Stochastic thermodynamics is a well-defined subfield of statistical physics that aims to interpret thermodynamic concepts for systems ranging in size from a few to hundreds of nanometers, the behavior of which is inherently random due to thermal fluctuations. This growing field therefore describes the nonequilibrium dynamics of small systems, such as artificial nanodevices and biological molecular machines, which are of increasing scientific and technological relevance. This textbook provides an up-to-date pedagogical introduction to stochastic thermodynamics, guiding readers from basic concepts in statistical physics, probability theory, and thermodynamics to the most recent developments in the field. Gradually building up to more advanced material, the authors consistently prioritize simplicity and clarity over exhaustiveness and focus on the development of readers' physical insight over mathematical formalism. This approach allows the reader to grow as the book proceeds, helping interested young scientists to enter the field with less effort and to contribute to its ongoing vibrant development. Chapters provide exercises to complement and reinforce learning. Appropriate for graduate students in physics and biophysics, as well as researchers, Stochastic Thermodynamics serves as an excellent initiation to this rapidly evolving field. Emphasizes a pedagogical approach to the subject Highlights connections with the thermodynamics of information Pays special attention to molecular biophysics applications Privileges physical intuition over mathematical formalism Solutions manual available on request for instructors adopting the book in a course", + "extra": "ADS Bibcode: 2021sti..book.....P", + "libraryCatalog": "NASA ADS", + "shortTitle": "Stochastic Thermodynamics", + "url": "https://ui.adsabs.harvard.edu/abs/2021sti..book.....P", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "adsBibcode": "2020jsrs.conf.....B" + }, + "items": [ + { + "itemType": "book", + "title": "Proceedings of the Journées Systèmes de Référence Spatio-temporels 2019 \"Astrometry, Earth Rotation and Reference System in the Gaia era\"", + "creators": [ + { + "lastName": "Bizouard", + "firstName": "Christian", + "creatorType": "author" + } + ], + "date": "2020-09-01", + "extra": "ADS Bibcode: 2020jsrs.conf.....B", + "libraryCatalog": "NASA ADS", + "url": "https://ui.adsabs.harvard.edu/abs/2020jsrs.conf.....B", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "adsBibcode": "2020jsrs.conf..209S" + }, + "items": [ + { + "itemType": "conferencePaper", + "title": "Atmospheric angular momentum related to Earth rotation studies: history and modern developments", + "creators": [ + { + "lastName": "Salstein", + "firstName": "D.", + "creatorType": "author" + } + ], + "date": "2020-09-01", + "abstractNote": "It was noted some time ago that the angular momentum of the atmosphere varies, both regionally as well as in total. Given the conservation of angular momentum in the Earth system, except for known external torques, such variability implies transfer of the angular momentum across the atmosphere's lower boundary. As nearly all is absorbed by the Earth below, the solid Earth changes its overall rotation from this impact. Due to the large difference between in the moments of inertia of the atmosphere and Earth, relatively big differences in the atmosphere are translated as relatively very small differences in the Earth, measurable as changes in Earth rotation rate, and polar motion. The atmospheric angular momentum (AAM) is that due to the motion of the winds and to the changes in mass distribution, closely related to the atmosphere pressure patterns; its variability in the atmosphere is mirrored in the Earth rotation rate and polar motion. This connection between the global solid Earth properties and the global and regional atmosphere on a number of time scales, especially seasonal and interannual, was much appreciated by Barbara Kolaczek, with Jolanta Nastula, at the Space Research Center in Warsaw, and this was a subject of our collaborative studies. Many calculations were made of atmospheric angular momentum, leading to a service under the Global Geophysical Fluids Center of the IERS based on calculations using both operational meteorological series, determined for weather forecasting purposes, and retrospective analyses of the atmosphere. Theoretical development of the connection between the AAM, Earth rotation/polar motion, and also the angular momentum of the other geophysical fluids occurred at the same time that space-based observations and enhanced computer power were allowing improved skills for both weather analysis and forecasting. Hence better determination of the AAM became possible, which could be used as a measure for forecasting Earth rotation. Today we are looking at the atmosphere in combination with the ocean and other fluids, and also assessing the implications of climate variability on Earth rotation through climate model research. According to models of the Earth system, significant changes in winds appear to be a possible result of climate change, with implications for the Earth rotation parameters.", + "conferenceName": "Astrometry, Earth Rotation, and Reference Systems in the GAIA era", + "extra": "ADS Bibcode: 2020jsrs.conf..209S", + "libraryCatalog": "NASA ADS", + "pages": "209-213", + "shortTitle": "Atmospheric angular momentum related to Earth rotation studies", + "url": "https://ui.adsabs.harvard.edu/abs/2020jsrs.conf..209S", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": [ + { + "adsBibcode": "2002math.....11159P" + }, + { + "adsBibcode": "2003math......3109P" + } + ], + "items": [ + { + "itemType": "preprint", + "title": "The entropy formula for the Ricci flow and its geometric applications", + "creators": [ + { + "lastName": "Perelman", + "firstName": "Grisha", + "creatorType": "author" + } + ], + "date": "2002-11-01", + "DOI": "10.48550/arXiv.math/0211159", + "abstractNote": "We present a monotonic expression for the Ricci flow, valid in all dimensions and without curvature assumptions. It is interpreted as an entropy for a certain canonical ensemble. Several geometric applications are given. In particular, (1) Ricci flow, considered on the space of riemannian metrics modulo diffeomorphism and scaling, has no nontrivial periodic orbits (that is, other than fixed points); (2) In a region, where singularity is forming in finite time, the injectivity radius is controlled by the curvature; (3) Ricci flow can not quickly turn an almost euclidean region into a very curved one, no matter what happens far away. We also verify several assertions related to Richard Hamilton's program for the proof of Thurston geometrization conjecture for closed three-manifolds, and give a sketch of an eclectic proof of this conjecture, making use of earlier results on collapsing with local lower curvature bound.", + "extra": "ADS Bibcode: 2002math.....11159P", + "libraryCatalog": "NASA ADS", + "repository": "arXiv", + "url": "https://ui.adsabs.harvard.edu/abs/2002math.....11159P", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "53C" + }, + { + "tag": "Differential Geometry" + } + ], + "notes": [], + "seeAlso": [] + }, + { + "itemType": "preprint", + "title": "Ricci flow with surgery on three-manifolds", + "creators": [ + { + "lastName": "Perelman", + "firstName": "Grisha", + "creatorType": "author" + } + ], + "date": "2003-03-01", + "DOI": "10.48550/arXiv.math/0303109", + "abstractNote": "This is a technical paper, which is a continuation of math.DG/0211159. Here we construct Ricci flow with surgeries and verify most of the assertions, made in section 13 of that e-print; the exceptions are (1) the statement that manifolds that can collapse with local lower bound on sectional curvature are graph manifolds - this is deferred to a separate paper, since the proof has nothing to do with the Ricci flow, and (2) the claim on the lower bound for the volume of maximal horns and the smoothness of solutions from some time on, which turned out to be unjustified and, on the other hand, irrelevant for the other conclusions.", + "extra": "ADS Bibcode: 2003math......3109P", + "libraryCatalog": "NASA ADS", + "repository": "arXiv", + "url": "https://ui.adsabs.harvard.edu/abs/2003math......3109P", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "53C" + }, + { + "tag": "Differential Geometry" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "adsBibcode": "1995LNP...463...51E" + }, + "items": [ + { + "itemType": "bookSection", + "title": "Observations and Cosmological Models", + "creators": [ + { + "lastName": "Ellis", + "firstName": "G. F. R.", + "creatorType": "author" + } + ], + "date": "1995-01-01", + "bookTitle": "Galaxies in the Young Universe", + "extra": "DOI: 10.1007/BFb0102359\nADS Bibcode: 1995LNP...463...51E", + "libraryCatalog": "NASA ADS", + "pages": "51", + "url": "https://ui.adsabs.harvard.edu/abs/1995LNP...463...51E", + "volume": "463", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "adsBibcode": "1997MsT...........B" + }, + "items": [ + { + "itemType": "thesis", + "title": "Comparative Analysis of Selected Radiation Effects in Medium Earth Orbits", + "creators": [ + { + "lastName": "Bolin", + "firstName": "Jennifer A.", + "creatorType": "author" + } + ], + "date": "1997-12-01", + "abstractNote": "Satellite design is well developed for the common Low Earth Orbit (LEO) and Geosynchronous Orbit (GEO) and Highly Elliptical Orbits (HEO), i.e., Molniya, cases; Medium Earth Orbit (MEO) satellite design is a relatively new venture. MEO is roughly defined as being altitudes above LEO and below GEO. A primary concern, and a major reason for the delay in exploiting the MEO altitudes, has been the expected radiation environment and corresponding satellite degradation anticipated to occur at MEO altitudes. The presence of the Van Allen belts, a major source of radiation, along with the suitability of GEO and LEO orbits, has conventionally discouraged satellite placement in MEO. As conventional Earth orbits become increasingly crowded, MEO will become further populated. This thesis investigates the major sources of radiation (geomagnetically trapped particles, solar particle events and galactic cosmic radiation) with respect to specific Naval Research Laboratory (NRL) designated MEO (altitudes between 3,000 nautical miles (nmi) and 9,000 nmi; (inclination angle of 15 degrees). The contribution of each of these components to the total radiation experienced in MEO and the effects of the expected radiation on a representative spacecraft are analyzed in comparison to a baseline LEO orbit of 400 nmi and 70 degrees inclination. Dose depth curves are calculated for several configurations, and show that weight gains from necessary expected shielding are not extreme. The radiation effects considered include proton displacement dose and solar cell degradation.", + "extra": "ADS Bibcode: 1997MsT...........B", + "libraryCatalog": "NASA ADS", + "thesisType": "Masters thesis", + "url": "https://ui.adsabs.harvard.edu/abs/1997MsT...........B", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Aerospace Environments" + }, + { + "tag": "Astrophysics" + }, + { + "tag": "Cosmic Rays" + }, + { + "tag": "Degradation" + }, + { + "tag": "Elliptical Orbits" + }, + { + "tag": "Galactic Radiation" + }, + { + "tag": "Geosynchronous Orbits" + }, + { + "tag": "Low Earth Orbits" + }, + { + "tag": "Radiation Belts" + }, + { + "tag": "Radiation Effects" + }, + { + "tag": "Satellite Design" + }, + { + "tag": "Solar Activity" + }, + { + "tag": "Solar Cells" + }, + { + "tag": "Solar Corpuscular Radiation" + }, + { + "tag": "Solar Storms" + }, + { + "tag": "Unmanned Spacecraft" + } + ], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/AEA Web.js b/translators/AEA Web.js new file mode 100644 index 0000000..b3fec5e --- /dev/null +++ b/translators/AEA Web.js @@ -0,0 +1,450 @@ +{ + "translatorID": "6044b16f-2452-4ce8-ad02-fab69ef04f13", + "label": "AEA Web", + "creator": "Sebatian Karcher", + "target": "^https?://www\\.aeaweb\\.org/(articles|journals|issues)", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2025-05-08 17:43:18" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + AEA Web translator Copyright © 2014 Sebastian Karcher + 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) { + if (url.indexOf('/articles?id=')>-1) { + return "journalArticle"; + } else if (getSearchResults(doc, true)) { + return "multiple"; + } +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = ZU.xpath(doc, '//article//a[contains(@href, "/articles?id=")]|//li[@class="article"]//a[contains(@href, "/articles?id=")]'); + for (var i=0; i. + + ***** END LICENSE BLOCK ***** +*/ + + +function detectWeb(doc, _url) { + if (doc.querySelector('.docType_ico img[title*="Dataset"]')) { + return "document"; + } + else if (doc.querySelector('meta[name="citation_journal_title"]')) { + return "journalArticle"; + } + else if (doc.querySelector('meta[name="citation_title"]')) { + return "report"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('h3 > a[href*="search.do"]'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', function (obj, item) { + // item.url will be empty if there's no full-text link; we don't want + // to use the catalog page as the URL in that case. + item.url = attr(doc, '.link-full-text a', 'href'); + item.attachments = []; + + if (item.itemType == 'document') { + item.extra = (item.extra || '') + '\nType: dataset'; + } + + item.complete(); + }); + + translator.getTranslatorObject(function (trans) { + trans.itemType = detectWeb(doc, url); + trans.doWeb(doc, url); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://agris.fao.org/agris-search/search.do?recordID=IR2012044101", + "items": [ + { + "itemType": "report", + "title": "Possibility of artificial propagation in farmed great sturgeon (Huso huso)", + "creators": [ + { + "firstName": "Mahmoud", + "lastName": "Bahmani", + "creatorType": "author" + }, + { + "firstName": "M.", + "lastName": "Porkazemi", + "creatorType": "author" + }, + { + "firstName": "H.", + "lastName": "Khara", + "creatorType": "author" + }, + { + "firstName": "M.", + "lastName": "Rahimidanesh", + "creatorType": "author" + }, + { + "firstName": "M. A.", + "lastName": "Tolooei", + "creatorType": "author" + }, + { + "firstName": "A.", + "lastName": "Abasalizadeh", + "creatorType": "author" + }, + { + "firstName": "M.", + "lastName": "Hassanzadehsaber", + "creatorType": "author" + }, + { + "firstName": "H.", + "lastName": "Mohamadiparashkohi", + "creatorType": "author" + }, + { + "firstName": "O.", + "lastName": "Asghari", + "creatorType": "author" + }, + { + "firstName": "R.", + "lastName": "Kazemi", + "creatorType": "author" + }, + { + "firstName": "S.", + "lastName": "Dezhandian", + "creatorType": "author" + }, + { + "firstName": "A.", + "lastName": "Yousefi Jourdehi", + "creatorType": "author" + }, + { + "firstName": "M.", + "lastName": "Mohseni", + "creatorType": "author" + }, + { + "firstName": "M. A.", + "lastName": "Yazdani", + "creatorType": "author" + }, + { + "firstName": "A.", + "lastName": "Hallajian", + "creatorType": "author" + }, + { + "firstName": "M.", + "lastName": "Shakourian", + "creatorType": "author" + }, + { + "firstName": "M.", + "lastName": "Pourdehghani", + "creatorType": "author" + } + ], + "date": "2011", + "abstractNote": "In this research, morphometrical and physiological indicators of farmed great sturgeon, Huso huso in the Dr.Dadman International Sturgeon Research Institute studied. After biopsy of male and female gonads, two groups in terms of sexual maturity stage were observed. According to the histological observations, gonad development of male fish in the test group 1, stage II to III and in the test group 2 stage II to IV and in female fish in the test group 1 from stage II to stage II-III and in the test group 2 in stage III of sexual development and maturity stage was determined Maximum average weight and total length in a group of male fish in the summer (39/07±5/79 kg and 170 ± 6/48cm) and minimum average weight and total length in the two test groups of male fish in the autumn (26/25±3/65 kg and 155/5±4/40 cm) were measured. In the female test groups, the maximum average of weight and total length of the test group 2 in the summer (40/32±3/09 kg 170/12±1/96 cm), and the minimum of the test group 1 in the fall (25/8±1/30 kg and 160/6± 1/97 cm) were determined. The results of measuring the cortisol hormone in male test group, maximum and minimum average in the test group 1, respectively, in the summer (41/25±6/34 ng/ml) and fall (24/62±13/96 ng/ml) showed a significant difference between groups (p0.05). While the results of female group tests in test groups in relation with cortisol hormone had suggested that the maximum in group 2 in winter (58±25/92 ng/ml) and minimum in group 1 in the autumn (9/32±5/6 ng/ml) were observed and there were significant difference between groups (p0.05). Male, the results had suggested that the maximum average testosterone in the test group 2 in winter (71/25±15/52 ng / ml) and minimum in group 1 and in winter (27±6/60 ng/ml), respectively. So that showed significant difference between groups (P0.05). progesterone hormone were in the test group 2 and in summer (1/52±0/18 ng/ml) and its minimum in winter (0/14± 0/10 ng/ml) in test group 1 (p0.05), respectively. Maximum hormone levels 17-beta estradiol in the test group 2 in the autumn (16/42±6/36 ng/ml) and its minimum in the test group 1 in the winter (3/1±0/74 ng/ml) was observed and showed no statistical difference between groups (p 0.05). Based on the results, levels of female sex hormones in the test group showed that maximum testosterone (19/87±10/72 ng/ml) in the test group 2 in summer and minimum16/0±0/02 ng/ml) in the test group 1, were determined and had significant difference in all seasons (p0.05 (0/03±0/01 ng/ml) in the test group 1 was observed in winter that a significant difference between groups showed at fall (P0.05). Maximum and minimum levels of the hormone 17-beta estradiol in the test group 2 was observed in autumn (12/37±7/23 ng/ml), respectively (p0.05). The results of plasma metabolites (glucose, cholesterol, triglycerides and total lipid in the male test groups had suggested that the maximum and minimum of glucose in the test group 1 was (75/25±8/71 mg/dl) in winter and (39/5±6/71 mg / dl) summer, respectively. Maximum and minimum levels of cholesterol in group 1 was observed in autumn (128/75±54/34 mg/dl) and in winter (74/5±8/19 mg/dl), respectively. Maximum and minimum amount of triglycerides in the test group 2 observed in winter (384/75±50/93 mg/dl) and (156/25±16/34 mg / dl) in spring, so that in the spring between the groups showed significant difference (p0.05). Maximum total lipid in the test group 2 was observed in summer (686/25 ± 83/27 mg/dl) and minimum in the test group 1 in spring (410±62/03 mg/dl). Maximum and minimum glucose levels in a female group was observed in winter (82/7±11/55 mg/dl) and autumn (27/6±6 /41 mg/dl), respectively. The maximum cholesterol amount of the test group 1 was observed in winter (87±3/66 mg/dl) and minimum in the test group 2 in autumn (63/5±5/23 mg/dl). Maximum and minimum amount of triglycerides in the test group 2 was in the spring (281±33/67 mg/dl) and its minimum in autumn (213/75 ± 32/44 mg/dl), respectively, so that in the spring showed significant difference between the groups (p0.05).Maximum total lipid amount was in the test group 2 in spring (554/7±31/59 mg/dl) and minimum in the test group 1 in winter (367±21/22 mg/dl) and in summer between groups significant difference was observed (p0.05). The results of calcium and sodium cations and osmolarity in males suggested that calcium in females and sodium in males showed significant difference related to sexual maturation stage (P0.05). But osmolarity didn t show significant difference in both sex (p0.05).", + "institution": "Iranian Fisheries Research Organization", + "language": "Farsi", + "libraryCatalog": "agris.fao.org", + "url": "https://agris.fao.org/agris-search/search.do?recordID=IR2012044101", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://agris.fao.org/agris-search/search.do?recordID=TH2005000236", + "items": [ + { + "itemType": "journalArticle", + "title": "Efficiency of antimicrobial residue screening test kit for meat CM-Test", + "creators": [ + { + "firstName": "Thongchai", + "lastName": "Chalermchaikit", + "creatorType": "author" + }, + { + "firstName": "Kriengsak", + "lastName": "Poonsook", + "creatorType": "author" + }, + { + "firstName": "Kriengsuk", + "lastName": "Dangprom", + "creatorType": "author" + }, + { + "firstName": "Monthon", + "lastName": "Lertworapreecha", + "creatorType": "author" + }, + { + "firstName": "Kittikorn", + "lastName": "Jotisakulratana", + "creatorType": "author" + } + ], + "date": "2002", + "ISSN": "0125-0369", + "abstractNote": "Concerns of antimicrobial residues in food of animal origins are not only the adverse health effect to consumers but also the impact on exportation. The conventional methods for detecting antimicrobial residues in meat are European Four Pate Test (EDPR) method which use Bacillus subtilis and Micrococcus luteus in Test agar or Microbial Inhibition Disk Assay (MIDA) which use Bacillus mycoides, Bacillus subtilis and Micrococcus luteus in Antibiotic medium as indicators. However, EFPT and MIDA are required incubating time at least 18 hours for reading the results. Besides, EFPT and MIDA have been showed low specificity, which lead to false negative results. Therefore, antimicrobial screening test kit for meat has been developed by the full support from Thai Research Fund (TRF). The concept of new developed antimicrobial screening test kit (CM-Test) is tube diffusion method. There are consisted of Bacillus stearothermophilus in appropriated medium, which contained in polypropylene tube (1*4 cm). The tested results can be read after the meat extract supernatant of 0.1 ml is put into the test kit and incubated at 65+-1 deg C for 3 1/2-4 1/2 hours. The color of test kit will not be changed if the sample is positive (contain antimicrobial residue). If the sample is negative, test kit color will be changed to yellow. The prevalence of antimicrobial residues in 300 chicken meat samples and 300 pork samples, randomly purchased from markets and supermarkets in Bangkok during July 2001 to February 2002, had been studied. The results of chicken meat samples were found positive 12.3, 0 and 1.7 percent by using CM-Test, EFPT and MIDA methods, respectively. The results of pork samples were found positive 8.3, 2 and 2.7 percent by using CM-Test, EFPT and MIDA methods, respectively. Positive samples were confirmed by Charm II Test method. These results reveal that the detection limits developed antimicrobial residue screening test kit are better than conventional methods, EFPT and MIDA.", + "language": "Thai", + "libraryCatalog": "agris.fao.org", + "publicationTitle": "Warasan Witthayasat Kaset", + "url": "https://agris.fao.org/agris-search/search.do?recordID=TH2005000236", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://agris.fao.org/agris-search/search.do?request_locale=ar&recordID=AV20120164931&query=&sourceQuery=&sortField=&sortOrder=&countryResource=&agrovocString=&advQuery=¢erString=&enableField=", + "items": [ + { + "itemType": "report", + "title": "Petroleum Hydrocarbons in Saudi Red Sea Coastal Waters الهيدروكربونات البترولية في المياه السطحية لساحل البحر الاحمر السعودية (منطقة بترومين)", + "creators": [ + { + "firstName": "Sultan", + "lastName": "Al-Lihaibi", + "creatorType": "author" + }, + { + "firstName": "Turki", + "lastName": "Al-Ghamdy", + "creatorType": "author" + } + ], + "date": "1997", + "abstractNote": "Total petroleum hydrocarbons in surface water samples collected from the Red Sea coast al area of Jeddah (Saudi Arabia), have been measured using ultraviolet fluorescence spectroscopy (UVF). Concentration level ranged between 1.79 and 17.9 J..I.g 1,1 light Arabian oil equivalents . Samples taken near the oil terminal (Petromin) showed relatively high concentrations (2.8-17.9 J..I.g I\" 1). whereas in the relatively clean Obhur Creek concentrations wer~ low (2 J..I.g 1- I). Perfect agreement has been obtained between concentrations calculated as chrysene and light Arabian equivalents. However, the light Arabian equivalent concentration is almost 6 times the chrysene equivalent concentration . تم قياس الهيدروكربونات البترولية في المياه السطحية للمنطقة الساحلية لمدينة جدة باستخدام مطياف الفلورة فوق البنفسجية . وجد أن مستوى التركيز في العينات تراوح بين 1.8 و 17.9 مايكروجرام / لتر وحدات زيت عربي خفيف مكافئة . وقد لوحظ أن العينات القريبة من مصرف مصفاة الزيت (بترومين) أعطت تراكيز عالية ( 2.8-17.9 مايكروجرام/ لتر ) بينما أعطت العينات المأخوذة من شرم أبحر ، والذي يعتبر الأنظف نسبيا ، قراءات منخفضة ( 2.0 مايكروجرام / لتر أو أقل ) . كما لوحظ وجود علاقة بين التركيزات المحسوبة على أساس وحدات كرايسين مكافئة وتلك المحسوبة على أساس وحدات زيت عربي خفيف مكافئة بحيث يكون الأخير مساويا لما يقارب 6 أضعاف الأول.", + "institution": "KAU - Scientific Publishing Center", + "language": "English", + "libraryCatalog": "agris.fao.org", + "url": "http://www.kau.edu.sa/centers/spc/jkau/Doc/Mar/8/Petroleum%20Hydrocarbons%20in%20Saudi%20Red%20Sea%20Coastal%20Waters.pdf", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://agris.fao.org/agris-search/searchIndex.do?query=soil+water", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/AIP.js b/translators/AIP.js new file mode 100644 index 0000000..b6a5025 --- /dev/null +++ b/translators/AIP.js @@ -0,0 +1,295 @@ +{ + "translatorID": "48d3b115-7e09-4134-ad5d-0beda6296761", + "label": "AIP", + "creator": "Aurimas Vinckevicius", + "target": "^https?://scitation\\.aip\\.org/(search\\?|content/)", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2015-10-17 17:37:33" +} + +function getSearchResults(doc) { + return doc.getElementsByClassName("resultItem"); +} + +function detectWeb(doc, url) { + if (url.indexOf('search') !== -1 && getSearchResults(doc).length) { + return 'multiple'; + } + + if (ZU.xpathText(doc, '/html/head/meta[@name="citation_journal_title"]/@content')) { + return 'journalArticle'; + } + else if (doc.body.id == 'conferencepaper') return "conferencePaper" +} +function doWeb(doc, url) { + if (detectWeb(doc, url) == 'multiple') { + var results = getSearchResults(doc); + var items = {}; + for (var i=0, n=results.length; i. + + ***** END LICENSE BLOCK ***** +*/ + +function detectWeb(doc, _url) { + var itemType; + if (getSearchResults(doc, true)) { + return "multiple"; + } + else if (ZU.xpathText(doc, '//div[@class="headlineMenu"]/*[last()-1]')) { + itemType = ZU.xpathText(doc, '//div[@class="headlineMenu"]/*[last()-1]'); + switch (itemType.trim().toLowerCase()) { + case 'article': + return "journalArticle"; + case 'book': + return "book"; + case 'chapter': + return "bookSection"; + } + } + return false; +} + + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = ZU.xpath(doc, '//div[@class="headlineText"]'); + for (var i = 0; i < rows.length; i++) { + var href = ZU.xpathText(rows[i], './a[@class="mrnum"]/@href'); + var title = ZU.xpathText(rows[i], './span[@class="title"]'); + 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) { + var host = url.match(/^(.+)\/mathscinet/); + var pub = host[0] + "/search/publications.html?fmt=bibtex"; + var MR = ZU.xpathText(doc, '//div[@id="content"]/div[@class="doc"]/div[@class="headline"]/strong[1]'); + pub += "&pg1=MR&s1=" + MR.replace(/^MR0*/, ""); + + let text = await requestText(pub); + var preRE = /
\s*([\s\S]*?)\s*<\/pre>/g;
+	var bibTeXString = "";
+		
+	var m;
+	//eslint-disable-next-line no-cond-assign
+	while (m = preRE.exec(text)) {
+		bibTeXString += m[1] + '\n';
+	}
+		
+	// import using BibTeX
+	let translator = Zotero.loadTranslator("import");
+	translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4");
+	translator.setString(bibTeXString);
+	translator.setHandler("itemDone", function (obj, item) {
+		// Fix/fetch MR number
+		var mrnumber;
+		if (item.extra) {
+			item.extra = item.extra.replace(/^MR:\s*(?:MR)?(\d+).*/gm,
+				function (m, mr) {
+					mrnumber = mr;
+					return 'MR: ' + mr;
+				});
+		}
+			
+		if (mrnumber) {
+			url = 'https://mathscinet.ams.org/mathscinet-getitem?mr=' + mrnumber;
+		}
+		item.attachments.push({ title: "MathSciNet Snapshot", document: doc });
+		item.url = url;
+		item.complete();
+	});
+	await translator.translate();
+}
+
+/** BEGIN TEST CASES **/
+var testCases = [
+	{
+		"type": "web",
+		"url": "https://mathscinet.ams.org/mathscinet/search/publications.html?pg4=AUCN&s4=Karcher&co4=AND&pg5=TI&s5=&co5=AND&pg6=PC&s6=&co6=AND&pg7=ALLF&s7=&co7=AND&Submit=Search&dr=all&yrop=eq&arg3=&yearRangeFirst=&yearRangeSecond=&pg8=ET&s8=All&review_format=html",
+		"items": "multiple"
+	},
+	{
+		"type": "web",
+		"url": "https://mathscinet.ams.org/mathscinet/2006/mathscinet/search/publdoc.html?arg3=&co4=AND&co5=AND&co6=AND&co7=AND&dr=all&pg4=MR&pg5=TI&pg6=PC&pg7=ALLF&pg8=ET&r=1&review_format=html&s4=3004573",
+		"items": [
+			{
+				"itemType": "journalArticle",
+				"title": "Extrapolation of stable random fields",
+				"creators": [
+					{
+						"firstName": "Wolfgang",
+						"lastName": "Karcher",
+						"creatorType": "author"
+					},
+					{
+						"firstName": "Elena",
+						"lastName": "Shmileva",
+						"creatorType": "author"
+					},
+					{
+						"firstName": "Evgeny",
+						"lastName": "Spodarev",
+						"creatorType": "author"
+					}
+				],
+				"date": "2013",
+				"DOI": "10.1016/j.jmva.2012.11.004",
+				"ISSN": "0047-259X",
+				"extra": "MR: 3004573",
+				"itemID": "MR3004573",
+				"journalAbbreviation": "J. Multivariate Anal.",
+				"libraryCatalog": "AMS MathSciNet (Legacy)",
+				"pages": "516–536",
+				"publicationTitle": "Journal of Multivariate Analysis",
+				"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=3004573",
+				"volume": "115",
+				"attachments": [
+					{
+						"title": "MathSciNet Snapshot",
+						"mimeType": "text/html"
+					}
+				],
+				"tags": [],
+				"notes": [],
+				"seeAlso": []
+			}
+		]
+	},
+	{
+		"type": "web",
+		"url": "https://mathscinet.ams.org/mathscinet/search/publications.html?pg1=ISSI&s1=308850",
+		"items": "multiple"
+	},
+	{
+		"type": "web",
+		"url": "https://mathscinet.ams.org/mathscinet/2006/mathscinet/search/publdoc.html?arg3=&co4=AND&co5=AND&co6=AND&co7=AND&dr=all&pg4=MR&pg5=TI&pg6=PC&pg7=ALLF&pg8=ET&r=1&review_format=html&s4=2767535",
+		"items": [
+			{
+				"itemType": "bookSection",
+				"title": "On implementation of the Markov chain Monte Carlo stochastic approximation algorithm",
+				"creators": [
+					{
+						"firstName": "Yihua",
+						"lastName": "Jiang",
+						"creatorType": "author"
+					},
+					{
+						"firstName": "Peter",
+						"lastName": "Karcher",
+						"creatorType": "author"
+					},
+					{
+						"firstName": "Yuedong",
+						"lastName": "Wang",
+						"creatorType": "author"
+					}
+				],
+				"date": "2011",
+				"bookTitle": "Advances in directional and linear statistics",
+				"extra": "MR: 2767535\nDOI: 10.1007/978-3-7908-2628-9_7",
+				"itemID": "MR2767535",
+				"libraryCatalog": "AMS MathSciNet (Legacy)",
+				"pages": "97–111",
+				"publisher": "Physica-Verlag/Springer, Heidelberg",
+				"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=2767535",
+				"attachments": [
+					{
+						"title": "MathSciNet Snapshot",
+						"mimeType": "text/html"
+					}
+				],
+				"tags": [],
+				"notes": [],
+				"seeAlso": []
+			}
+		]
+	},
+	{
+		"type": "web",
+		"url": "https://mathscinet.ams.org/mathscinet/2006/mathscinet/search/publdoc.html?arg3=&co4=AND&co5=AND&co6=AND&co7=AND&dr=all&pg4=MR&pg5=TI&pg6=PC&pg7=ALLF&pg8=ET&r=1&review_format=html&s4=2663710",
+		"items": [
+			{
+				"itemType": "book",
+				"title": "Advances in directional and linear statistics",
+				"creators": [
+					{
+						"firstName": "Martin T.",
+						"lastName": "Wells",
+						"creatorType": "editor"
+					},
+					{
+						"firstName": "Ashis",
+						"lastName": "SenGupta",
+						"creatorType": "editor"
+					}
+				],
+				"date": "2011",
+				"ISBN": "9783790826272",
+				"extra": "MR: 2663710\nDOI: 10.1007/978-3-7908-2628-9",
+				"itemID": "MR2663710",
+				"libraryCatalog": "AMS MathSciNet (Legacy)",
+				"numPages": "xiv+321",
+				"publisher": "Physica-Verlag/Springer, Heidelberg",
+				"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=2663710",
+				"attachments": [
+					{
+						"title": "MathSciNet Snapshot",
+						"mimeType": "text/html"
+					}
+				],
+				"tags": [],
+				"notes": [
+					{
+						"note": "

A Festschrift for Sreenivasa Rao Jammalamadaka

" + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://mathscinet.ams.org/mathscinet-getitem?mr=1346201", + "items": [ + { + "itemType": "journalArticle", + "title": "Sommation des séries divergentes", + "creators": [ + { + "firstName": "Bernard", + "lastName": "Malgrange", + "creatorType": "author" + } + ], + "date": "1995", + "ISSN": "0723-0869", + "extra": "MR: 1346201", + "issue": "2-3", + "itemID": "MR1346201", + "journalAbbreviation": "Exposition. Math.", + "libraryCatalog": "AMS MathSciNet", + "pages": "163–222", + "publicationTitle": "Expositiones Mathematicae. International Journal", + "url": "https://mathscinet.ams.org/mathscinet-getitem?mr=1346201", + "volume": "13", + "attachments": [ + { + "title": "MathSciNet Snapshot" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/AMS MathSciNet.js b/translators/AMS MathSciNet.js new file mode 100644 index 0000000..a863e08 --- /dev/null +++ b/translators/AMS MathSciNet.js @@ -0,0 +1,288 @@ +{ + "translatorID": "16f2936d-a059-40e8-a48e-f0acbb1e93e0", + "label": "AMS MathSciNet", + "creator": "Sebastian Karcher", + "target": "^https?://mathscinet\\.ams\\.[^/]*/mathscinet/(article\\?|publications-search\\?|author\\?)", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-07-14 11:04:37" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2023 Sebastian Karcher + + 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) { + if (getSearchResults(doc, true)) { + return "multiple"; + } + else if (url.includes("article?mr=")) { + if (doc.querySelector('div[data-testid="ap-book-isbn"]')) { + if (doc.querySelector('div[data-testid="ap-book-collection"] a.router-link-active')) return "bookSection"; + else return "book"; + } + else return "journalArticle"; + } + else return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('.results div.font-weight-bold'); + for (let row of rows) { + let href = attr(row, 'a', 'href'); + 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) { + let id = url.match(/\?mr=(\d+)/); + if (!id) { + throw new Error("No MR ID, can't proceed"); + } + let bibJSONUrl = '/mathscinet/api/publications/format?formats=bib&ids=' + id[1]; + // Z.debug(bibJSONUrl) + let bibJSON = await requestText(bibJSONUrl); + // Z.debug(bibJSON) + bibJSON = JSON.parse(bibJSON); + let bibTex = bibJSON[0].bib; + // Z.debug(bibTex) + let translator = Zotero.loadTranslator("import"); + translator.setTranslator('9cb70025-a888-4a29-a210-93ec52da40d4'); + translator.setString(bibTex); + translator.setHandler('itemDone', (_obj, item) => { + item.url = ""; // these aren't full text URLs + item.attachments.push({ + title: 'Snapshot', + document: doc + }); + item.complete(); + }); + await translator.translate(); +} + + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://mathscinet.ams.org/mathscinet/article?mr=3004573", + "items": [ + { + "itemType": "journalArticle", + "title": "Extrapolation of stable random fields", + "creators": [ + { + "firstName": "Wolfgang", + "lastName": "Karcher", + "creatorType": "author" + }, + { + "firstName": "Elena", + "lastName": "Shmileva", + "creatorType": "author" + }, + { + "firstName": "Evgeny", + "lastName": "Spodarev", + "creatorType": "author" + } + ], + "date": "2013", + "DOI": "10.1016/j.jmva.2012.11.004", + "ISSN": "0047-259X,1095-7243", + "extra": "MR: 3004573", + "itemID": "MR3004573", + "journalAbbreviation": "J. Multivariate Anal.", + "libraryCatalog": "AMS MathSciNet", + "pages": "516–536", + "publicationTitle": "Journal of Multivariate Analysis", + "volume": "115", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://mathscinet.ams.org/mathscinet/article?mr=2767535", + "items": [ + { + "itemType": "bookSection", + "title": "On implementation of the Markov chain Monte Carlo stochastic approximation algorithm", + "creators": [ + { + "firstName": "Yihua", + "lastName": "Jiang", + "creatorType": "author" + }, + { + "firstName": "Peter", + "lastName": "Karcher", + "creatorType": "author" + }, + { + "firstName": "Yuedong", + "lastName": "Wang", + "creatorType": "author" + } + ], + "date": "2011", + "ISBN": "9783790826272", + "bookTitle": "Advances in directional and linear statistics", + "extra": "MR: 2767535\nDOI: 10.1007/978-3-7908-2628-9_7", + "itemID": "MR2767535", + "libraryCatalog": "AMS MathSciNet", + "pages": "97–111", + "publisher": "Physica-Verlag/Springer, Heidelberg", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://mathscinet.ams.org/mathscinet/article?mr=2663710", + "items": [ + { + "itemType": "book", + "title": "Advances in directional and linear statistics", + "creators": [ + { + "firstName": "Martin T.", + "lastName": "Wells", + "creatorType": "editor" + }, + { + "firstName": "Ashis", + "lastName": "SenGupta", + "creatorType": "editor" + } + ], + "date": "2011", + "ISBN": "9783790826272", + "extra": "MR: 2663710\nDOI: 10.1007/978-3-7908-2628-9", + "itemID": "MR2663710", + "libraryCatalog": "AMS MathSciNet", + "numPages": "xiv+321", + "publisher": "Physica-Verlag/Springer, Heidelberg", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [ + { + "note": "

A Festschrift for Sreenivasa Rao Jammalamadaka

" + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://mathscinet.ams.org/mathscinet/article?mr=1346201", + "items": [ + { + "itemType": "journalArticle", + "title": "Sommation des séries divergentes", + "creators": [ + { + "firstName": "Bernard", + "lastName": "Malgrange", + "creatorType": "author" + } + ], + "date": "1995", + "ISSN": "0723-0869", + "extra": "MR: 1346201", + "issue": "2-3", + "itemID": "MR1346201", + "journalAbbreviation": "Exposition. Math.", + "libraryCatalog": "AMS MathSciNet", + "pages": "163–222", + "publicationTitle": "Expositiones Mathematicae. International Journal", + "volume": "13", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://mathscinet.ams.org/mathscinet/publications-search?query=karcher&page=1&size=20&sort=newest&facets=", + "items": "multiple" + }, + { + "type": "web", + "url": "https://mathscinet.ams.org/mathscinet/author?authorId=98350", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/APA PsycNET.js b/translators/APA PsycNET.js new file mode 100644 index 0000000..a319a11 --- /dev/null +++ b/translators/APA PsycNET.js @@ -0,0 +1,915 @@ +{ + "translatorID": "1e1e35be-6264-45a0-ad2e-7212040eb984", + "label": "APA PsycNet", + "creator": "Philipp Zumstein", + "target": "^https?://(psycnet|doi)\\.apa\\.org/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2025-03-10 19:48:42" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2017-2021 Philipp Zumstein + + 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 ***** +*/ + + +// Some test cases are only working in the browser with some AJAX loading: +// 1) http://psycnet.apa.org/PsycBOOKS/toc/10023 +// 2) follow a link in a search +// 3) search page +// 4) journal page +// +// Moreover, after three test cases you have to load an psycnet url in the browser +// to avoid some automatic download detection. + + +function detectWeb(doc, url) { + if (url.includes('/search/display?') + || url.includes('/record/') + || url.includes('/fulltext/') + || url.includes('/buy/') + || url.includes('/doiLanding?doi=')) { + if (attr(doc, 'meta[name="og:type"]', 'content') == 'Chapter') { + return "bookSection"; + } + else if (doc.getElementById('bookchapterstoc')) { + return "book"; + } + else { + return "journalArticle"; + } + } + if (url.includes('/search/results?') || url.includes('/journal/')) { // && getSearchResults(doc, true)) { + return "multiple"; + } + + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('a.article-title'); + for (var i = 0; i < rows.length; i++) { + var href = rows[i].href; + var title = ZU.trimInternal(rows[i].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), url); + } + } + else { + await scrape(doc, url); + } +} + + +async function scrape(doc, url) { + var uid = await getIds(doc, url.replace(/#.*$/, '')); + if (!uid) { + throw new Error("ID not found"); + } + + var productCode; + var db = doc.getElementById('database') || doc.querySelector('doi-landing .meta span'); + if (db) { + db = db.parentNode.textContent.toLowerCase(); + if (db.includes('psycarticles')) { + productCode = 'PA'; + } + else if (db.includes('psycbooks')) { + productCode = 'PB'; + } + else if (db.includes('psycinfo')) { + productCode = 'PI'; + } + else if (db.includes('psycextra')) { + productCode = 'PE'; + } + } + else { + // default, e.g. if page is not completely loaded + productCode = 'PI'; + } + + var postData = JSON.stringify({ + api: "record.exportRISFile", + params: { + UIDList: [{ UID: uid, ProductCode: productCode }], + exportType: "zotero" + } + }); + var headers = { + 'Content-Type': 'application/json', + Referer: url + }; + + let apiReturnData = await requestJSON('/api/request/record.exportRISFile', { + method: 'POST', + headers: headers, + body: postData, + }); + + if (apiReturnData && apiReturnData.isRisExportCreated) { + // 2. Download the requested data (after step 1) + let data = await requestText('/ris/download'); + if (data.includes('Content: application/x-research-info-systems')) { + await processRIS(data, doc); + } + else { + // sometimes (e.g. during testing) the data is not loaded + // but a meta redirect to a captcha page mentioning + Z.debug("The APA anomaly detection think we are doing " + + "something unusual (sigh). Please reload any APA page e.g. " + + "http://psycnet.apa.org/ in your browser and try again."); + Z.debug(data); + } + } +} + + +async function processRIS(text, doc) { + let pdfURL = attr(doc, 'a[href*="/fulltext"]', 'href'); + if (!pdfURL) { + Zotero.debug('Fetching institution ID for PDF'); + try { + let uid = doc.location.pathname.match(/\/(?:record|fulltext)\/([^/.]+)/)[1]; + let { institution } = await requestJSON( + 'https://psycnet.apa.org/api/request/institution.getInstitutionByIpAddress', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + api: 'institution.getInstitutionByIpAddress', + params: { uid } + }) + } + ); + if (institution) { + pdfURL = `https://psycnet.apa.org/fulltext/${uid}.pdf?auth_id=${institution.ringGoldId}&returnUrl=${encodeURIComponent(doc.location.href)}`; + } + } + catch (e) { + Zotero.debug('Failed to fetch institution ID'); + Zotero.debug(e); + } + } + + var translator = Zotero.loadTranslator("import"); + translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); + translator.setString(text); + translator.setHandler("itemDone", function (obj, item) { + item.title = cleanTitle(item.title); + if (item.publication) item.publication = cleanTitle(item.publication); + if (item.bookTitle) item.bookTitle = cleanTitle(item.bookTitle); + if (item.series) item.series = cleanTitle(item.series); + if (item.place) item.place = item.place.replace(/\s+/g, ' '); + if (item.ISSN) item.ISSN = ZU.cleanISSN(item.ISSN); + if (item.pages && item.pages.includes('No Pagination Specified')) { + delete item.pages; + } + for (var i = 0; i < item.tags.length; i++) { + item.tags[i] = item.tags[i].replace(/^\*/, ''); + } + if (pdfURL) { + item.attachments.push({ + url: pdfURL, + title: "Full Text PDF", + mimeType: "application/pdf" + }); + } + else { + item.attachments.push({ + title: "Snapshot", + document: doc + }); + } + item.complete(); + }); + await translator.translate(); +} + + +// try to figure out ids that we can use for fetching RIS +async function getIds(doc, url) { + Z.debug('Finding IDs in ' + url); + // try to extract uid from the table + var uid = text(doc, '#uid + dd') || text(doc, '#bookUID'); + if (uid) { + return uid; + } + + // try to extract uid from the url + if (url.includes('/record/') || url.includes('/fulltext/')) { + let m = url.match(/\/(?:record|fulltext)\/([\d-]*)/); + if (m && m[1]) { + return m[1]; + } + } + + // DOI landing pages include a link to the /record/ page + if (url.includes('/doiLanding') && doc.querySelector('.title > a')) { + let m = attr(doc, '.title > a', 'href').match(/\/record\/([\d-]*)/); + if (m && m[1]) { + return m[1]; + } + } + + /** on the book pages, we can find the UID in + * the Front matter and Back matter links + */ + if (url.includes('/PsycBOOKS/')) { + var link = attr(doc, '.bookMatterLinks a', 'href'); + if (link) { + let m = link.match(/\/fulltext\/([^&]+?)-(?:FRM|BKM)/i); + if (m && m[1]) { + return m[1]; + } + } + } + + /** for pages with buy.optionToBuy + * we can fetch the id from the url + * alternatively, the id is in a javascript section (this is messy) + */ + if (url.includes('/buy/')) { + let m = url.match(/\/buy\/([\d-]*)/); + if (m) { + return m[1]; + } + + m = doc.documentElement.textContent.match(/\bitemUID\s*=\s*(['"])(.*?)\1/); + if (m && m[2]) { + return m[2]; + } + } + + /** check for a purchase link + */ + var purchaseLink = attr(doc, 'a.purchase[href*="/buy/"]', 'href'); + if (purchaseLink) { + let m = purchaseLink.match(/\/buy\/([\d-]*)/); + return m[1]; + } + + // Worst-case fallback if we're on a search result page: make some requests + if (url.includes('/search/display?')) { + let searchParams = new URL(url).searchParams; + let id = searchParams.get('id'); + if (id) { + let searchObj = await requestJSON('/api/request/recentSearch.get', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + api: 'recentSearch.get', + params: { + id + } + }) + }); + let recordId = parseInt(searchParams.get('recordId')); + let recordWithCount = await requestJSON('/api/request/search.recordWithCount', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + api: 'search.recordWithCount', + params: { + ...searchObj, + responseParameters: { + ...searchObj.responseParameters, + start: recordId - 1, + rows: 1 + } + } + }) + }); + return recordWithCount.results.result.doc[0].UID; + } + } + + return false; +} + + +function cleanTitle(title) { + // delete point at the end of a title, + // except it looks like an abbreviation + if (/\b\w\.$/.test(title)) { + return title; + } + else { + return title.replace(/\.$/, ''); + } +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://psycnet.apa.org/record/2004-16644-010", + "items": [ + { + "itemType": "journalArticle", + "title": "Neuropsychology of Adults With Attention-Deficit/Hyperactivity Disorder: A Meta-Analytic Review", + "creators": [ + { + "lastName": "Hervey", + "firstName": "Aaron S.", + "creatorType": "author" + }, + { + "lastName": "Epstein", + "firstName": "Jeffery N.", + "creatorType": "author" + }, + { + "lastName": "Curry", + "firstName": "John F.", + "creatorType": "author" + } + ], + "date": "2004", + "DOI": "10.1037/0894-4105.18.3.485", + "ISSN": "1931-1559", + "abstractNote": "A comprehensive, empirically based review of the published studies addressing neuropsychological performance in adults diagnosed with attention-deficit/hyperactivity disorder (ADHD) was conducted to identify patterns of performance deficits. Findings from 33 published studies were submitted to a meta-analytic procedure producing sample-size-weighted mean effect sizes across test measures. Results suggest that neuropsychological deficits are expressed in adults with ADHD across multiple domains of functioning, with notable impairments in attention, behavioral inhibition, and memory, whereas normal performance is noted in simple reaction time. Theoretical and developmental considerations are discussed, including the role of behavioral inhibition and working memory impairment. Future directions for research based on these findings are highlighted, including further exploration of specific impairments and an emphasis on particular tests and testing conditions. (PsycInfo Database Record (c) 2022 APA, all rights reserved)", + "issue": "3", + "libraryCatalog": "APA PsycNet", + "pages": "485-503", + "publicationTitle": "Neuropsychology", + "shortTitle": "Neuropsychology of Adults With Attention-Deficit/Hyperactivity Disorder", + "volume": "18", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "Attention Deficit Disorder with Hyperactivity" + }, + { + "tag": "Behavioral Inhibition" + }, + { + "tag": "Empirical Methods" + }, + { + "tag": "Experimentation" + }, + { + "tag": "Hyperactivity" + }, + { + "tag": "Inhibition (Personality)" + }, + { + "tag": "Neuropsychological Assessment" + }, + { + "tag": "Neuropsychology" + }, + { + "tag": "Reaction Time" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://psycnet.apa.org/record/1956-05944-001", + "items": [ + { + "itemType": "journalArticle", + "title": "Factor analysis of meaning", + "creators": [ + { + "lastName": "Osgood", + "firstName": "Charles E.", + "creatorType": "author" + }, + { + "lastName": "Suci", + "firstName": "George J.", + "creatorType": "author" + } + ], + "date": "1955", + "DOI": "10.1037/h0043965", + "ISSN": "0022-1015", + "abstractNote": "Two factor analytic studies of meaningful judgments based upon the same sample of 50 bipolar descriptive scales are reported. Both analyses reveal three major connotative factors: evaluation, potency, and activity. These factors appear to be independent dimensions of the semantic space within which the meanings of concepts may be specified. (PsycINFO Database Record (c) 2016 APA, all rights reserved)", + "issue": "5", + "libraryCatalog": "APA PsycNet", + "pages": "325-338", + "publicationTitle": "Journal of Experimental Psychology", + "volume": "50", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "Factor Analysis" + }, + { + "tag": "Factor Structure" + }, + { + "tag": "Judgment" + }, + { + "tag": "Meaning" + }, + { + "tag": "Semantics" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://psycnet.apa.org/record/1992-98221-010", + "defer": true, + "items": [ + { + "itemType": "bookSection", + "title": "Catatonia: Tonic immobility: Evolutionary underpinnings of human catalepsy and catatonia", + "creators": [ + { + "lastName": "Gallup Jr.", + "firstName": "Gordon G.", + "creatorType": "author" + }, + { + "lastName": "Maser", + "firstName": "Jack D.", + "creatorType": "author" + } + ], + "date": "1977", + "ISBN": "9780716703686 9780716703679", + "abstractNote": "tonic immobility [animal hypnosis] might be a useful laboratory analog or research model for catatonia / we have been collaborating on an interdisciplinary program of research in an effort to pinpoint the behavioral antecedents and biological bases for tonic immobility / attempt to briefly summarize our findings, and . . . discuss the implications of these data in terms of the model characteristics of tonic immobility / hypnosis / catatonia, catalepsy, and cataplexy / tonic immobility as a model for catatonia / fear potentiation / fear alleviation / fear or arousal / learned helplessness / neurological correlates / pharmacology and neurochemistry / genetic underpinnings / evolutionary considerations / implications for human psychopathology (PsycInfo Database Record (c) 2022 APA, all rights reserved)", + "bookTitle": "Psychopathology: Experimental models", + "libraryCatalog": "APA PsycNet", + "pages": "334-357", + "place": "New York, NY, US", + "publisher": "W H Freeman/Times Books/ Henry Holt & Co", + "series": "A series of books in psychology", + "shortTitle": "Catatonia", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "Animal Models" + }, + { + "tag": "Catalepsy" + }, + { + "tag": "Catatonia" + }, + { + "tag": "Fear" + }, + { + "tag": "Genetics" + }, + { + "tag": "Neurology" + }, + { + "tag": "Pharmacology" + }, + { + "tag": "Tonic Immobility" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://psycnet.apa.org/record/2004-16329-000?doi=1", + "defer": true, + "items": [ + { + "itemType": "book", + "title": "The abnormal personality: A textbook", + "creators": [ + { + "lastName": "White", + "firstName": "Robert W.", + "creatorType": "author" + } + ], + "date": "1948", + "abstractNote": "The author's intent is to write about abnormal people in a way that will be valuable and interesting to students new to the subject. A first course in abnormal psychology is not intended to train specialists. Its goal is more general: it should provide the student with the opportunity to whet his interest, expand his horizons, register a certain body of new facts, and relate this to the rest of his knowledge about mankind. I have tried to present the subject in such a way as to emphasize its usefulness to all students of human nature. I have tried the experiment of writing two introductory chapters, one historical and the other clinical. This reflects my desire to set the subject-matter in a broad perspective and at the same time to anchor it in concrete fact. Next comes a block of six chapters designed to set forth the topics of maladjustment and neurosis. The two chapters on psychotherapy complete the more purely psychological or developmental part of the work. In the final chapter the problem of disordered personalities is allowed to expand to its full social dimensions. Treatment, care, and prevention call for social effort and social organization. I have sought to show some of the lines, both professional and nonprofessional, along which this effort can be expended. (PsycInfo Database Record (c) 2022 APA, all rights reserved)", + "extra": "DOI: 10.1037/10023-000", + "libraryCatalog": "APA PsycNet", + "numPages": "x, 617", + "place": "New York, NY, US", + "publisher": "Ronald Press Company", + "series": "The abnormal personality: A textbook", + "shortTitle": "The abnormal personality", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "Abnormal Psychology" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://psycnet.apa.org/fulltext/2022-40433-002.html", + "items": [ + { + "itemType": "journalArticle", + "title": "Expertise in emotion: A scoping review and unifying framework for individual differences in the mental representation of emotional experience", + "creators": [ + { + "lastName": "Hoemann", + "firstName": "Katie", + "creatorType": "author" + }, + { + "lastName": "Nielson", + "firstName": "Catie", + "creatorType": "author" + }, + { + "lastName": "Yuen", + "firstName": "Ashley", + "creatorType": "author" + }, + { + "lastName": "Gurera", + "firstName": "J. W.", + "creatorType": "author" + }, + { + "lastName": "Quigley", + "firstName": "Karen S.", + "creatorType": "author" + }, + { + "lastName": "Barrett", + "firstName": "Lisa Feldman", + "creatorType": "author" + } + ], + "date": "2021", + "DOI": "10.1037/bul0000327", + "ISSN": "1939-1455", + "abstractNote": "Expertise refers to outstanding skill or ability in a particular domain. In the domain of emotion, expertise refers to the observation that some people are better at a range of competencies related to understanding and experiencing emotions, and these competencies may help them lead healthier lives. These individual differences are represented by multiple constructs including emotional awareness, emotional clarity, emotional complexity, emotional granularity, and emotional intelligence. These constructs derive from different theoretical perspectives, highlight different competencies, and are operationalized and measured in different ways. The full set of relationships between these constructs has not yet been considered, hindering scientific progress and the translation of findings to aid mental and physical well-being. In this article, we use a scoping review procedure to integrate these constructs within a shared conceptual space. Scoping reviews provide a principled means of synthesizing large and diverse literature in a transparent fashion, enabling the identification of similarities as well as gaps and inconsistencies across constructs. Using domain-general accounts of expertise as a guide, we build a unifying framework for expertise in emotion and apply this to constructs that describe how people understand and experience their own emotions. Our approach offers opportunities to identify potential mechanisms of expertise in emotion, encouraging future research on those mechanisms and on educational or clinical interventions. (PsycInfo Database Record (c) 2023 APA, all rights reserved)", + "issue": "11", + "libraryCatalog": "APA PsycNet", + "pages": "1159-1183", + "publicationTitle": "Psychological Bulletin", + "shortTitle": "Expertise in emotion", + "volume": "147", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "Alexithymia" + }, + { + "tag": "Awareness" + }, + { + "tag": "Conceptual Imagery" + }, + { + "tag": "Creativity" + }, + { + "tag": "Emotional Intelligence" + }, + { + "tag": "Emotions" + }, + { + "tag": "Experience Level" + }, + { + "tag": "Experiences (Events)" + }, + { + "tag": "Individual Differences" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://psycnet.apa.org/buy/2004-16329-002", + "defer": true, + "items": [ + { + "itemType": "bookSection", + "title": "Clinical introduction: Examples of disordered personalities", + "creators": [ + { + "lastName": "White", + "firstName": "Robert W.", + "creatorType": "author" + } + ], + "date": "1948", + "abstractNote": "This chapter examines some representative examples of disordered personalities. The reader should be forewarned that the five cases described here will be frequently referred to in later chapters of the book. They display to advantage many of the problems and principles that will occupy us when we undertake to build up a systematic account of abnormal psychology. It will be assumed that the cases given in this chapter are well remembered, and with this in mind the reader should not only go through them but study and compare them rather carefully. The main varieties of disordered personalities and student attitudes toward abnormality are discussed before the case histories are presented. (PsycINFO Database Record (c) 2016 APA, all rights reserved)", + "bookTitle": "The abnormal personality: A textbook", + "extra": "DOI: 10.1037/10023-002", + "libraryCatalog": "APA PsycNET", + "pages": "54-101", + "place": "New York, NY, US", + "publisher": "Ronald Press Company", + "shortTitle": "Clinical introduction", + "attachments": [ + { + "title": "Snapshot" + } + ], + "tags": [ + { + "tag": "Abnormal Psychology" + }, + { + "tag": "Personality Disorders" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://psycnet.apa.org/record/2010-19350-001", + "items": [ + { + "itemType": "journalArticle", + "title": "Predicting behavior in economic games by looking through the eyes of the players", + "creators": [ + { + "lastName": "Mellers", + "firstName": "Barbara A.", + "creatorType": "author" + }, + { + "lastName": "Haselhuhn", + "firstName": "Michael P.", + "creatorType": "author" + }, + { + "lastName": "Tetlock", + "firstName": "Philip E.", + "creatorType": "author" + }, + { + "lastName": "Silva", + "firstName": "José C.", + "creatorType": "author" + }, + { + "lastName": "Isen", + "firstName": "Alice M.", + "creatorType": "author" + } + ], + "date": "2010", + "DOI": "10.1037/a0020280", + "ISSN": "1939-2222", + "abstractNote": "Social scientists often rely on economic experiments such as ultimatum and dictator games to understand human cooperation. Systematic deviations from economic predictions have inspired broader conceptions of self-interest that incorporate concerns for fairness. Yet no framework can describe all of the major results. We take a different approach by asking players directly about their self-interest—defined as what they want to do (pleasure-maximizing options). We also ask players directly about their sense of fairness—defined as what they think they ought to do (fairness-maximizing options). Player-defined measures of self-interest and fairness predict (a) the majority of ultimatum-game and dictator-game offers, (b) ultimatum-game rejections, (c) exiting behavior (i.e., escaping social expectations to cooperate) in the dictator game, and (d) who cooperates more after a positive mood induction. Adopting the players' perspectives of self-interest and fairness permits better predictions about who cooperates, why they cooperate, and when they punish noncooperators. (PsycINFO Database Record (c) 2016 APA, all rights reserved)", + "issue": "4", + "libraryCatalog": "APA PsycNet", + "pages": "743-755", + "publicationTitle": "Journal of Experimental Psychology: General", + "volume": "139", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "Behavior" + }, + { + "tag": "Cooperation" + }, + { + "tag": "Economics" + }, + { + "tag": "Emotional States" + }, + { + "tag": "Games" + }, + { + "tag": "Prediction" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://psycnet.apa.org/record/2010-09295-002", + "defer": true, + "items": [ + { + "itemType": "bookSection", + "title": "The self in vocational psychology: Object, subject, and project", + "creators": [ + { + "lastName": "Savickas", + "firstName": "Mark L.", + "creatorType": "author" + } + ], + "date": "2011", + "ISBN": "9781433808616 9781433808623", + "abstractNote": "In this chapter, I seek to redress vocational psychology’s inattention to the self and address the ambiguity of the meaning of self. To begin, I offer a chronological survey of vocational psychology’s three main views of human singularity. During succeeding historical eras, different aspects of human singularity interested vocational psychologists, so they developed a new set of terms and concepts to deal with shifts in the meaning of individuality. Over time, vocational psychology developed what Kuhn (2000) referred to as language communities, each with its own paradigm for understanding the self and vocational behavior. Because the self is fundamentally ambiguous, adherents to each paradigm describe it with an agreed on language and metaphors. Thus, each paradigm has a textual tradition, or way of talking about the self. As readers shall see, when they talk about individuals, differentialists use the language of personality, developmentalists use the language of personhood, and constructionists use the language of identity. (PsycInfo Database Record (c) 2024 APA, all rights reserved)", + "bookTitle": "Developing self in work and career: Concepts, cases, and contexts", + "extra": "DOI: 10.1037/12348-002", + "libraryCatalog": "APA PsycNet", + "pages": "17-33", + "place": "Washington, DC, US", + "publisher": "American Psychological Association", + "shortTitle": "The self in vocational psychology", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Occupational Guidance" + }, + { + "tag": "Personality" + }, + { + "tag": "Self-Concept" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://psycnet.apa.org/record/2025-80032-001?doi=1", + "items": [ + { + "itemType": "journalArticle", + "title": "Linking adolescent bullying perpetration with adult fertility: Two preliminary studies", + "creators": [ + { + "lastName": "Volk", + "firstName": "Anthony A.", + "creatorType": "author" + }, + { + "lastName": "Brazil", + "firstName": "Kristopher J.", + "creatorType": "author" + }, + { + "lastName": "Dane", + "firstName": "Andrew V.", + "creatorType": "author" + }, + { + "lastName": "Vaillancourt", + "firstName": "Tracy", + "creatorType": "author" + }, + { + "lastName": "Al-Jbouri", + "firstName": "Elizabeth", + "creatorType": "author" + }, + { + "lastName": "Farrell", + "firstName": "Ann H.", + "creatorType": "author" + } + ], + "date": "2025", + "DOI": "10.1037/ebs0000374", + "ISSN": "2330-2933", + "abstractNote": "Researchers have suggested that bullying perpetration is, at least in part, an evolved adaptation. A key prediction of this evolutionary perspective is that bullying facilitates the transmission of genes from one generation to the next. To date, only one study (using a limited measure of bullying) has examined the link between adolescent bullying and adult fertility, showing a positive association between adolescent bullying and number of children in adulthood. We sought to replicate and expand this unique finding using a more robust measure of adolescent bullying and young adults’ parental status in a prospective longitudinal study of Canadians (Study 1), along with an MTurk study of retrospective adolescent bullying and current adult fertility (Study 2). In support of an evolutionary theory of bullying, we found that higher bullying was associated with having children in young adulthood (ages 23 and/or 24 years, Study 1) and that retrospective reports of adolescent bullying were associated with having more children in adulthood (Study 2). Overall, our studies offer additional support for the idea that adolescent bullying is, at least in part, an evolutionary adaptation that may help individuals to later pass on their genes to future generations through enhanced reproductive and perhaps parental effort. Although needing replication, our data highlight the importance of considering reproductive outcomes when designing future bullying research or interventions. (PsycInfo Database Record (c) 2025 APA, all rights reserved)", + "libraryCatalog": "APA PsycNet", + "publicationTitle": "Evolutionary Behavioral Sciences", + "shortTitle": "Linking adolescent bullying perpetration with adult fertility", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "Adaptation" + }, + { + "tag": "Adolescent Characteristics" + }, + { + "tag": "Bullying" + }, + { + "tag": "Fertility" + }, + { + "tag": "Genes" + }, + { + "tag": "Parenthood Status" + }, + { + "tag": "Theory of Evolution" + } + ], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/APN.ru.js b/translators/APN.ru.js new file mode 100644 index 0000000..63747d4 --- /dev/null +++ b/translators/APN.ru.js @@ -0,0 +1,132 @@ +{ + "translatorID": "737216af-fc48-4aa5-bfae-560c9cfc5df5", + "label": "APN.ru", + "creator": "Avram Lyon", + "target": "^https?://www\\.apn\\.ru/", + "minVersion": "2.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2012-03-03 23:38:28" +} + +/* FW LINE 59:b820c6d */ function flatten(t){var e=new Array;for(var i in t){var r=t[i];r instanceof Array?e=e.concat(flatten(r)):e.push(r)}return e}var FW={_scrapers:new Array};FW._Base=function(){this.callHook=function(t,e,i,r){if("object"==typeof this.hooks){var n=this.hooks[t];"function"==typeof n&&n(e,i,r)}},this.evaluateThing=function(t,e,i){var r=typeof t;if("object"===r){if(t instanceof Array){var n=this.evaluateThing,a=t.map(function(t){return n(t,e,i)});return flatten(a)}return t.evaluate(e,i)}return"function"===r?t(e,i):t},this.makeItems=function(t,e,i,r,n){n()}},FW.Scraper=function(t){FW._scrapers.push(new FW._Scraper(t))},FW._Scraper=function(t){for(x in t)this[x]=t[x];this._singleFieldNames=["abstractNote","applicationNumber","archive","archiveLocation","artworkMedium","artworkSize","assignee","audioFileType","audioRecordingType","billNumber","blogTitle","bookTitle","callNumber","caseName","code","codeNumber","codePages","codeVolume","committee","company","conferenceName","country","court","date","dateDecided","dateEnacted","dictionaryTitle","distributor","docketNumber","documentNumber","DOI","edition","encyclopediaTitle","episodeNumber","extra","filingDate","firstPage","forumTitle","genre","history","institution","interviewMedium","ISBN","ISSN","issue","issueDate","issuingAuthority","journalAbbreviation","label","language","legalStatus","legislativeBody","letterType","libraryCatalog","manuscriptType","mapType","medium","meetingName","nameOfAct","network","number","numberOfVolumes","numPages","pages","patentNumber","place","postType","presentationType","priorityNumbers","proceedingsTitle","programTitle","programmingLanguage","publicLawNumber","publicationTitle","publisher","references","reportNumber","reportType","reporter","reporterVolume","rights","runningTime","scale","section","series","seriesNumber","seriesText","seriesTitle","session","shortTitle","studio","subject","system","thesisType","title","type","university","url","version","videoRecordingType","volume","websiteTitle","websiteType"],this._makeAttachments=function(t,e,i,r){if(i instanceof Array)i.forEach(function(i){this._makeAttachments(t,e,i,r)},this);else if("object"==typeof i){var n=i.urls||i.url,a=i.types||i.type,s=i.titles||i.title,o=i.snapshots||i.snapshot,u=this.evaluateThing(n,t,e),l=this.evaluateThing(s,t,e),c=this.evaluateThing(a,t,e),h=this.evaluateThing(o,t,e);u instanceof Array||(u=[u]);for(var f in u){var p,m,v,d=u[f];p=c instanceof Array?c[f]:c,m=l instanceof Array?l[f]:l,v=h instanceof Array?h[f]:h,r.attachments.push({url:d,title:m,mimeType:p,snapshot:v})}}},this.makeItems=function(t,e,i,r,n){var a=new Zotero.Item(this.itemType);a.url=e;for(var s in this._singleFieldNames){var o=this._singleFieldNames[s];if(this[o]){var u=this.evaluateThing(this[o],t,e);u instanceof Array?a[o]=u[0]:a[o]=u}}var l=["creators","tags"];for(var c in l){var h=l[c],f=this.evaluateThing(this[h],t,e);if(f)for(var p in f)a[h].push(f[p])}this._makeAttachments(t,e,this.attachments,a),r(a,this,t,e),n()}},FW._Scraper.prototype=new FW._Base,FW.MultiScraper=function(t){FW._scrapers.push(new FW._MultiScraper(t))},FW._MultiScraper=function(t){for(x in t)this[x]=t[x];this._mkSelectItems=function(t,e){var i=new Object;for(var r in t)i[e[r]]=t[r];return i},this._selectItems=function(t,e,i){var r=new Array;Zotero.selectItems(this._mkSelectItems(t,e),function(t){for(var e in t)r.push(e);i(r)})},this._mkAttachments=function(t,e,i){var r=this.evaluateThing(this.attachments,t,e),n=new Object;if(r)for(var a in i)n[i[a]]=r[a];return n},this._makeChoices=function(t,e,i,r,n){if(t instanceof Array)t.forEach(function(t){this._makeTitlesUrls(t,e,i,r,n)},this);else if("object"==typeof t){var a=t.urls||t.url,s=t.titles||t.title,o=this.evaluateThing(a,e,i),u=this.evaluateThing(s,e,i),l=u instanceof Array;o instanceof Array||(o=[o]);for(var c in o){var h,f=o[c];h=l?u[c]:u,n.push(f),r.push(h)}}},this.makeItems=function(t,e,i,r,n){if(this.beforeFilter){var a=this.beforeFilter(t,e);if(a!=e)return void this.makeItems(t,a,i,r,n)}var s=[],o=[];this._makeChoices(this.choices,t,e,s,o);var u=this._mkAttachments(t,e,o),l=this.itemTrans;this._selectItems(s,o,function(t){if(t){var e=function(t){var e=t.documentURI,i=l;void 0===i&&(i=FW.getScraper(t,e)),void 0===i||i.makeItems(t,e,u[e],r,function(){})};Zotero.Utilities.processDocuments(t,e,n)}else n()})}},FW._MultiScraper.prototype=new FW._Base,FW.WebDelegateTranslator=function(t){return new FW._WebDelegateTranslator(t)},FW._WebDelegateTranslator=function(t){for(x in t)this[x]=t[x];this.makeItems=function(t,e,i,r,n){var a=this,s=Zotero.loadTranslator("web");s.setHandler("itemDone",function(i,n){r(n,a,t,e)}),s.setDocument(t),this.translatorId?(s.setTranslator(this.translatorId),s.translate()):(s.setHandler("translators",function(t,e){e.length&&(s.setTranslator(e[0]),s.translate())}),s.getTranslators()),n()}},FW._WebDelegateTranslator.prototype=new FW._Base,FW._StringMagic=function(){this._filters=new Array,this.addFilter=function(t){return this._filters.push(t),this},this.split=function(t){return this.addFilter(function(e){return e.split(t).filter(function(t){return""!=t})})},this.replace=function(t,e,i){return this.addFilter(function(r){return r.match(t)?r.replace(t,e,i):r})},this.prepend=function(t){return this.replace(/^/,t)},this.append=function(t){return this.replace(/$/,t)},this.remove=function(t,e){return this.replace(t,"",e)},this.trim=function(){return this.addFilter(function(t){return Zotero.Utilities.trim(t)})},this.trimInternal=function(){return this.addFilter(function(t){return Zotero.Utilities.trimInternal(t)})},this.match=function(t,e){return e||(e=0),this.addFilter(function(i){var r=i.match(t);return void 0===r||null===r?void 0:r[e]})},this.cleanAuthor=function(t,e){return this.addFilter(function(i){return Zotero.Utilities.cleanAuthor(i,t,e)})},this.key=function(t){return this.addFilter(function(e){return e[t]})},this.capitalizeTitle=function(){return this.addFilter(function(t){return Zotero.Utilities.capitalizeTitle(t)})},this.unescapeHTML=function(){return this.addFilter(function(t){return Zotero.Utilities.unescapeHTML(t)})},this.unescape=function(){return this.addFilter(function(t){return unescape(t)})},this._applyFilters=function(t,e){for(i in this._filters){t=flatten(t),t=t.filter(function(t){return void 0!==t&&null!==t});for(var r=0;r0&&a[0])return n}},FW.getScraper=function(t,e){var i=FW.detectWeb(t,e);return FW._scrapers.filter(function(r){return r.evaluateThing(r.itemType,t,e)==i&&r.evaluateThing(r.detect,t,e)})[0]},FW.doWeb=function(t,e){var i=FW.getScraper(t,e);i.makeItems(t,e,[],function(t,e,i,r){e.callHook("scraperDone",t,i,r),t.title||(t.title=""),t.complete()},function(){Zotero.done()}),Zotero.wait()}; + +/* + ***** BEGIN LICENSE BLOCK ***** + + APN.ru (Агенство политических новостей) Translator + Copyright © 2011 Avram Lyon, ajlyon@gmail.com + + 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) { + return FW.detectWeb(doc, url); +} +function doWeb(doc, url) { return FW.doWeb(doc, url); } + + +/** Articles */ +FW.Scraper({ itemType : 'newspaperArticle', + detect : FW.Xpath('//div[@class="block_div"]/div/*[@class="article_title"]'), + title : FW.Xpath('//div[@class="block_div"]/div/*[@class="article_title"]').text().trim(), + attachments : [ { + url : FW.Url().replace(/article/,"print"), + type: "text/html", + title: "APN.ru Printable" }], + creators : FW.Xpath('//div[@class="block_div"]/div/a[@class="pub_aname"]').text().cleanAuthor("author"), + date : FW.Xpath('//div[@class="block_div"]/div/span[@class="pub_date"]').text(), + publicationTitle : "Агенство политических новостей" + }); + + +/** Search results */ +FW.MultiScraper({ itemType : "multiple", + detect : FW.Xpath('//div[@class="search_content"]'), + choices : { + titles : FW.Xpath('//div[@class="search_content"]/div/a[@class="searchtitle"]').text(), + urls : FW.Xpath('//div[@class="search_content"]/div/a[@class="searchtitle"]').key('href').text() + } +}); +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://www.apn.ru/publications/article25995.htm", + "items": [ + { + "itemType": "newspaperArticle", + "creators": [ + { + "firstName": "Сергей", + "lastName": "Бирюков", + "creatorType": "author" + } + ], + "notes": [], + "tags": [], + "seeAlso": [], + "attachments": [ + { + "url": "http://www.apn.ru/publications/print25995.htm", + "title": "APN.ru Printable", + "type": "text/html" + } + ], + "url": "http://www.apn.ru/publications/article25995.htm", + "date": "2012-02-17", + "publicationTitle": "Агенство политических новостей", + "title": "Меркель - Саркози: альянс или \"тактическое партнерство\"?", + "libraryCatalog": "Агенство политических новостей", + "accessDate": "CURRENT_TIMESTAMP", + "shortTitle": "Меркель - Саркози" + } + ] + }, + { + "type": "web", + "url": "http://www.apn.ru/news/article26042.htm", + "items": [ + { + "itemType": "newspaperArticle", + "creators": [], + "notes": [], + "tags": [], + "seeAlso": [], + "attachments": [ + { + "url": "http://www.apn.ru/news/print26042.htm", + "title": "APN.ru Printable", + "type": "text/html" + } + ], + "url": "http://www.apn.ru/news/article26042.htm", + "publicationTitle": "Агенство политических новостей", + "title": "ФМС: у русской двукратной олимпийской чемпионки нет оснований для получения гражданства России", + "libraryCatalog": "Агенство политических новостей", + "accessDate": "CURRENT_TIMESTAMP", + "shortTitle": "ФМС" + } + ] + } +] +/** END TEST CASES **/ \ No newline at end of file diff --git a/translators/APS-Physics.js b/translators/APS-Physics.js new file mode 100644 index 0000000..a57b1e7 --- /dev/null +++ b/translators/APS-Physics.js @@ -0,0 +1,204 @@ +{ + "translatorID": "f318ab1e-71c6-4f67-8ac3-4b1144e5bf4e", + "label": "APS-Physics", + "creator": "Will Shanks and Abe Jellinek", + "target": "^https?://(www\\.)?(physics)\\.aps\\.org/", + "minVersion": "2.1.9", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-08-31 22:13:29" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (doc.querySelector('meta[name="citation_title"]')) { + return "journalArticle"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('h3.feed-item-title > a[href*="/articles/"]'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', function (obj, item) { + if (!item.DOI) { + item.DOI = ZU.cleanDOI(attr(doc, 'a[href*="link.aps.org/doi"]', 'href')); + } + + // both snapshot and PDF: HTML is commentary, PDF is article + item.attachments = []; + item.attachments.push({ + title: 'Snapshot', + document: doc + }); + item.attachments.push({ + title: 'Full Text PDF', + mimeType: 'application/pdf', + url: `https://physics.aps.org/articles/pdf/${item.DOI}` + }); + + item.libraryCatalog = 'APS Physics'; + + item.complete(); + }); + + translator.getTranslatorObject(function (trans) { + trans.addCustomFields({ + 'citation_pages': 'pages' + }); + trans.doWeb(doc, url); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://physics.aps.org/articles/v5/100", + "items": [ + { + "itemType": "journalArticle", + "title": "Surface Folds Make Tears and Chips", + "creators": [ + { + "firstName": "Sissi de", + "lastName": "Beer", + "creatorType": "author" + }, + { + "firstName": "Martin H.", + "lastName": "Müser", + "creatorType": "author" + } + ], + "date": "2012/09/04", + "DOI": "10.1103/PhysRevLett.109.106001", + "abstractNote": "Fluidlike folding instabilities of solid surfaces complicate the machining of metals to perfection", + "language": "en", + "libraryCatalog": "APS Physics", + "pages": "100", + "publicationTitle": "Physics", + "rights": "©2012 by the American Physical Society. All rights reserved.", + "url": "https://physics.aps.org/articles/v5/100", + "volume": "5", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + }, + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://physics.aps.org/articles/v5/101", + "items": [ + { + "itemType": "journalArticle", + "title": "Measuring the Smallest Trickle", + "creators": [ + { + "firstName": "Michael", + "lastName": "Schirber", + "creatorType": "author" + } + ], + "date": "2012/09/10", + "DOI": "10.1103/PhysRevLett.109.118302", + "abstractNote": "Researchers used a nanoscale tunnel in a silicon chip to measure a flow rate of a few picoliters per minute, which is smaller than any previous observation.", + "language": "en", + "libraryCatalog": "APS Physics", + "pages": "101", + "publicationTitle": "Physics", + "rights": "©2012 by the American Physical Society. All rights reserved.", + "url": "https://physics.aps.org/articles/v5/101", + "volume": "5", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + }, + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://physics.aps.org/browse/?page=1&per_page=10&sort=relevance&q=test", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/APS.js b/translators/APS.js new file mode 100644 index 0000000..87175a5 --- /dev/null +++ b/translators/APS.js @@ -0,0 +1,542 @@ +{ + "translatorID": "2c310a37-a4dd-48d2-82c9-bd29c53c1c76", + "label": "APS", + "creator": "Aurimas Vinckevicius and Abe Jellinek", + "target": "^https?://journals\\.aps\\.org/([^/]+/(abstract|supplemental|references|cited-by|issues)/|search(\\?|/))", + "minVersion": "3.0.12", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2024-11-21 18:50:09" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2024 Aurimas Vinckevicius and Abe Jellinek + + 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) { + if (doc.querySelector('#article-body #export-article-dialog') + || doc.querySelector('main#main') && /^\/[^/]+\/(abstract|supplemental|references|cited-by)\//.test(new URL(url).pathname)) { + return "journalArticle"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('#issue-body .headline .title > a'); + if (!rows.length) { + rows = doc.querySelectorAll('#search-main h3 > a'); + } + for (var i = 0; i < rows.length; i++) { + var href = rows[i].href; + var title = ZU.trimInternal(cleanMath(rows[i].textContent)); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (!items) { + return; + } + var articles = []; + for (var i in items) { + articles.push(i); + } + ZU.processDocuments(articles, scrape); + }); + } + else { + scrape(doc, url); + } +} + + +// Extension to mimeType mapping +var suppTypeMap = { + pdf: 'application/pdf', + zip: 'application/zip', + doc: 'application/msword', + docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + xls: 'application/vnd.ms-excel', + xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + mov: 'video/quicktime' +}; + +var dontDownload = [ + 'application/zip', + 'video/quicktime' +]; + +function scrape(doc, url) { + url = url.replace(/[?#].*/, ''); + + if (!url.includes('/abstract/')) { + // Go to Abstract page first so we can scrape the abstract + url = url.replace(/\/(?:supplemental|references|cited-by)\//, '/abstract/'); + if (!url.includes('/abstract/')) { + Zotero.debug('Unrecognized URL ' + url); + return; + } + + ZU.processDocuments(url, function (doc, url) { + if (!url.includes('/abstract/')) { + Zotero.debug('Redirected when trying to go to abstract page. ' + url); + return; + } + scrape(doc, url); + }); + return; + } + + url = url.replace(/\/abstract\//, '/{REPLACE}/'); + + // fetch RIS + var risUrl = url.replace('{REPLACE}', 'export') + + '?type=ris&download=true'; + ZU.doGet(risUrl, function (risText) { + risText = risText.replace(/^ID\s+-\s+/mg, 'DO - '); + var trans = Zotero.loadTranslator('import'); + trans.setTranslator('32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7'); //RIS + trans.setString(risText); + trans.setHandler('itemDone', function (obj, item) { + // scrape abstract from page + item.abstractNote = ZU.trimInternal(cleanMath( + text(doc, '#abstract-section-content p') + )); + + item.attachments.push({ + title: 'Full Text PDF', + url: url.replace('{REPLACE}', 'pdf'), + mimeType: 'application/pdf' + }); + + item.attachments.push({ + title: "APS Snapshot", + document: doc + }); + + if (Z.getHiddenPref && Z.getHiddenPref('attachSupplementary')) { + try { + var asLink = Z.getHiddenPref('supplementaryAsLink'); + var suppFiles = doc.querySelectorAll('.supplemental-file'); + for (let suppFile of suppFiles) { + let link = suppFile.querySelector('a'); + if (!link || !link.href) continue; + var title = link.getAttribute('data-id') || 'Supplementary Data'; + var type = suppTypeMap[link.href.split('.').pop()]; + if (asLink || dontDownload.includes(type)) { + item.attachments.push({ + title: title, + url: link.href, + mimeType: type || 'text/html', + snapshot: false + }); + } + else { + item.attachments.push({ + title: title, + url: link.href, + mimeType: type + }); + } + } + } + catch (e) { + Z.debug('Could not attach supplemental data'); + Z.debug(e); + } + } + item.complete(); + }); + trans.translate(); + }); +} + +function cleanMath(str) { + //math tags appear to have duplicate content and are somehow left in even after textContent + return str.replace(/<(math|mi)[^<>]*>.*?<\/\1>/g, ''); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://journals.aps.org/prd/abstract/10.1103/PhysRevD.84.077701", + "items": [ + { + "itemType": "journalArticle", + "title": "Hints for a nonstandard Higgs boson from the LHC", + "creators": [ + { + "lastName": "Raidal", + "firstName": "Martti", + "creatorType": "author" + }, + { + "lastName": "Strumia", + "firstName": "Alessandro", + "creatorType": "author" + } + ], + "date": "2011-10-21", + "DOI": "10.1103/PhysRevD.84.077701", + "abstractNote": "We reconsider Higgs boson invisible decays into Dark Matter in the light of recent Higgs searches at the LHC. Present hints in the Compact Muon Solenoid and ATLAS data favor a nonstandard Higgs boson with approximately 50% invisible branching ratio, and mass around 143 GeV. This situation can be realized within the simplest thermal scalar singlet Dark Matter model, predicting a Dark Matter mass around 50 GeV and direct detection cross section just below present bound. The present runs of the Xenon100 and LHC experiments can test this possibility.", + "issue": "7", + "journalAbbreviation": "Phys. Rev. D", + "libraryCatalog": "APS", + "pages": "077701", + "publicationTitle": "Physical Review D", + "url": "https://link.aps.org/doi/10.1103/PhysRevD.84.077701", + "volume": "84", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "APS Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://journals.aps.org/prd/issues/84/7", + "items": "multiple" + }, + { + "type": "web", + "url": "https://journals.aps.org/search/results?sort=relevance&clauses=%5B%7B%22operator%22:%22AND%22,%22field%22:%22all%22,%22value%22:%22test%22%7D%5D", + "items": "multiple" + }, + { + "type": "web", + "url": "https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.114.098105", + "items": [ + { + "itemType": "journalArticle", + "title": "Magnetic Flattening of Stem-Cell Spheroids Indicates a Size-Dependent Elastocapillary Transition", + "creators": [ + { + "lastName": "Mazuel", + "firstName": "Francois", + "creatorType": "author" + }, + { + "lastName": "Reffay", + "firstName": "Myriam", + "creatorType": "author" + }, + { + "lastName": "Du", + "firstName": "Vicard", + "creatorType": "author" + }, + { + "lastName": "Bacri", + "firstName": "Jean-Claude", + "creatorType": "author" + }, + { + "lastName": "Rieu", + "firstName": "Jean-Paul", + "creatorType": "author" + }, + { + "lastName": "Wilhelm", + "firstName": "Claire", + "creatorType": "author" + } + ], + "date": "2015-03-04", + "DOI": "10.1103/PhysRevLett.114.098105", + "abstractNote": "Cellular aggregates (spheroids) are widely used in biophysics and tissue engineering as model systems for biological tissues. In this Letter we propose novel methods for molding stem-cell spheroids, deforming them, and measuring their interfacial and elastic properties with a single method based on cell tagging with magnetic nanoparticles and application of a magnetic field gradient. Magnetic molding yields spheroids of unprecedented sizes (up to a few mm in diameter) and preserves tissue integrity. On subjecting these spheroids to magnetic flattening (over ), we observed a size-dependent elastocapillary transition with two modes of deformation: liquid-drop-like behavior for small spheroids, and elastic-sphere-like behavior for larger spheroids, followed by relaxation to a liquidlike drop.", + "issue": "9", + "journalAbbreviation": "Phys. Rev. Lett.", + "libraryCatalog": "APS", + "pages": "098105", + "publicationTitle": "Physical Review Letters", + "url": "https://link.aps.org/doi/10.1103/PhysRevLett.114.098105", + "volume": "114", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "APS Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://journals.aps.org/prx/supplemental/10.1103/PhysRevX.5.011029", + "items": [ + { + "itemType": "journalArticle", + "title": "Weyl Semimetal Phase in Noncentrosymmetric Transition-Metal Monophosphides", + "creators": [ + { + "lastName": "Weng", + "firstName": "Hongming", + "creatorType": "author" + }, + { + "lastName": "Fang", + "firstName": "Chen", + "creatorType": "author" + }, + { + "lastName": "Fang", + "firstName": "Zhong", + "creatorType": "author" + }, + { + "lastName": "Bernevig", + "firstName": "B. Andrei", + "creatorType": "author" + }, + { + "lastName": "Dai", + "firstName": "Xi", + "creatorType": "author" + } + ], + "date": "2015-03-17", + "DOI": "10.1103/PhysRevX.5.011029", + "abstractNote": "Based on first-principle calculations, we show that a family of nonmagnetic materials including TaAs, TaP, NbAs, and NbP are Weyl semimetals (WSM) without inversion centers. We find twelve pairs of Weyl points in the whole Brillouin zone (BZ) for each of them. In the absence of spin-orbit coupling (SOC), band inversions in mirror-invariant planes lead to gapless nodal rings in the energy-momentum dispersion. The strong SOC in these materials then opens full gaps in the mirror planes, generating nonzero mirror Chern numbers and Weyl points off the mirror planes. The resulting surface-state Fermi arc structures on both (001) and (100) surfaces are also obtained, and they show interesting shapes, pointing to fascinating playgrounds for future experimental studies.", + "issue": "1", + "journalAbbreviation": "Phys. Rev. X", + "libraryCatalog": "APS", + "pages": "011029", + "publicationTitle": "Physical Review X", + "url": "https://link.aps.org/doi/10.1103/PhysRevX.5.011029", + "volume": "5", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "APS Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://journals.aps.org/prx/references/10.1103/PhysRevX.5.011029", + "items": [ + { + "itemType": "journalArticle", + "title": "Weyl Semimetal Phase in Noncentrosymmetric Transition-Metal Monophosphides", + "creators": [ + { + "lastName": "Weng", + "firstName": "Hongming", + "creatorType": "author" + }, + { + "lastName": "Fang", + "firstName": "Chen", + "creatorType": "author" + }, + { + "lastName": "Fang", + "firstName": "Zhong", + "creatorType": "author" + }, + { + "lastName": "Bernevig", + "firstName": "B. Andrei", + "creatorType": "author" + }, + { + "lastName": "Dai", + "firstName": "Xi", + "creatorType": "author" + } + ], + "date": "2015-03-17", + "DOI": "10.1103/PhysRevX.5.011029", + "abstractNote": "Based on first-principle calculations, we show that a family of nonmagnetic materials including TaAs, TaP, NbAs, and NbP are Weyl semimetals (WSM) without inversion centers. We find twelve pairs of Weyl points in the whole Brillouin zone (BZ) for each of them. In the absence of spin-orbit coupling (SOC), band inversions in mirror-invariant planes lead to gapless nodal rings in the energy-momentum dispersion. The strong SOC in these materials then opens full gaps in the mirror planes, generating nonzero mirror Chern numbers and Weyl points off the mirror planes. The resulting surface-state Fermi arc structures on both (001) and (100) surfaces are also obtained, and they show interesting shapes, pointing to fascinating playgrounds for future experimental studies.", + "issue": "1", + "journalAbbreviation": "Phys. Rev. X", + "libraryCatalog": "APS", + "pages": "011029", + "publicationTitle": "Physical Review X", + "url": "https://link.aps.org/doi/10.1103/PhysRevX.5.011029", + "volume": "5", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "APS Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://journals.aps.org/prx/cited-by/10.1103/PhysRevX.5.011003", + "items": [ + { + "itemType": "journalArticle", + "title": "Ideal Negative Measurements in Quantum Walks Disprove Theories Based on Classical Trajectories", + "creators": [ + { + "lastName": "Robens", + "firstName": "Carsten", + "creatorType": "author" + }, + { + "lastName": "Alt", + "firstName": "Wolfgang", + "creatorType": "author" + }, + { + "lastName": "Meschede", + "firstName": "Dieter", + "creatorType": "author" + }, + { + "lastName": "Emary", + "firstName": "Clive", + "creatorType": "author" + }, + { + "lastName": "Alberti", + "firstName": "Andrea", + "creatorType": "author" + } + ], + "date": "2015-01-20", + "DOI": "10.1103/PhysRevX.5.011003", + "abstractNote": "We report on a stringent test of the nonclassicality of the motion of a massive quantum particle, which propagates on a discrete lattice. Measuring temporal correlations of the position of single atoms performing a quantum walk, we observe a 6σ violation of the Leggett-Garg inequality. Our results rigorously excludes (i.e., falsifies) any explanation of quantum transport based on classical, well-defined trajectories. We use so-called ideal negative measurements—an essential requisite for any genuine Leggett-Garg test—to acquire information about the atom’s position, yet avoiding any direct interaction with it. The interaction-free measurement is based on a novel atom transport system, which allows us to directly probe the absence rather than the presence of atoms at a chosen lattice site. Beyond the fundamental aspect of this test, we demonstrate the application of the Leggett-Garg correlation function as a witness of quantum superposition. Here, we employ the witness to discriminate different types of walks spanning from merely classical to wholly quantum dynamics.", + "issue": "1", + "journalAbbreviation": "Phys. Rev. X", + "libraryCatalog": "APS", + "pages": "011003", + "publicationTitle": "Physical Review X", + "url": "https://link.aps.org/doi/10.1103/PhysRevX.5.011003", + "volume": "5", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "APS Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://journals.aps.org/pra/abstract/10.1103/PhysRevA.65.032314", + "items": [ + { + "itemType": "journalArticle", + "title": "Computable measure of entanglement", + "creators": [ + { + "lastName": "Vidal", + "firstName": "G.", + "creatorType": "author" + }, + { + "lastName": "Werner", + "firstName": "R. F.", + "creatorType": "author" + } + ], + "date": "2002-02-22", + "DOI": "10.1103/PhysRevA.65.032314", + "abstractNote": "We present a measure of entanglement that can be computed effectively for any mixed state of an arbitrary bipartite system. We show that it does not increase under local manipulations of the system, and use it to obtain a bound on the teleportation capacity and on the distillable entanglement of mixed states.", + "issue": "3", + "journalAbbreviation": "Phys. Rev. A", + "libraryCatalog": "APS", + "pages": "032314", + "publicationTitle": "Physical Review A", + "url": "https://link.aps.org/doi/10.1103/PhysRevA.65.032314", + "volume": "65", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "APS Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/ARTFL Encyclopedie.js b/translators/ARTFL Encyclopedie.js new file mode 100644 index 0000000..783deaf --- /dev/null +++ b/translators/ARTFL Encyclopedie.js @@ -0,0 +1,283 @@ +{ + "translatorID": "72cb2536-3211-41e0-ae8b-974c0385e085", + "label": "ARTFL Encyclopedie", + "creator": "Sean Takats, Sebastian Karcher, and Abe Jellinek", + "target": "^https?://artflsrv\\d+\\.uchicago\\.edu/philologic4/encyclopedie\\d+/(navigate/|query)", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-06-30 19:55:06" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (url.includes('/navigate/')) { + return "encyclopediaArticle"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('.philologic_cite .citation:first-child a'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + + +function scrape(doc, url) { + let path = url.match(/(\/philologic4\/[^/]+\/)navigate((?:\/\d+)+)/); + if (!path) { + throw new Error('Unknown entry path format'); + } + + let [, base, id] = path; + id = id.replace(/\//g, ' ').trim(); + + ZU.doGet( + `${base}reports/navigation.py?report=navigation&philo_id=${id}&byte=`, + function (respText) { + let json = JSON.parse(respText); + scrapeFromJSON(doc, url, json); + } + ); +} + +function scrapeFromJSON(doc, url, json) { + let item = new Zotero.Item('encyclopediaArticle'); + let meta = json.metadata_fields; + + item.title = meta.head; + item.encyclopediaTitle = meta.title.replace(/\.?\s*Tome \d+\.?/, ''); + item.volume = meta.vol; + item.numberOfVolumes = '17'; + item.place = meta.pub_place; + item.publisher = meta.publisher; + item.date = meta.pub_date; + + let firstPage; + let lastPage; + + let pageRe = /\[page \d+:([\da-zA-Z]+)\]/g; + let matchArray; + while ((matchArray = pageRe.exec(json.text)) !== null) { + // iterate through page heading matches. if we haven't set the first + // page yet, set it to the page in the heading we just found. always + // set the last page to the heading we just found. when we're done, + // the first page will correspond to the first heading and the last page + // to the last. + + if (!firstPage) { + firstPage = matchArray[1]; + } + lastPage = matchArray[1]; + } + + if (firstPage && lastPage) { + if (firstPage == lastPage) { + item.pages = firstPage; + } + else { + item.pages = `${firstPage}-${lastPage}`; + } + } + + item.url = url; + item.language = 'fr'; + item.archive = 'ARTFL Encyclopédie Project (Spring 2021 Edition)'; + item.libraryCatalog = ''; + + item.creators.push({ + firstName: "Denis", + lastName: "Diderot", + creatorType: "editor" + }); + + item.creators.push({ + firstName: "Jean le Rond", + lastName: "d'Alembert", + creatorType: "editor" + }); + + item.creators.push( + ZU.cleanAuthor( + meta.kafauth.replace(/\s*\(.*\)/, ''), 'author', true + ) + ); + + if (doc) { + item.attachments.push({ + title: 'Snapshot', + document: doc + }); + } + + if (json.imgs.current_obj_img && json.imgs.current_obj_img.length) { + let url = json.imgs.current_obj_img[0]; + item.attachments.push({ + title: 'Page Scan', + mimeType: `image/${url.split('.').pop()}`, + url + }); + } + + item.complete(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://artflsrv03.uchicago.edu/philologic4/encyclopedie0521/navigate/1/929/", + "items": [ + { + "itemType": "encyclopediaArticle", + "title": "ADULTERE", + "creators": [ + { + "firstName": "Denis", + "lastName": "Diderot", + "creatorType": "editor" + }, + { + "firstName": "Jean le Rond", + "lastName": "d'Alembert", + "creatorType": "editor" + }, + { + "firstName": "François-Vincent", + "lastName": "Toussaint", + "creatorType": "author" + } + ], + "date": "1751", + "archive": "ARTFL Encyclopédie Project (Spring 2021 Edition)", + "encyclopediaTitle": "Encyclopédie, Dictionnaire raisonné des sciences, des arts et des métiers, par une Société de Gens de lettres", + "language": "fr", + "numberOfVolumes": "17", + "pages": "150", + "place": "Paris", + "publisher": "Le Breton", + "url": "https://artflsrv03.uchicago.edu/philologic4/encyclopedie0521/navigate/1/929/", + "volume": "1", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + }, + { + "title": "Page Scan", + "mimeType": "image/jpeg" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://artflsrv03.uchicago.edu/philologic4/encyclopedie0521/navigate/1/925/", + "items": [ + { + "itemType": "encyclopediaArticle", + "title": "ADULTE", + "creators": [ + { + "firstName": "Denis", + "lastName": "Diderot", + "creatorType": "editor" + }, + { + "firstName": "Jean le Rond", + "lastName": "d'Alembert", + "creatorType": "editor" + }, + { + "firstName": "Pierre", + "lastName": "Tarin", + "creatorType": "author" + } + ], + "date": "1751", + "archive": "ARTFL Encyclopédie Project (Spring 2021 Edition)", + "encyclopediaTitle": "Encyclopédie, Dictionnaire raisonné des sciences, des arts et des métiers, par une Société de Gens de lettres", + "language": "fr", + "numberOfVolumes": "17", + "pages": "150", + "place": "Paris", + "publisher": "Le Breton", + "url": "https://artflsrv03.uchicago.edu/philologic4/encyclopedie0521/navigate/1/925/", + "volume": "1", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + }, + { + "title": "Page Scan", + "mimeType": "image/jpeg" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://artflsrv03.uchicago.edu/philologic4/encyclopedie0521/query?report=concordance&method=proxy&attribution=&objecttype=&q=amour&start=0&end=0", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/ARTnews.js b/translators/ARTnews.js new file mode 100644 index 0000000..93ed6e6 --- /dev/null +++ b/translators/ARTnews.js @@ -0,0 +1,155 @@ +{ + "translatorID": "e765263c-c211-46a8-892b-d0b0237836a7", + "label": "ARTnews", + "creator": "czar", + "target": "^https?://(www\\.)?artnews\\.com", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2017-03-12 00:18:33" +} + +/* FW LINE 59:b820c6d */ function flatten(t){var e=new Array;for(var i in t){var r=t[i];r instanceof Array?e=e.concat(flatten(r)):e.push(r)}return e}var FW={_scrapers:new Array};FW._Base=function(){this.callHook=function(t,e,i,r){if("object"==typeof this.hooks){var n=this.hooks[t];"function"==typeof n&&n(e,i,r)}},this.evaluateThing=function(t,e,i){var r=typeof t;if("object"===r){if(t instanceof Array){var n=this.evaluateThing,a=t.map(function(t){return n(t,e,i)});return flatten(a)}return t.evaluate(e,i)}return"function"===r?t(e,i):t},this.makeItems=function(t,e,i,r,n){n()}},FW.Scraper=function(t){FW._scrapers.push(new FW._Scraper(t))},FW._Scraper=function(t){for(x in t)this[x]=t[x];this._singleFieldNames=["abstractNote","applicationNumber","archive","archiveLocation","artworkMedium","artworkSize","assignee","audioFileType","audioRecordingType","billNumber","blogTitle","bookTitle","callNumber","caseName","code","codeNumber","codePages","codeVolume","committee","company","conferenceName","country","court","date","dateDecided","dateEnacted","dictionaryTitle","distributor","docketNumber","documentNumber","DOI","edition","encyclopediaTitle","episodeNumber","extra","filingDate","firstPage","forumTitle","genre","history","institution","interviewMedium","ISBN","ISSN","issue","issueDate","issuingAuthority","journalAbbreviation","label","language","legalStatus","legislativeBody","letterType","libraryCatalog","manuscriptType","mapType","medium","meetingName","nameOfAct","network","number","numberOfVolumes","numPages","pages","patentNumber","place","postType","presentationType","priorityNumbers","proceedingsTitle","programTitle","programmingLanguage","publicLawNumber","publicationTitle","publisher","references","reportNumber","reportType","reporter","reporterVolume","rights","runningTime","scale","section","series","seriesNumber","seriesText","seriesTitle","session","shortTitle","studio","subject","system","thesisType","title","type","university","url","version","videoRecordingType","volume","websiteTitle","websiteType"],this._makeAttachments=function(t,e,i,r){if(i instanceof Array)i.forEach(function(i){this._makeAttachments(t,e,i,r)},this);else if("object"==typeof i){var n=i.urls||i.url,a=i.types||i.type,s=i.titles||i.title,o=i.snapshots||i.snapshot,u=this.evaluateThing(n,t,e),l=this.evaluateThing(s,t,e),c=this.evaluateThing(a,t,e),h=this.evaluateThing(o,t,e);u instanceof Array||(u=[u]);for(var f in u){var p,m,v,d=u[f];p=c instanceof Array?c[f]:c,m=l instanceof Array?l[f]:l,v=h instanceof Array?h[f]:h,r.attachments.push({url:d,title:m,mimeType:p,snapshot:v})}}},this.makeItems=function(t,e,i,r,n){var a=new Zotero.Item(this.itemType);a.url=e;for(var s in this._singleFieldNames){var o=this._singleFieldNames[s];if(this[o]){var u=this.evaluateThing(this[o],t,e);u instanceof Array?a[o]=u[0]:a[o]=u}}var l=["creators","tags"];for(var c in l){var h=l[c],f=this.evaluateThing(this[h],t,e);if(f)for(var p in f)a[h].push(f[p])}this._makeAttachments(t,e,this.attachments,a),r(a,this,t,e),n()}},FW._Scraper.prototype=new FW._Base,FW.MultiScraper=function(t){FW._scrapers.push(new FW._MultiScraper(t))},FW._MultiScraper=function(t){for(x in t)this[x]=t[x];this._mkSelectItems=function(t,e){var i=new Object;for(var r in t)i[e[r]]=t[r];return i},this._selectItems=function(t,e,i){var r=new Array;Zotero.selectItems(this._mkSelectItems(t,e),function(t){for(var e in t)r.push(e);i(r)})},this._mkAttachments=function(t,e,i){var r=this.evaluateThing(this.attachments,t,e),n=new Object;if(r)for(var a in i)n[i[a]]=r[a];return n},this._makeChoices=function(t,e,i,r,n){if(t instanceof Array)t.forEach(function(t){this._makeTitlesUrls(t,e,i,r,n)},this);else if("object"==typeof t){var a=t.urls||t.url,s=t.titles||t.title,o=this.evaluateThing(a,e,i),u=this.evaluateThing(s,e,i),l=u instanceof Array;o instanceof Array||(o=[o]);for(var c in o){var h,f=o[c];h=l?u[c]:u,n.push(f),r.push(h)}}},this.makeItems=function(t,e,i,r,n){if(this.beforeFilter){var a=this.beforeFilter(t,e);if(a!=e)return void this.makeItems(t,a,i,r,n)}var s=[],o=[];this._makeChoices(this.choices,t,e,s,o);var u=this._mkAttachments(t,e,o),l=this.itemTrans;this._selectItems(s,o,function(t){if(t){var e=function(t){var e=t.documentURI,i=l;void 0===i&&(i=FW.getScraper(t,e)),void 0===i||i.makeItems(t,e,u[e],r,function(){})};Zotero.Utilities.processDocuments(t,e,n)}else n()})}},FW._MultiScraper.prototype=new FW._Base,FW.WebDelegateTranslator=function(t){return new FW._WebDelegateTranslator(t)},FW._WebDelegateTranslator=function(t){for(x in t)this[x]=t[x];this.makeItems=function(t,e,i,r,n){var a=this,s=Zotero.loadTranslator("web");s.setHandler("itemDone",function(i,n){r(n,a,t,e)}),s.setDocument(t),this.translatorId?(s.setTranslator(this.translatorId),s.translate()):(s.setHandler("translators",function(t,e){e.length&&(s.setTranslator(e[0]),s.translate())}),s.getTranslators()),n()}},FW._WebDelegateTranslator.prototype=new FW._Base,FW._StringMagic=function(){this._filters=new Array,this.addFilter=function(t){return this._filters.push(t),this},this.split=function(t){return this.addFilter(function(e){return e.split(t).filter(function(t){return""!=t})})},this.replace=function(t,e,i){return this.addFilter(function(r){return r.match(t)?r.replace(t,e,i):r})},this.prepend=function(t){return this.replace(/^/,t)},this.append=function(t){return this.replace(/$/,t)},this.remove=function(t,e){return this.replace(t,"",e)},this.trim=function(){return this.addFilter(function(t){return Zotero.Utilities.trim(t)})},this.trimInternal=function(){return this.addFilter(function(t){return Zotero.Utilities.trimInternal(t)})},this.match=function(t,e){return e||(e=0),this.addFilter(function(i){var r=i.match(t);return void 0===r||null===r?void 0:r[e]})},this.cleanAuthor=function(t,e){return this.addFilter(function(i){return Zotero.Utilities.cleanAuthor(i,t,e)})},this.key=function(t){return this.addFilter(function(e){return e[t]})},this.capitalizeTitle=function(){return this.addFilter(function(t){return Zotero.Utilities.capitalizeTitle(t)})},this.unescapeHTML=function(){return this.addFilter(function(t){return Zotero.Utilities.unescapeHTML(t)})},this.unescape=function(){return this.addFilter(function(t){return unescape(t)})},this._applyFilters=function(t,e){for(i in this._filters){t=flatten(t),t=t.filter(function(t){return void 0!==t&&null!==t});for(var r=0;r0&&a[0])return n}},FW.getScraper=function(t,e){var i=FW.detectWeb(t,e);return FW._scrapers.filter(function(r){return r.evaluateThing(r.itemType,t,e)==i&&r.evaluateThing(r.detect,t,e)})[0]},FW.doWeb=function(t,e){var i=FW.getScraper(t,e);i.makeItems(t,e,[],function(t,e,i,r){e.callHook("scraperDone",t,i,r),t.title||(t.title=""),t.complete()},function(){Zotero.done()}),Zotero.wait()}; +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2017 czar + http://en.wikipedia.org/wiki/User_talk:Czar + + 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) { return FW.detectWeb(doc, url); } +function doWeb(doc, url) { return FW.doWeb(doc, url); } + +FW.Scraper({ +itemType : 'blogPost', +detect : FW.Url().match(/\/\d{4}\/\d{2}\//), +title : FW.Xpath('//h1[@class="entry-title"]').text(), +attachments : [{ url: FW.Url(), + title: "ARTnews snapshot", + type: "text/html" }], +creators : FW.Xpath('//span[@class="author-meta-name"]/a').text().cleanAuthor("author"), +date : FW.Xpath('//span[@class="date-meta"]').text().replace(/(\d{2})\/(\d{2})\/(\d{2})/, "20$3-$1-$2,"), // "03/02/16 10:35 am" => 2017-03-02, 10:35 pm +blogTitle : "ARTnews", +language : "en-US", +abstractNote : FW.Xpath('//meta[@name="description"]/@content').text(), +tags : FW.Xpath('//span[@class="cat-links"]/a').text(), +hooks : { "scraperDone": function (item,doc,url) { + if (item.creators[0].lastName == "ARTnews") { + delete item.creators[0].firstName; + item.creators[0].lastName = "The Editors of ARTnews"; + item.creators[0].fieldMode = 1; + } +}} +}); + +FW.MultiScraper({ +itemType : 'multiple', +detect : FW.Url().match(/(\/category\/)|(\/\?s=)/), // category or search +choices : { + titles : FW.Xpath('//h2[@class="entry-title"]/a').text(), + urls : FW.Xpath('//h2[@class="entry-title"]/a').key("href").trim() + } +}); + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://www.artnews.com/category/2017-venice-biennale/", + "items": "multiple" + }, + { + "type": "web", + "url": "http://www.artnews.com/2016/01/23/venice-biennale-taps-christine-macel-to-be-artistic-director-of-2017-edition/", + "items": [ + { + "itemType": "blogPost", + "title": "Venice Biennale Taps Christine Macel to Be Artistic Director of 2017 Edition", + "creators": [ + { + "firstName": "Andrew", + "lastName": "Russeth", + "creatorType": "author" + } + ], + "date": "2016-01-23, 10:35 am", + "abstractNote": "Christine Macel.JEAN-CLAUDE PLANCHET/CENTRE POMPIDOU Today Christine Macel, the chief curator of Paris’s Centre Pompidou, was named artistic director of the", + "blogTitle": "ARTnews", + "language": "en-US", + "url": "http://www.artnews.com/2016/01/23/venice-biennale-taps-christine-macel-to-be-artistic-director-of-2017-edition/", + "attachments": [ + { + "title": "ARTnews snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + "2017 Venice Biennale", + "News", + "The Talent" + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.artnews.com/2017/03/10/the-whitney-biennial-arrives-heres-a-round-up-of-coverage-of-artists-in-the-show/", + "items": [ + { + "itemType": "blogPost", + "title": "The Whitney Biennial Arrives! Here’s a Round-Up of Coverage of Artists in the Show", + "creators": [ + { + "lastName": "The Editors of ARTnews", + "creatorType": "author", + "fieldMode": 1 + } + ], + "date": "2017-03-10, 4:33 pm", + "abstractNote": "Aliza Nisenbaum, La Talaverita, Sunday Morning NY Times, 2016, oil on linen.COURTESY T293 GALLERY, ROME AND MARY MARY, GLASGOW/COLLECTION OF THE ARTIST With", + "blogTitle": "ARTnews", + "language": "en-US", + "url": "http://www.artnews.com/2017/03/10/the-whitney-biennial-arrives-heres-a-round-up-of-coverage-of-artists-in-the-show/", + "attachments": [ + { + "title": "ARTnews snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + "Whitney Biennial 2017" + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.artnews.com/?s=%22da+corte%22&x=0&y=0", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/ARTstor.js b/translators/ARTstor.js new file mode 100644 index 0000000..8879418 --- /dev/null +++ b/translators/ARTstor.js @@ -0,0 +1,619 @@ +{ + "translatorID": "5278b20c-7c2c-4599-a785-12198ea648bf", + "label": "ARTstor", + "creator": "Abe Jellinek", + "target": "^https?://library\\.artstor\\.org/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-07-23 05:46:04" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (url.includes('#/asset/')) { + if (text(doc, '[data-qa-id="worktype"]').includes('Map')) { + return "map"; + } + else if (doc.querySelector('.video-player')) { + return "videoRecording"; + } + else { + return "artwork"; + } + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + Z.monitorDOMChanges(doc.querySelector('app-root')); + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('.card'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(text(row, '.asset-title')); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) { + Object.keys(items).forEach((url) => { + ZU.doGet(buildMetadataURL(url), + function (respText) { + scrape(doc, url, JSON.parse(respText)); + }); + }); + } + }); + } + else { + ZU.doGet(buildMetadataURL(url), function (respText) { + scrape(doc, url, JSON.parse(respText)); + }); + } +} + +function buildMetadataURL(pageURL) { + let idMatches = pageURL.match(/\/asset\/([^/;]+)(;|$)/); + if (idMatches) { + let id = idMatches[1]; + return `https://library.artstor.org/api/v1/metadata?object_ids=${id}&legacy=false`; + } + + // "encrypted" IDs (external collections) + idMatches = pageURL.match(/\/asset\/[^/]+\/[^/]+\/([^?/;]+)/); + if (!idMatches) { + throw new Error('Could not extract ID from ARTstor URL: ' + pageURL); + } + + let id = idMatches[1]; + return `https://library.artstor.org/api/v2/items/resolve?encrypted_id=${id}&ref=&legacy=false&openlib=true`; +} + +function scrape(doc, url, json) { + if (!json.success || !json.metadata.length) { + throw new Error('ARTstor metadata retrieval failed'); + } + + let meta = json.metadata[0]; + let item = new Zotero.Item(resolveTypeID(meta.object_type_id)); + + item.DOI = ZU.cleanDOI(meta.doi); + // URL will be overwritten if the accession number has a source link + if (url.includes(';')) { + url = url.substring(0, url.indexOf(';')); + } + item.url = url; + + for (let { fieldName, fieldValue } of meta.metadata_json) { + switch (fieldName) { + case 'Work Type': + if (fieldValue.includes('Map')) { + item.itemType = 'map'; + } + item.tags.push({ fieldValue }); + break; + case 'Creator': { + let type = 'artist'; + if (item.itemType == 'map') { + type = 'cartographer'; + } + else if (item.itemType == 'videoRecording') { + type = 'contributor'; // sometimes cast member, sometimes director + } + + fieldValue = fieldValue + .replace(/^[^:]+:/, '') + .replace(/\(.*\)/, '') + .replace(/\d+-(\d+)?/, ''); + + item.creators.push(ZU.cleanAuthor(fieldValue, type, true)); + break; + } + case 'Title': + if (!item.title) { + // titles after the first are usually annotated or otherwise + // difficult to deal with + item.title = fieldValue; + } + else { + item.extra = append(item.extra, `Alternate Title: ${fieldValue}`); + } + break; + case 'Date': + item.date = ZU.strToISO(fieldValue); + break; + case 'Measurements': + item.artworkSize = fieldValue; + break; + case 'Description': + case 'Collector\'s Notes': + item.abstractNote = append(item.abstractNote, fieldValue); + break; + case 'Repository': + item.archive = ZU.cleanTags(fieldValue); + break; + case 'Accession Number': + case 'Physical Location of Original': { + item.archiveLocation = ZU.cleanTags(fieldValue); + let linkMatches = fieldValue.match(/]+)["']?>/i); + if (linkMatches) { + item.url = linkMatches[1]; + } + break; + } + case 'Subject': + item.tags.push(...fieldValue.split(';').map(tag => ({ tag }))); + break; + case '_Archival Location': + if (!item.archiveLocation) { + // these are not often as useful as accession numbers + item.archiveLocation = fieldValue; + } + break; + case 'Rights': + case 'License': + item.rights = append(item.rights, ZU.cleanTags(fieldValue)); + break; + case 'Location': + item.extra = append(item.extra, `Depicted Location: ${fieldValue}`); + break; + case 'Source': + if (fieldValue.startsWith('Photographer:')) { + item.creators.push( + ZU.cleanAuthor( + fieldValue.substring('Photographer:'.length), + 'artist' + ) + ); + } + break; + case 'Notes': + item.notes.push({ note: fieldValue }); + break; + case 'Scale': + if (item.itemType == 'map') { + item.scale = fieldValue; + } + break; + case 'Type': + if (item.itemType == 'map') { + item.mapType = fieldValue; + } + break; + case 'Extent': + if (item.itemType == 'videoRecording') { + item.runningTime = fieldValue; + } + break; + default: + Z.debug(`Unknown field: ${fieldName} = ${fieldValue}`); + } + } + + if (!item.title) { + item.title = 'Untitled'; + } + + // PDF attachments not handled yet + + if (json.imageUrl) { + // ideal situation: the JSON has a direct image URL in it + item.attachments.push({ + title: 'Artwork Image', + mimeType: 'image/jpeg', + url: (json.imageServer || 'https://stor.artstor.org/') + json.imageUrl + }); + } + else if (meta.image_url) { + // almost ideal: we get a URL with some extraneous info that we need to + // clean, but after we do that, we can fetch the image directly + let basePart = 'https://stor.artstor.org/iiif/fpx/'; + let idPart = meta.image_url.replace(/\.fpx.*/, '.fpx'); + let imagePart = `/full/${meta.width},/0/default.jpg`; + + item.attachments.push({ + title: 'Artwork Image', + mimeType: 'image/jpeg', + url: basePart + idPart + imagePart + }); + } + else if (meta.image_compound_urls && meta.image_compound_urls.length) { + // not really very ideal: we need to make a second GET request for the + // "compound image" metadata + let imageURLs = meta.image_compound_urls + .map(imgURL => 'https://stor.artstor.org/iiif/' + imgURL); + ZU.doGet(imageURLs, function (respText) { + let { '@id': imageURL, width } = JSON.parse(respText); + item.attachments.push({ + title: 'Artwork Image', + mimeType: 'image/jpeg', + url: `${imageURL}/full/${width},/0/default.jpg` + }); + }, function () { + // when all requests have completed + item.complete(); + }); + return; + } + else if (doc) { + // bad: this last resort will fail if the user hasn't clicked the + // download link already (which they probably haven't). but at least + // it'll alert them that the translator *tried* to download the image, + // so they can do it themselves if they need to. + item.attachments.push({ + title: 'Artwork Image', + mimeType: 'image/jpeg', + url: attr(doc, '#downloadAssetLink', 'href') + }); + } + + item.complete(); +} + +function resolveTypeID(typeID) { + switch (typeID) { + case 24: + return 'videoRecording'; + default: + Z.debug('Unknown type ID (probably artwork): ' + typeID); + return 'artwork'; + } +} + +function append(existingText, newText) { + if (!existingText) { + return newText; + } + + if (!newText) { + return existingText; + } + + return existingText + '\n' + newText; +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://library.artstor.org/#/asset/openlibrary/external/4jEkdDElLjUzRkY6fz5%252BRXlDOHkje1x9fg%253D%253D", + "items": [ + { + "itemType": "artwork", + "title": "Trailer Home", + "creators": [ + { + "firstName": "Barbara", + "lastName": "Lane", + "creatorType": "artist" + } + ], + "date": "2001", + "extra": "Alternate Title: Exterior view\nDepicted Location: Bradford County, Pennsylvania", + "libraryCatalog": "ARTstor", + "rights": "Bryn Mawr College has made these images, which were taken by current and former faculty, students, and staff, and in some cases friends of the College, available for personal or research use. Users of these images are expected to abide by all copyright and other intellectual property laws. Where we know that Bryn Mawr College owns the copyright, we have attempted to include that information, because Bryn Mawr College grants any user the right to make any use of those images. In other cases the College has secured permission to make the image available, but the photographer still owns the copyright and all rights outside this limited license. Images currently protected by copyright that are not owned by Bryn Mawr College cannot be published or exhibited without obtaining the legally required permission from the copyright owner. It is the obligation of the researcher to determine and satisfy copyright and other restrictions. We recommend, where applicable, that patrons retain a record of their fair use determinations or attempts to secure permissions. Questions can be directed to sscommons@brynmawr.edu.\nThis image has been selected and made available by a user using Artstor's software tools. Artstor has not screened or selected this image or cleared any rights to it and is acting as an online service provider pursuant to 17 U.S.C. §512. Artstor disclaims any liability associated with the use of this image. Should you have any legal objection to the use of this image, please visit http://www.artstor.org/copyright for contact information and instructions on how to proceed.", + "url": "https://library.artstor.org/#/asset/openlibrary/external/4jEkdDElLjUzRkY6fz5%252BRXlDOHkje1x9fg%253D%253D", + "attachments": [ + { + "title": "Artwork Image", + "mimeType": "image/jpeg" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://library.artstor.org/#/asset/28315008", + "items": [ + { + "itemType": "artwork", + "title": "Tolu trade card (recto and verso)", + "creators": [ + { + "lastName": "Lawrence and Martin", + "creatorType": "artist" + } + ], + "abstractNote": "Unmounted medical trade card with text in English on the recto and verso.\nTrade cards promoting medical services and products were designed to directly connect patent medicine manufacturers to the consumer public. The peak popularity of trade cards is estimated to have been between 1870 and 1890.\nPhotographed by staff at the Center for Jewish History in 2020.", + "archive": "Medical Center Archives at NewYork Presbyterian/Weill Cornell Medicine", + "archiveLocation": "P-15356", + "artworkSize": "3.10\" x 4.45\"", + "libraryCatalog": "ARTstor", + "rights": "Presumed to be in the public domain, though please note that rights ownership varies and the researcher must determine these issues and assume full responsibility for fulfilling the usage terms connected with all archival material, as well as any third party or the licensing of any additional rights. In the event that the image becomes a source for publication, we request a credit line indicating the Medical Center Archives of NewYork-Presbyterian/Weill Cornell Medicine.\nThis image has been selected and made available by a user using Artstor's software tools. Artstor has not screened or selected this image or cleared any rights to it and is acting as an online service provider pursuant to 17 U.S.C. §512. Artstor disclaims any liability associated with the use of this image. Should you have any legal objection to the use of this image, please visit http://www.artstor.org/copyright for contact information and instructions on how to proceed.", + "url": "https://library.artstor.org/#/asset/28315008", + "attachments": [ + { + "title": "Artwork Image", + "mimeType": "image/jpeg" + } + ], + "tags": [ + { + "tag": "Advertising cards" + }, + { + "tag": "Cold (Disease)" + }, + { + "tag": "Cough" + }, + { + "tag": "Lungs -- Diseases" + }, + { + "tag": "Throat -- Diseases" + }, + { + "tag": "Tuberculosis" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://library.artstor.org/#/asset/28362645", + "items": [ + { + "itemType": "artwork", + "title": "Ubekendt dame med blomsterkrans", + "creators": [ + { + "firstName": "Cornelius", + "lastName": "Høyer", + "creatorType": "artist" + } + ], + "date": "1756", + "archive": "Statens Museum for Kunst", + "archiveLocation": "KMS4919", + "artworkSize": "54 x 47 mm", + "libraryCatalog": "ARTstor", + "rights": "Creative Commons: Free Reuse (CC0)", + "url": "https://collection.smk.dk/#/en/detail/KMS4919", + "attachments": [ + { + "title": "Artwork Image", + "mimeType": "image/jpeg" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://library.artstor.org/#/asset/SS7730456_7730456_11870403", + "defer": true, + "items": [ + { + "itemType": "map", + "title": "The Map Maker", + "creators": [ + { + "firstName": "Arthur", + "lastName": "Szyk", + "creatorType": "artist" + }, + { + "lastName": "Other Creators", + "creatorType": "artist" + } + ], + "date": "1942", + "abstractNote": "A satirical map attacking the Axis by the artist Arthur Szyk, published in Esquire Magazine in 1942. Goebbels welcomes General Tojo to the Axis, announcing that \"Now that you've joined us, the Fuhrer will make a special map for you,\" as Hitler paints the swastika over a bloody map of South and Latin America.\nSzyk was a Polish Jew whose work typically featured social and political issues. He emigrated to London in 1937 and to New York in 1940, and produced a number of attacks on the Nazis before and during World War II.", + "extra": "Alternate Title: Full TItle: The Map Maker [Hitler]", + "libraryCatalog": "ARTstor", + "mapType": "Map published in book or serial - source in collection", + "rights": "For important information about copyright and use, see http://persuasivemaps.library.cornell.edu/copyright.\nThis image has been selected and made available by a user using Artstor's software tools. Artstor has not screened or selected this image or cleared any rights to it and is acting as an online service provider pursuant to 17 U.S.C. §512. Artstor disclaims any liability associated with the use of this image. Should you have any legal objection to the use of this image, please visit http://www.artstor.org/copyright for contact information and instructions on how to proceed.", + "url": "https://library.artstor.org/#/asset/SS7730456_7730456_11870403", + "attachments": [ + { + "title": "Artwork Image", + "mimeType": "image/jpeg" + } + ], + "tags": [ + { + "tag": "Pictorial" + }, + { + "tag": "Satirical" + }, + { + "tag": "World War II" + } + ], + "notes": [ + { + "note": "For further information on the Collector’s Notes and a Feedback/Contact Link, see https://persuasivemaps.library.cornell.edu/content/about-collection-personal-statement and https://persuasivemaps.library.cornell.edu/content/feedback-and-contact" + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://library.artstor.org/#/asset/SS33851_33851_1648337", + "defer": true, + "items": [ + { + "itemType": "map", + "title": "Dolph's map of Wilmington and northern New Castle County", + "creators": [ + { + "lastName": "Dolph Map Company", + "creatorType": "artist" + } + ], + "abstractNote": "Index to streets", + "archive": "Special Collections, University of Delaware Library / Newark, Delaware 19717-5267", + "archiveLocation": "Spec, Oversized map drawers, Oversized drawer 3 Folder 7", + "extra": "Alternate Title: Municipal maps\nDepicted Location: United States--Delaware--New Castle County--Wilmington", + "libraryCatalog": "ARTstor", + "rights": "Use of materials from this collection beyond the exceptions provided for in the Fair Use and Educational Use clauses of the U.S. Copyright Law may violate federal law. Permission to publish is required from the copyright holder. Please contact Special Collections, University of Delaware Library, http://www.lib.udel.edu/cgi-bin/askspec.cgi\nThis image has been selected and made available by a user using Artstor's software tools. Artstor has not screened or selected this image or cleared any rights to it and is acting as an online service provider pursuant to 17 U.S.C. §512. Artstor disclaims any liability associated with the use of this image. Should you have any legal objection to the use of this image, please visit http://www.artstor.org/copyright for contact information and instructions on how to proceed.", + "scale": "3000 feet to the inch", + "url": "https://library.artstor.org/#/asset/SS33851_33851_1648337", + "attachments": [ + { + "title": "Artwork Image", + "mimeType": "image/jpeg" + } + ], + "tags": [ + { + "tag": " Delaware--Maps." + }, + { + "tag": "Wilmington (Del.)--Maps." + } + ], + "notes": [ + { + "note": "One of five maps on a single sheet. Top corner torn (inset map of Newark). Additional information in collection folders." + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://library.artstor.org/#/asset/SS7730507_7730507_8920869", + "defer": true, + "items": [ + { + "itemType": "videoRecording", + "title": "Congressional Conversation: Pell and Brooke (a)", + "creators": [ + { + "lastName": "Senator Claiborne Pell", + "creatorType": "contributor" + } + ], + "date": "1969", + "abstractNote": "Congressional Conversation(a): Senators Pell and Brooke discuss political issues including the Vietnam War, Justice Fortas' resignation, ethics rules, and the state of the fishing industry.", + "archive": "University of Rhode Island Libraries", + "libraryCatalog": "ARTstor", + "rights": "All rights reserved. For copyright and permissions, contact the University of Rhode Island Libraries at archives@etal.uri.edu.\nThis image has been selected and made available by a user using Artstor's software tools. Artstor has not screened or selected this image or cleared any rights to it and is acting as an online service provider pursuant to 17 U.S.C. §512. Artstor disclaims any liability associated with the use of this image. Should you have any legal objection to the use of this image, please visit http://www.artstor.org/copyright for contact information and instructions on how to proceed.", + "runningTime": "00:28:36", + "shortTitle": "Congressional Conversation", + "url": "https://library.artstor.org/#/asset/SS7730507_7730507_8920869", + "attachments": [ + { + "title": "Artwork Image", + "mimeType": "image/jpeg" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://library.artstor.org/#/asset/SS35428_35428_20594675", + "items": [ + { + "itemType": "artwork", + "title": "Big Trees of the West - Second Cut from a Redwood Log.; verso: G28 Pacific Novelty Company, Publishers, San Francisco, Cal. Made in Germany [divided back, no message]", + "creators": [ + { + "firstName": "American", + "lastName": "Pacific Novelty Company (publisher", + "creatorType": "artist" + } + ], + "date": "1907", + "archive": "Trinity College, Watkinson Library (Hartford, Connecticut, USA)", + "archiveLocation": "Box 19.174-3", + "artworkSize": "9 x 14 cm (3.54 x 5.51 inches) approximately", + "extra": "Alternate Title: overall\nAlternate Title: recto", + "libraryCatalog": "ARTstor", + "rights": "This digital collection and its contents are made available by Trinity College Library for limited non-commercial, educational and personal use only. For other uses, or for additional information regarding the collection, contact the staff of Watkinson Library (www.watkinsonlibrary.org).\nThis image has been selected and made available by a user using Artstor's software tools. Artstor has not screened or selected this image or cleared any rights to it and is acting as an online service provider pursuant to 17 U.S.C. §512. Artstor disclaims any liability associated with the use of this image. Should you have any legal objection to the use of this image, please visit http://www.artstor.org/copyright for contact information and instructions on how to proceed.", + "shortTitle": "Big Trees of the West - Second Cut from a Redwood Log.; verso", + "url": "https://library.artstor.org/#/asset/SS35428_35428_20594675", + "attachments": [ + { + "title": "Artwork Image", + "mimeType": "image/jpeg" + } + ], + "tags": [ + { + "tag": " California (USA)" + }, + { + "tag": " Logging" + }, + { + "tag": " Lumber industry" + }, + { + "tag": " Redwood (genus, Sequoia)" + }, + { + "tag": " Sequoiadendron giganteum (Giant redwood, species)" + }, + { + "tag": " Trees" + }, + { + "tag": "Postcards" + } + ], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/ASCE.js b/translators/ASCE.js new file mode 100644 index 0000000..fe79b26 --- /dev/null +++ b/translators/ASCE.js @@ -0,0 +1,199 @@ +{ + "translatorID": "303bdfc5-11b8-4107-bca1-63ca97701a0f", + "label": "ASCE", + "creator": "Sebastian Karcher", + "target": "^https?://(www\\.)?ascelibrary\\.org/(toc|doi|action)/", + "minVersion": "2.1.9", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2020-06-28 02:29:25" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2020 Sebastian Karcher + + 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 ***** +*/ + + +// attr()/text() v2 +// eslint-disable-next-line +function attr(docOrElem,selector,attr,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.getAttribute(attr):null}function text(docOrElem,selector,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.textContent:null} + +function detectWeb(doc, url) { + if (/\/doi\/((abs|full)\/)?10\./.test(url)) { + return "journalArticle"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('div[class*="art_title"]>a'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + // EM only gets a social media preview for the abastract + let abstract = text(doc, 'article.article div[class*="Abstract"]>p'); + + // Z.debug(abstract); + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', function (obj, item) { + item.libraryCatalog = "ASCE"; + if (abstract) { + item.abstractNote = abstract; + } + // Remove mapping from DC:coverage to archiveLocation + item.archiveLocation = ""; + item.complete(); + }); + + translator.getTranslatorObject(function (trans) { + trans.doWeb(doc, url); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://ascelibrary.org/action/doSearch?text1=test&field1=AllField&logicalOpe1=AND&text2=&field2=AllField&logicalOpe2=NOT&text3=&field3=AllField&logicalOpe3=AND&text4=&field4=AllField&logicalOpe4=AND&text5=&field5=AllField&logicalOpe5=AND&text6=&field6=AllField&logicalOpe6=AND&text7=&field7=AllField&AfterMonth=&AfterYear=&BeforeMonth=&BeforeYear=", + "items": "multiple" + }, + { + "type": "web", + "url": "https://ascelibrary.org/doi/abs/10.1061/%28ASCE%290887-381X%282003%2917%3A1%2837%29", + "items": [ + { + "itemType": "journalArticle", + "title": "Friction Measurement on Cycleways Using a Portable Friction Tester", + "creators": [ + { + "firstName": "A.", + "lastName": "Bergström", + "creatorType": "author" + }, + { + "firstName": "H.", + "lastName": "Åström", + "creatorType": "author" + }, + { + "firstName": "R.", + "lastName": "Magnusson", + "creatorType": "author" + } + ], + "date": "2003/03/01", + "DOI": "10.1061/(ASCE)0887-381X(2003)17:1(37)", + "ISSN": "0887-381X", + "abstractNote": "In seeking to promote cycling in wintertime, it is desirable to understand how important the winter maintenance service level is in people’s decision to cycle or not, and methods to compare different road conditions on cycleways are therefore needed. By measuring friction, an assessment of the service level can be achieved, but methods available often involve the use of large vehicles, which can lead to overloading damage on cycleways, and constitute a safety risk for cyclists and pedestrians. A portable friction tester (PFT), originally designed to measure friction on road markings, was thought to be an appropriate instrument for cycleways and was, therefore, tested on different winter road conditions, and on different cycleway pavement materials. In this study, it was found that the PFT is a valuable tool for measuring friction on cycleways. Different winter road conditions, as well as different pavement materials, can be distinguished from each other through PFT measurements. The PFT provides a good complement to visual inspections of cycleways in winter maintenance evaluation and can, for example, be used to determine if desired service levels have been achieved.", + "issue": "1", + "language": "EN", + "libraryCatalog": "ASCE", + "pages": "37-57", + "publicationTitle": "Journal of Cold Regions Engineering", + "rights": "Copyright © 2003 American Society of Civil Engineers", + "url": "https://ascelibrary.org/doi/abs/10.1061/%28ASCE%290887-381X%282003%2917%3A1%2837%29", + "volume": "17", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "Snapshot" + } + ], + "tags": [ + { + "tag": "Bicycles" + }, + { + "tag": "Friction" + }, + { + "tag": "Maintenance" + }, + { + "tag": "Measurement" + }, + { + "tag": "Roads" + }, + { + "tag": "friction" + }, + { + "tag": "inspection" + }, + { + "tag": "maintenance engineering" + }, + { + "tag": "road traffic" + }, + { + "tag": "safety" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://ascelibrary.org/toc/jcemd4/138/5", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/ASCO Meeting Library.js b/translators/ASCO Meeting Library.js new file mode 100644 index 0000000..1099e80 --- /dev/null +++ b/translators/ASCO Meeting Library.js @@ -0,0 +1,153 @@ +{ + "translatorID": "03d1aac2-bee2-43f4-8d9c-b96ef31e8c61", + "label": "ASCO Meeting Library", + "creator": "Sebastian Karcher", + "target": "^https?://meetinglibrary\\.asco\\.org/(content|search)", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-06-07 16:47:39" +} + +/* FW LINE 59:b820c6d */ function flatten(t){var e=new Array;for(var i in t){var r=t[i];r instanceof Array?e=e.concat(flatten(r)):e.push(r)}return e}var FW={_scrapers:new Array};FW._Base=function(){this.callHook=function(t,e,i,r){if("object"==typeof this.hooks){var n=this.hooks[t];"function"==typeof n&&n(e,i,r)}},this.evaluateThing=function(t,e,i){var r=typeof t;if("object"===r){if(t instanceof Array){var n=this.evaluateThing,a=t.map(function(t){return n(t,e,i)});return flatten(a)}return t.evaluate(e,i)}return"function"===r?t(e,i):t},this.makeItems=function(t,e,i,r,n){n()}},FW.Scraper=function(t){FW._scrapers.push(new FW._Scraper(t))},FW._Scraper=function(t){for(x in t)this[x]=t[x];this._singleFieldNames=["abstractNote","applicationNumber","archive","archiveLocation","artworkMedium","artworkSize","assignee","audioFileType","audioRecordingType","billNumber","blogTitle","bookTitle","callNumber","caseName","code","codeNumber","codePages","codeVolume","committee","company","conferenceName","country","court","date","dateDecided","dateEnacted","dictionaryTitle","distributor","docketNumber","documentNumber","DOI","edition","encyclopediaTitle","episodeNumber","extra","filingDate","firstPage","forumTitle","genre","history","institution","interviewMedium","ISBN","ISSN","issue","issueDate","issuingAuthority","journalAbbreviation","label","language","legalStatus","legislativeBody","letterType","libraryCatalog","manuscriptType","mapType","medium","meetingName","nameOfAct","network","number","numberOfVolumes","numPages","pages","patentNumber","place","postType","presentationType","priorityNumbers","proceedingsTitle","programTitle","programmingLanguage","publicLawNumber","publicationTitle","publisher","references","reportNumber","reportType","reporter","reporterVolume","rights","runningTime","scale","section","series","seriesNumber","seriesText","seriesTitle","session","shortTitle","studio","subject","system","thesisType","title","type","university","url","version","videoRecordingType","volume","websiteTitle","websiteType"],this._makeAttachments=function(t,e,i,r){if(i instanceof Array)i.forEach(function(i){this._makeAttachments(t,e,i,r)},this);else if("object"==typeof i){var n=i.urls||i.url,a=i.types||i.type,s=i.titles||i.title,o=i.snapshots||i.snapshot,u=this.evaluateThing(n,t,e),l=this.evaluateThing(s,t,e),c=this.evaluateThing(a,t,e),h=this.evaluateThing(o,t,e);u instanceof Array||(u=[u]);for(var f in u){var p,m,v,d=u[f];p=c instanceof Array?c[f]:c,m=l instanceof Array?l[f]:l,v=h instanceof Array?h[f]:h,r.attachments.push({url:d,title:m,mimeType:p,snapshot:v})}}},this.makeItems=function(t,e,i,r,n){var a=new Zotero.Item(this.itemType);a.url=e;for(var s in this._singleFieldNames){var o=this._singleFieldNames[s];if(this[o]){var u=this.evaluateThing(this[o],t,e);u instanceof Array?a[o]=u[0]:a[o]=u}}var l=["creators","tags"];for(var c in l){var h=l[c],f=this.evaluateThing(this[h],t,e);if(f)for(var p in f)a[h].push(f[p])}this._makeAttachments(t,e,this.attachments,a),r(a,this,t,e),n()}},FW._Scraper.prototype=new FW._Base,FW.MultiScraper=function(t){FW._scrapers.push(new FW._MultiScraper(t))},FW._MultiScraper=function(t){for(x in t)this[x]=t[x];this._mkSelectItems=function(t,e){var i=new Object;for(var r in t)i[e[r]]=t[r];return i},this._selectItems=function(t,e,i){var r=new Array;Zotero.selectItems(this._mkSelectItems(t,e),function(t){for(var e in t)r.push(e);i(r)})},this._mkAttachments=function(t,e,i){var r=this.evaluateThing(this.attachments,t,e),n=new Object;if(r)for(var a in i)n[i[a]]=r[a];return n},this._makeChoices=function(t,e,i,r,n){if(t instanceof Array)t.forEach(function(t){this._makeTitlesUrls(t,e,i,r,n)},this);else if("object"==typeof t){var a=t.urls||t.url,s=t.titles||t.title,o=this.evaluateThing(a,e,i),u=this.evaluateThing(s,e,i),l=u instanceof Array;o instanceof Array||(o=[o]);for(var c in o){var h,f=o[c];h=l?u[c]:u,n.push(f),r.push(h)}}},this.makeItems=function(t,e,i,r,n){if(this.beforeFilter){var a=this.beforeFilter(t,e);if(a!=e)return void this.makeItems(t,a,i,r,n)}var s=[],o=[];this._makeChoices(this.choices,t,e,s,o);var u=this._mkAttachments(t,e,o),l=this.itemTrans;this._selectItems(s,o,function(t){if(t){var e=function(t){var e=t.documentURI,i=l;void 0===i&&(i=FW.getScraper(t,e)),void 0===i||i.makeItems(t,e,u[e],r,function(){})};Zotero.Utilities.processDocuments(t,e,n)}else n()})}},FW._MultiScraper.prototype=new FW._Base,FW.WebDelegateTranslator=function(t){return new FW._WebDelegateTranslator(t)},FW._WebDelegateTranslator=function(t){for(x in t)this[x]=t[x];this.makeItems=function(t,e,i,r,n){var a=this,s=Zotero.loadTranslator("web");s.setHandler("itemDone",function(i,n){r(n,a,t,e)}),s.setDocument(t),this.translatorId?(s.setTranslator(this.translatorId),s.translate()):(s.setHandler("translators",function(t,e){e.length&&(s.setTranslator(e[0]),s.translate())}),s.getTranslators()),n()}},FW._WebDelegateTranslator.prototype=new FW._Base,FW._StringMagic=function(){this._filters=new Array,this.addFilter=function(t){return this._filters.push(t),this},this.split=function(t){return this.addFilter(function(e){return e.split(t).filter(function(t){return""!=t})})},this.replace=function(t,e,i){return this.addFilter(function(r){return r.match(t)?r.replace(t,e,i):r})},this.prepend=function(t){return this.replace(/^/,t)},this.append=function(t){return this.replace(/$/,t)},this.remove=function(t,e){return this.replace(t,"",e)},this.trim=function(){return this.addFilter(function(t){return Zotero.Utilities.trim(t)})},this.trimInternal=function(){return this.addFilter(function(t){return Zotero.Utilities.trimInternal(t)})},this.match=function(t,e){return e||(e=0),this.addFilter(function(i){var r=i.match(t);return void 0===r||null===r?void 0:r[e]})},this.cleanAuthor=function(t,e){return this.addFilter(function(i){return Zotero.Utilities.cleanAuthor(i,t,e)})},this.key=function(t){return this.addFilter(function(e){return e[t]})},this.capitalizeTitle=function(){return this.addFilter(function(t){return Zotero.Utilities.capitalizeTitle(t)})},this.unescapeHTML=function(){return this.addFilter(function(t){return Zotero.Utilities.unescapeHTML(t)})},this.unescape=function(){return this.addFilter(function(t){return unescape(t)})},this._applyFilters=function(t,e){for(i in this._filters){t=flatten(t),t=t.filter(function(t){return void 0!==t&&null!==t});for(var r=0;r0&&a[0])return n}},FW.getScraper=function(t,e){var i=FW.detectWeb(t,e);return FW._scrapers.filter(function(r){return r.evaluateThing(r.itemType,t,e)==i&&r.evaluateThing(r.detect,t,e)})[0]},FW.doWeb=function(t,e){var i=FW.getScraper(t,e);i.makeItems(t,e,[],function(t,e,i,r){e.callHook("scraperDone",t,i,r),t.title||(t.title=""),t.complete()},function(){Zotero.done()}),Zotero.wait()}; +function detectWeb(doc, url) { return FW.detectWeb(doc, url); } +function doWeb(doc, url) { return FW.doWeb(doc, url); } + + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2013 Sebastian Karcher + 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 ***** +*/ + +FW.Scraper({ +itemType : 'journalArticle', +detect : FW.Url().match(/content\/\d+\-\d+/), +title : FW.Xpath ('//div[@class="content"]/h3').text().trim().replace(/\.$/, ''), +creators : FW.Xpath ('//div[contains(@class, "field-name-field-authors")]/div[@class="field-items"]') + .text().remove(/\;.*/m ).split(/\,/).replace(/\s/," ").cleanAuthor("author"), +date : FW.Xpath ('//div[contains(@class, "field-name-field-citation")]/div[@class="field-items"]').text().match( /\d{4}/ ).trim(), +publicationTitle : "Journal of Clinical Oncology", +journalAbbreviation: "J. Clin. Oncol.", +ISSN : "0732-183X", +url : FW.Url(), +volume: FW.Xpath ('//div[contains(@class, "field-name-field-citation")]/div[@class="field-items"]').text().remove(/,.+/).remove(/J Clin Oncol\s*/), +issue: FW.Xpath ('//div[contains(@class, "field-name-field-citation")]/div[@class="field-items"]').text().match(/\(.+\)/).remove(/[\(\)]/g), +abstractNote : FW.Xpath ('//div[@class="field-label" and contains(text(), "Abstract:")]/following-sibling::p').text().remove(/Background:/).trim(), +meetingName : FW.Xpath ('//div[contains(@class, "field-name-field-meeting")]/div[@class="field-items"]//a').text().trim(), +tags : FW.Xpath ('//div[contains(@class, "field-name-field-subcategories")]/div[@class="field-items"]//a').text().remove(/;[\s\S]*/).split(/\//).trim() +}); + +FW.MultiScraper({ +itemType : 'multiple', +detect : FW.Url().match(/\/search\//), +choices : { + titles : FW.Xpath('//li[@class="search-result"]//h3[contains(@class, "title")]/a').text().trim(), + urls : FW.Xpath('//li[@class="search-result"]//h3[contains(@class, "title")]/a').key("href") +} +});/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://meetinglibrary.asco.org/content/112732-132", + "items": [ + { + "itemType": "journalArticle", + "title": "Denosumab versus placebo as adjuvant treatment for women with early-stage breast cancer at high risk of disease recurrence (D-CARE): An international, placebo-controlled, randomized, double-blind phase III clinical trial", + "creators": [ + { + "firstName": "Paul E.", + "lastName": "Goss", + "creatorType": "author" + }, + { + "firstName": "Carlos H.", + "lastName": "Barrios", + "creatorType": "author" + }, + { + "firstName": "Arlene", + "lastName": "Chan", + "creatorType": "author" + }, + { + "firstName": "Dianne M.", + "lastName": "Finkelstein", + "creatorType": "author" + }, + { + "firstName": "Hiroji", + "lastName": "Iwata", + "creatorType": "author" + }, + { + "firstName": "Miguel", + "lastName": "Martin", + "creatorType": "author" + }, + { + "firstName": "Ada", + "lastName": "Braun", + "creatorType": "author" + }, + { + "firstName": "Beiying", + "lastName": "Ding", + "creatorType": "author" + }, + { + "firstName": "Tapan", + "lastName": "Maniar", + "creatorType": "author" + }, + { + "firstName": "Robert E.", + "lastName": "Coleman", + "creatorType": "author" + } + ], + "date": "2013", + "ISSN": "0732-183X", + "abstractNote": "In women with early-stage breast cancer, bone is a common site of distant recurrence and represents approximately 40% of all first recurrences. Preclinical studies demonstrated that inhibition of RANKL significantly delays skeletal tumor formation, reduces skeletal tumor burden, and prolongs survival of tumor-bearing mice. Denosumab is approved for the prevention of skeletal-related events (SREs) in patients with established bone metastases from solid tumors. The D-CARE trial is designed to assess if denosumab treatment prolongs bone metastasis-free survival (BMFS) and disease-free survival (DFS) in the adjuvant breast cancer setting. The primary endpoint of this event-driven trial is BMFS. Secondary endpoints include DFS and overall survival. Additional endpoints include safety, breast density, time to first on-study SRE (following the development of bone metastasis), patient reported outcomes, and biomarkers. Methods: In this international, randomized, double-blind, and placebo-controlled phase 3 trial, 4509 women with stage II or III breast cancer at high risk for recurrence and with known hormone and HERE2 receptor status were randomized. High risk was defined as biopsy evidence of breast cancer in regional lymph nodes, tumor size > 5 cm (T3), or locally advanced disease (T4). Standard-of-care adjuvant or neoadjuvant chemo-, endocrine, or HER-2 targeted therapy, alone or in combination, must be planned. Patients with a prior history of breast cancer (except DCIS or LCIS) or distant metastasis, oral bisphosphonate (BP) use within 1 year of randomization, or any intravenous BP use, were not eligible. Patients were randomized 1:1 to receive denosumab 120 mg or placebo subcutaneously monthly for 6 months, then every 3 months for a total of 5 years of treatment. Supplemental vitamin D (≥ 400 IU) and calcium (≥ 500 mg) were required. The trial, sponsored by Amgen Inc., began enrolling patients in June 2010 and completed enrollment in late 2012. Clinical trial information: NCT01077154.", + "issue": "suppl; abstr TPS662", + "journalAbbreviation": "J. Clin. Oncol.", + "libraryCatalog": "ASCO Meeting Library", + "publicationTitle": "Journal of Clinical Oncology", + "shortTitle": "Denosumab versus placebo as adjuvant treatment for women with early-stage breast cancer at high risk of disease recurrence (D-CARE)", + "url": "http://meetinglibrary.asco.org/content/112732-132", + "volume": "31", + "attachments": [], + "tags": [ + "HER2+" + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://meetinglibrary.asco.org/search/site/?f[0]=bundle_name%3AAbstract&f[1]=fctContentType%3AAbstract&the_title=test", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/ASTIS.js b/translators/ASTIS.js new file mode 100644 index 0000000..8a194a3 --- /dev/null +++ b/translators/ASTIS.js @@ -0,0 +1,337 @@ +{ + "translatorID": "d4e227c0-cebb-425a-ac8d-a6625c4bfdd2", + "label": "ASTIS", + "creator": "Abe Jellinek", + "target": "^https?://(www\\.)?aina\\.ucalgary\\.ca/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-08-04 19:44:55" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (doc.querySelector('a[href*="doi."]')) { + return "journalArticle"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('a[href*="?RECORD"]'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, _url) { + let DOI = ZU.cleanDOI(attr(doc, 'a[href*="doi."]', 'href')); + + let search = Zotero.loadTranslator('search'); + + search.setHandler('translators', function (_, translators) { + search.setTranslator(translators); + search.setHandler('itemDone', function (_, item) { + item.complete(); + }); + search.translate(); + }); + + search.setSearch({ DOI }); + search.getTranslators(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.aina.ucalgary.ca/scripts/mwimain.dll/415/4/1?RECLIST&DATABASE=ASTIS&TM=1628105772.604", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.aina.ucalgary.ca/scripts/mwimain.dll/415/4/4/85845?RECORD&DATABASE=ASTIS", + "items": [ + { + "itemType": "journalArticle", + "title": "Parasitoids indicate major climate‐induced shifts in arctic communities", + "creators": [ + { + "creatorType": "author", + "firstName": "Tuomas", + "lastName": "Kankaanpää" + }, + { + "creatorType": "author", + "firstName": "Eero", + "lastName": "Vesterinen" + }, + { + "creatorType": "author", + "firstName": "Bess", + "lastName": "Hardwick" + }, + { + "creatorType": "author", + "firstName": "Niels M.", + "lastName": "Schmidt" + }, + { + "creatorType": "author", + "firstName": "Tommi", + "lastName": "Andersson" + }, + { + "creatorType": "author", + "firstName": "Paul E.", + "lastName": "Aspholm" + }, + { + "creatorType": "author", + "firstName": "Isabel C.", + "lastName": "Barrio" + }, + { + "creatorType": "author", + "firstName": "Niklas", + "lastName": "Beckers" + }, + { + "creatorType": "author", + "firstName": "Joël", + "lastName": "Bêty" + }, + { + "creatorType": "author", + "firstName": "Tone", + "lastName": "Birkemoe" + }, + { + "creatorType": "author", + "firstName": "Melissa", + "lastName": "DeSiervo" + }, + { + "creatorType": "author", + "firstName": "Katherine H. I.", + "lastName": "Drotos" + }, + { + "creatorType": "author", + "firstName": "Dorothee", + "lastName": "Ehrich" + }, + { + "creatorType": "author", + "firstName": "Olivier", + "lastName": "Gilg" + }, + { + "creatorType": "author", + "firstName": "Vladimir", + "lastName": "Gilg" + }, + { + "creatorType": "author", + "firstName": "Nils", + "lastName": "Hein" + }, + { + "creatorType": "author", + "firstName": "Toke T.", + "lastName": "Høye" + }, + { + "creatorType": "author", + "firstName": "Kristian M.", + "lastName": "Jakobsen" + }, + { + "creatorType": "author", + "firstName": "Camille", + "lastName": "Jodouin" + }, + { + "creatorType": "author", + "firstName": "Jesse", + "lastName": "Jorna" + }, + { + "creatorType": "author", + "firstName": "Mikhail V.", + "lastName": "Kozlov" + }, + { + "creatorType": "author", + "firstName": "Jean‐Claude", + "lastName": "Kresse" + }, + { + "creatorType": "author", + "firstName": "Don‐Jean", + "lastName": "Leandri‐Breton" + }, + { + "creatorType": "author", + "firstName": "Nicolas", + "lastName": "Lecomte" + }, + { + "creatorType": "author", + "firstName": "Maarten", + "lastName": "Loonen" + }, + { + "creatorType": "author", + "firstName": "Philipp", + "lastName": "Marr" + }, + { + "creatorType": "author", + "firstName": "Spencer K.", + "lastName": "Monckton" + }, + { + "creatorType": "author", + "firstName": "Maia", + "lastName": "Olsen" + }, + { + "creatorType": "author", + "firstName": "Josée‐Anne", + "lastName": "Otis" + }, + { + "creatorType": "author", + "firstName": "Michelle", + "lastName": "Pyle" + }, + { + "creatorType": "author", + "firstName": "Ruben E.", + "lastName": "Roos" + }, + { + "creatorType": "author", + "firstName": "Katrine", + "lastName": "Raundrup" + }, + { + "creatorType": "author", + "firstName": "Daria", + "lastName": "Rozhkova" + }, + { + "creatorType": "author", + "firstName": "Brigitte", + "lastName": "Sabard" + }, + { + "creatorType": "author", + "firstName": "Aleksandr", + "lastName": "Sokolov" + }, + { + "creatorType": "author", + "firstName": "Natalia", + "lastName": "Sokolova" + }, + { + "creatorType": "author", + "firstName": "Anna M.", + "lastName": "Solecki" + }, + { + "creatorType": "author", + "firstName": "Christine", + "lastName": "Urbanowicz" + }, + { + "creatorType": "author", + "firstName": "Catherine", + "lastName": "Villeneuve" + }, + { + "creatorType": "author", + "firstName": "Evgenya", + "lastName": "Vyguzova" + }, + { + "creatorType": "author", + "firstName": "Vitali", + "lastName": "Zverev" + }, + { + "creatorType": "author", + "firstName": "Tomas", + "lastName": "Roslin" + } + ], + "date": "11/2020", + "DOI": "10.1111/gcb.15297", + "ISSN": "1354-1013, 1365-2486", + "issue": "11", + "journalAbbreviation": "Glob Change Biol", + "language": "en", + "libraryCatalog": "DOI.org (Crossref)", + "pages": "6276-6295", + "publicationTitle": "Global Change Biology", + "url": "https://onlinelibrary.wiley.com/doi/10.1111/gcb.15297", + "volume": "26", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/ATS International Journal.js b/translators/ATS International Journal.js new file mode 100644 index 0000000..cb65919 --- /dev/null +++ b/translators/ATS International Journal.js @@ -0,0 +1,290 @@ +{ + "translatorID": "ec0628ad-e508-444e-9e4c-e1819766a1ae", + "label": "ATS International Journal", + "creator": "Philipp Zumstein", + "target": "^https?://(www\\.)?atsinternationaljournal\\.com/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2019-09-10 19:50:28" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2019 Philipp Zumstein + + 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 ***** +*/ + + +// attr()/text() v2 +// eslint-disable-next-line +function attr(docOrElem,selector,attr,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.getAttribute(attr):null;}function text(docOrElem,selector,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.textContent:null;} + + +// convert a roman number, e.g. XLVIII into an arabic number, e.g. 48 +function roman2arabic(roman) { + let mapping = { + M: 1000, + D: 500, + C: 100, + L: 50, + X: 10, + V: 5, + I: 1 + }; + let result = 0; + for (let i = 0; i < roman.length; i++) { + let value = mapping[roman[i]]; + if (i + 1 < roman.length) { + if (value >= mapping[roman[i + 1]]) { + result += mapping[roman[i]]; + } + else { + result -= mapping[roman[i]]; + } + } + else { + result += mapping[roman[i]]; + } + } + return result; +} + +function detectWeb(doc, url) { + // TODO: can wo do this better? + if (url.split('/').length == 7) { + return "journalArticle"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('.article-title a, .search-results a, .category li a'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var item = new Zotero.Item('journalArticle'); + item.title = text(doc, 'h1.article-title'); + // we use volume here because the issues are numbered + // consecutively over years + item.volume = text(doc, 'h1.page-title'); + if (item.volume) { + item.date = ZU.strToISO(item.volume); + // convert the volume numbers into arabic numbers + if (item.volume.includes(' - ')) { + let conversion = roman2arabic(item.volume.split(' - ')[0]); + if (conversion !== 0) { + item.volume = conversion; + } + } + else { + // Special Issue 2018 Vol2 --> Special Issue 2 + item.volume = item.volume.replace(/\d\d\d\d(\s+Vol\.?\s*)?/, ''); + } + } + var authors = text(doc, 'section.article-content em'); + if (authors) { + item.creators = authors.split(',').map(name => ZU.cleanAuthor(name, "author")); + } + var tags = doc.querySelectorAll('.tags *[itemprop=keywords]'); + item.tags = []; + for (let tag of tags) { + item.tags.push(tag.textContent.trim()); + } + item.pages = ZU.xpathText(doc, '//section[contains(@class, "article-content")]//strong[contains(., "Pages")]/following-sibling::text()[1]'); + item.abstractNote = ZU.xpathText(doc, '//section[contains(@class, "article-content")]//strong[contains(., "Abstract")]/following-sibling::text()[1]'); + var keywords = ZU.xpathText(doc, '//section[contains(@class, "article-content")]//strong[contains(., "Keywords")]/following-sibling::text()[1]'); + if (keywords && item.tags.length === 0) { + item.tags = keywords.split(';'); + } + + item.url = url; + item.ISSN = '1824-5463'; + item.language = 'en'; + item.publicationTitle = 'Advances in Transportation Studies'; + item.journalAbbreviation = 'ATS'; + item.extra = 'pusblisher:Aracne Editrice\nplace:Roma'; + item.complete(); +} + + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://www.atsinternationaljournal.com/index.php/2019-issues/xlviii-july-2019/1056-do-drivers-have-a-good-understanding-of-distraction-by-wrap-advertisements-investigating-the-impact-of-wrap-advertisement-on-distraction-related-driver-s-accidents", + "items": [ + { + "itemType": "journalArticle", + "title": "Do drivers have a good understanding of distraction by wrap advertisements? Investigating the impact of wrap advertisement on distraction-related driver’s accidents", + "creators": [ + { + "firstName": "A. R.", + "lastName": "Mahpour", + "creatorType": "author" + }, + { + "firstName": "A. Mohammadian", + "lastName": "Amiri", + "creatorType": "author" + }, + { + "firstName": "E. Shah", + "lastName": "Ebrahimi", + "creatorType": "author" + } + ], + "date": "2019-07", + "ISSN": "1824-5463", + "abstractNote": "Drivers encounter a variety of outdoor advertising including fixed and wrap advertisement and large amounts of information and data in different locations, which can sometimes confuse the audience due to congestion, accumulation, and non-compliance with the standards and diversity of concepts. Fully understanding how small distractions can influence the ability to drive could prevent a serious accident. Despite the enormous amount of effort has been devoted to evaluating the impact of fix advertising on traffic safety, the importance of investing wrap advertisements seems to be disregarded. Therefore, the present study seeks firstly to compare the importance of distraction caused by wrap advertisement with other parameters affecting drivers’ awareness, then to find out which aspects of wrap advertisement may distract drivers while driving. To address this objective, at first, a questionnaire-based accidents database was prepared regarding those occurred because of distraction, and then the weight of distraction caused by wrap advertisement was identified using AHP. Subsequently, accidents that occurred because of this specific issue were modeled using the discrete choice technique. The results showed that in contrast with the prevailing opinion of drivers, the probability of distraction while driving caused by wrap advertisement is relatively high which can be considered as an alarming issue. Moreover, according to the results of discrete choice modeling, drivers with different characteristics, such as age or gender can be affected by wrap advertisement in different ways.", + "extra": "pusblisher:Aracne Editrice\nplace:Roma", + "journalAbbreviation": "ATS", + "language": "en", + "libraryCatalog": "ATS International Journal", + "pages": "19-30", + "publicationTitle": "Advances in Transportation Studies", + "shortTitle": "Do drivers have a good understanding of distraction by wrap advertisements?", + "url": "http://www.atsinternationaljournal.com/index.php/2019-issues/xlviii-july-2019/1056-do-drivers-have-a-good-understanding-of-distraction-by-wrap-advertisements-investigating-the-impact-of-wrap-advertisement-on-distraction-related-driver-s-accidents", + "volume": 48, + "attachments": [], + "tags": [ + { + "tag": "Analysis" + }, + { + "tag": "Crashes" + }, + { + "tag": "Driver" + }, + { + "tag": "Driver Behaviour" + }, + { + "tag": "Models" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.atsinternationaljournal.com/index.php/2004-issues/special-issue-2004", + "items": "multiple" + }, + { + "type": "web", + "url": "http://www.atsinternationaljournal.com/index.php/paper-search?q=reference+management", + "items": "multiple" + }, + { + "type": "web", + "url": "http://www.atsinternationaljournal.com/index.php/2018-issues/special-issue-2018-vol2/989-dynamic-traffic-safety-grade-evaluation-model-for-road-sections-based-on-gray-fixed-weight-clustering", + "items": [ + { + "itemType": "journalArticle", + "title": "Dynamic traffic safety grade evaluation model for road sections based on gray fixed weight clustering", + "creators": [ + { + "firstName": "H. L.", + "lastName": "Jing", + "creatorType": "author" + }, + { + "firstName": "L. T.", + "lastName": "Ye", + "creatorType": "author" + }, + { + "firstName": "J. Z.", + "lastName": "Wang", + "creatorType": "author" + }, + { + "firstName": "Z.", + "lastName": "Xie", + "creatorType": "author" + }, + { + "firstName": "M.", + "lastName": "Brown", + "creatorType": "author" + } + ], + "date": "2018", + "ISSN": "1824-5463", + "abstractNote": "The conventional gray predication model GM (1, 1) cannot accurately analyze the dynamic traffic index information of complex and scattered road sections because it may cause relatively large error and performs not well in stability. In order to solve this problem, a dynamic traffic safety grade evaluation model for road sections based on gray fixed weight clustering is designed. In this method, In this method, the gray clustering evaluation method is adopted for gray clustering to complex and scattered traffic safety grade evaluation indexes, and the gray fixed weight clustering method is adopted to weight each clustering index in advance; the clustering weight of each index is set by a fuzzy consistent matrix, on which the fixed weight coefficient of the index is calculated and the clustering vector is constructed; the cluster coefficients and cluster vectors are combined to obtain the clustering indexes of traffic safety evaluation; then a BP neural network dynamic traffic safety grade evaluation model for road sections is constructed according to the indexes, so as to accurately evaluate the dynamic traffic safety grade of road sections. The experiment results show that the designed model method can effectively evaluate the dynamic traffic safety grade of 31 road sections in areas with a high probability of traffic congestion with small evaluation error and high stability, so it meets the design requirements.", + "extra": "pusblisher:Aracne Editrice\nplace:Roma", + "journalAbbreviation": "ATS", + "language": "en", + "libraryCatalog": "ATS International Journal", + "pages": "15-24", + "publicationTitle": "Advances in Transportation Studies", + "url": "http://www.atsinternationaljournal.com/index.php/2018-issues/special-issue-2018-vol2/989-dynamic-traffic-safety-grade-evaluation-model-for-road-sections-based-on-gray-fixed-weight-clustering", + "volume": "Special Issue 2", + "attachments": [], + "tags": [ + { + "tag": "Models" + }, + { + "tag": "Road Safety" + }, + { + "tag": "Traffic" + } + ], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Access Engineering.js b/translators/Access Engineering.js new file mode 100644 index 0000000..3ea7296 --- /dev/null +++ b/translators/Access Engineering.js @@ -0,0 +1,384 @@ +{ + "translatorID": "d120a8a7-9d45-446e-8c18-ad9ef0a6bf47", + "label": "Access Engineering", + "creator": "Vinoth K - highwirepress.com", + "target": "^https?://www\\.accessengineeringlibrary\\.com/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-09-09 09:42:36" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + Copyright © 2020-2021 Vinoth K - highwirepress.com + + 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) { + let title = attr(doc, 'meta[name="citation_title"]', 'content'); + if (title) { + if (doc.querySelector('meta[name="citation_isbn"]')) { + let bookTitle = attr(doc, 'meta[name="citation_book_title"]', 'content'); + if (!bookTitle || title == bookTitle) { + return "book"; + } + else { + return "bookSection"; + } + } + else if (url.includes('content/video/')) { + return 'videoRecording'; + } + else { + return "journalArticle"; + } + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('.results-item a[href]'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + // Missing editions for books and books chapter page + // Removed html element in abstract for video and tutorial page + // Author not updating in metatag correctly from data and read + // client advised to split and handled through custom data attr/obj + // - so we'll fill those in manually. + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + translator.setHandler('itemDone', function (obj, item) { + // Edition + let edition = ZU.xpathText(doc, '//meta[@name="citation_edition"]/@content'); + if (edition) item.edition = edition; + + // Author + // Some of old pages not having firstname, lastname seperation in markup and ignore if not + let author = doc.querySelectorAll("ul.contributor-list > [data-firstnames]"); + item.creators = []; + for (let i = 0; i < author.length; i++) { + let creatorData = author[i].dataset; + item.creators.push({ + firstName: creatorData.firstnames, + lastName: creatorData.surname, + creatorType: creatorData.authortype + }); + } + + // Abstract + let abstractNote = ZU.xpathText(doc, '//meta[@name="citation_abstract"]/@content'); + if (abstractNote) item.abstractNote = ZU.cleanTags(abstractNote); + + item.complete(); + }); + + translator.getTranslatorObject(function (trans) { + // Detect web not get trigger for scape EM translator + // - so wll fill those in manually. + trans.itemType = detectWeb(doc, url); + trans.doWeb(doc, url); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.accessengineeringlibrary.com/content/book/9781259860225", + "items": [ + { + "itemType": "book", + "title": "Handbook of Environmental Engineering", + "creators": [ + { + "firstName": "Rao Y.", + "lastName": "Surampalli", + "creatorType": "editor" + }, + { + "firstName": "Tian C.", + "lastName": "Zhang", + "creatorType": "editor" + }, + { + "firstName": "Satinder Kaur", + "lastName": "Brar", + "creatorType": "editor" + }, + { + "firstName": "Krishnamoorthy", + "lastName": "Hegde", + "creatorType": "editor" + }, + { + "firstName": "Rama", + "lastName": "Pulicharla", + "creatorType": "editor" + }, + { + "firstName": "Mausam", + "lastName": "Verma", + "creatorType": "editor" + } + ], + "date": "2018", + "ISBN": "9781259860225", + "abstractNote": "A complete guide to environmental regulations and remediation.This practical resource offers thorough coverage of current environmental issues and policies along with step-by-step remediation procedures. With contributions from dozens of industry-recognized experts, Handbook of Environmental Engineering features information on all segments of the market—including water and air quality and hazardous waste—and enables you to ensure compliance with all applicable regulations. You will get details about sensors, monitoring, and toxicity treatment and controls as well as waste management and safe disposal. Real-world examples demonstrate how to apply techniques and achieve compliance, while environmental impact assessments and measurement data enhance the book9s utility.Coverage includes:• Environmental legislation• Environmental impact assessments• Air pollution control and management• Potable water treatment• Wastewater treatment and reuse• Solid waste management• Hazardous waste management• Emerging wastes in the environment• Environmental monitoring and measurements", + "edition": "1st Edition", + "language": "en", + "libraryCatalog": "www.accessengineeringlibrary.com", + "publisher": "McGraw-Hill Education", + "url": "https://www.accessengineeringlibrary.com/content/book/9781259860225", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessengineeringlibrary.com/content/book/9781259860225/toc-chapter/chapter3/section/section1", + "items": [ + { + "itemType": "bookSection", + "title": "CHAPTER PRELIMINARIES", + "creators": [ + { + "firstName": "Ashok", + "lastName": "Kumar", + "creatorType": "author" + }, + { + "firstName": "Hamid", + "lastName": "Omidvarborna", + "creatorType": "author" + }, + { + "firstName": "Rao Y.", + "lastName": "Surampalli", + "creatorType": "editor" + }, + { + "firstName": "Tian C.", + "lastName": "Zhang", + "creatorType": "editor" + }, + { + "firstName": "Satinder Kaur", + "lastName": "Brar", + "creatorType": "editor" + }, + { + "firstName": "Krishnamoorthy", + "lastName": "Hegde", + "creatorType": "editor" + }, + { + "firstName": "Rama", + "lastName": "Pulicharla", + "creatorType": "editor" + }, + { + "firstName": "Mausam", + "lastName": "Verma", + "creatorType": "editor" + } + ], + "date": "2018", + "ISBN": "9781259860225", + "abstractNote": "A complete guide to environmental regulations and remediation.This practical resource offers thorough coverage of current environmental issues and policies along with step-by-step remediation procedures. With contributions from dozens of industry-recognized experts, Handbook of Environmental Engineering features information on all segments of the market—including water and air quality and hazardous waste—and enables you to ensure compliance with all applicable regulations. You will get details about sensors, monitoring, and toxicity treatment and controls as well as waste management and safe disposal. Real-world examples demonstrate how to apply techniques and achieve compliance, while environmental impact assessments and measurement data enhance the book's utility.Coverage includes:• Environmental legislation• Environmental impact assessments• Air pollution control and management• Potable water treatment• Wastewater treatment and reuse• Solid waste management• Hazardous waste management• Emerging wastes in the environment• Environmental monitoring and measurements", + "bookTitle": "Handbook of Environmental Engineering", + "language": "en", + "libraryCatalog": "www.accessengineeringlibrary.com", + "publisher": "McGraw-Hill Education", + "url": "https://www.accessengineeringlibrary.com/content/book/9781259860225/toc-chapter/chapter3/section/section1", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessengineeringlibrary.com/content/video/V4005352521001", + "items": [ + { + "itemType": "videoRecording", + "title": "123D Design: Cut Text Through a Plane", + "creators": [], + "date": "2014", + "abstractNote": "This video shows how to cut text through a plane with Combine/Subtract.", + "language": "en", + "libraryCatalog": "www.accessengineeringlibrary.com", + "shortTitle": "123D Design", + "studio": "McGraw-Hill Education", + "url": "https://www.accessengineeringlibrary.com/content/video/V4005352521001", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessengineeringlibrary.com/content/calculator/S0071_Basic_Transformer_Calculations", + "items": [ + { + "itemType": "journalArticle", + "title": "Basic Transformer Calculations", + "creators": [ + { + "firstName": "Bhagyalakshmi", + "lastName": "Kerekare", + "creatorType": "author" + } + ], + "date": "2022/06/25/", + "abstractNote": "This Excel workbook contains four worksheets. The first worksheet covers the basic concepts of single phase transformer such as turns ratio, primary current, secondary current, primary voltage, secondary voltage, and transformer ratio calculations. The second worksheet covers the basic concepts of power, efficiency, primary/secondary EMF and transformer rating calculations. The third worksheet covers the basic concepts of three phase transformers, highlighting the star and delta connections. Calculations are done for phase voltage, phase current, line voltage, and line current for star and delta connections. The fourth worksheet covers the basic concepts kVA Ratings, 3-phase primary, and secondary full load current 3-phase voltage calculations.", + "language": "en", + "libraryCatalog": "www.accessengineeringlibrary.com", + "url": "https://www.accessengineeringlibrary.com/content/calculator/S0071_Basic_Transformer_Calculations", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessengineeringlibrary.com/content/case-study/CS0004_Atrial_Fibrillation", + "items": [ + { + "itemType": "journalArticle", + "title": "Atrial Fibrillation: Improving Therapy via Engineering Advancements", + "creators": [ + { + "firstName": "Michael J.", + "lastName": "Rust", + "creatorType": "author" + } + ], + "date": "2020-04-23", + "abstractNote": "This case will explore atrial fibrillation from several perspectives, including the underlying physiology, clinical relevance, and instrumentation used for diagnosis and therapy. Students will identify and investigate unmet clinical needs that led to recent developments in technologies to treat atrial fibrillation.", + "language": "en", + "libraryCatalog": "www.accessengineeringlibrary.com", + "shortTitle": "Atrial Fibrillation", + "url": "https://www.accessengineeringlibrary.com/content/case-study/CS0004_Atrial_Fibrillation", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessengineeringlibrary.com/content/tutorial/T0004_Partially_Full_Pipe_Flow_Calculations_Using_Excel_Spreadsheets", + "items": [ + { + "itemType": "journalArticle", + "title": "Partially Full Pipe Flow Calculations Using Excel Spreadsheets", + "creators": [ + { + "firstName": "Harlan H.", + "lastName": "Bengtson", + "creatorType": "author" + } + ], + "date": "2014/02/01/", + "abstractNote": "This tutorial provides discussion of, and illustration by, examples for use of an Excel spreadsheet for making a variety of calculations for the flow of water in a partially full circular pipe using the Manning Equation. Equations for calculating area, wetted perimeter, and hydraulic radius for partially full pipe flow are included in this tutorial along with a brief review of the Manning Equation and discussion of its use to calculate a) the flow rate in a given pipe (given diameter, slope, & Manning roughness) at a specified depth of flow, b) the required diameter for a specified flow rate at a target percent full in a given pipe, and c) the normal depth (depth of flow) for a specified flow rate in a given pipe. This includes presentation and discussion of the equations for the calculations, example calculations, and screenshots of spreadsheets to facilitate the calculations.", + "language": "en", + "libraryCatalog": "www.accessengineeringlibrary.com", + "url": "https://www.accessengineeringlibrary.com/content/tutorial/T0004_Partially_Full_Pipe_Flow_Calculations_Using_Excel_Spreadsheets", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessengineeringlibrary.com/search?query=&f%5B0%5D=content_type%3ABooks&f%5B1%5D=book_component%3ATitles", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/Access Medicine.js b/translators/Access Medicine.js new file mode 100644 index 0000000..29acba3 --- /dev/null +++ b/translators/Access Medicine.js @@ -0,0 +1,343 @@ +{ + "translatorID": "60e55b65-08cb-4a8f-8a61-c36338ec8754", + "label": "Access Medicine", + "creator": "Jaret M. Karnuta", + "target": "^https?://(0-)?(access(anesthesiology|cardiology|emergencymedicine|medicine|pediatrics|surgery)|neurology)\\.mhmedical\\.com", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2017-01-12 22:14:02" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2016 Jaret M. Karnuta + + 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){ + //check if search page + //case differs between browsers, force lower case + var pattern = /\/searchresults/i; + var search = url.search(pattern) != -1; + if (search){ + return "multiple"; + } + //check if book section + pattern = /\/content.*/i; + var section = url.search(pattern) != -1; + if (section){ + return "bookSection"; + } +} + +function doWeb(doc, url){ + var contentType = detectWeb(doc, url); + if (contentType == "multiple"){ + //for formatting citation, recall case differences in url (see detectWeb) + var pattern = /\/searchresults.*/i; + var baseUrl = url.replace(pattern,''); + var baseCitation = baseUrl + "/downloadCitation.aspx?format=ris§ionid="; + + //search page + //easier to use XPaths here + var sections = ZU.xpath(doc, '//div[@class="search-entries"]/div[@class="row-fluid bordered-bottom"]/div[@class="span10"]'); + var sectionDict = {}; + var selectedSections = []; + for (var i=0;i. + + ***** END LICENSE BLOCK ***** +*/ + +function detectWeb(doc, url) { + let title = attr(doc, 'meta[name="citation_title"]', 'content'); + if (title) { + if (doc.querySelector('meta[name="citation_isbn"]')) { + let bookTitle = attr(doc, 'meta[name="citation_book_title"]', 'content'); + if (!bookTitle || title == bookTitle) { + return "book"; + } + else { + return "bookSection"; + } + } + else if (url.includes('content/video/') || url.includes('content/video-biography')) { + return 'videoRecording'; + } + else if (url.includes('content/article/')) { + return "journalArticle"; + } + else if (url.includes('news') || url.includes('briefing')) { + return "magazineArticle"; + } + else { + return "webpage"; + } + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('.search-middle-right a[href]'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + translator.setHandler('itemDone', function (obj, item) { + // Author + // Some of video pages having old content which does not contain the + // firstname and lastname. which is binding in a single string in + // metadata tags, So those cases we were split and mapped accordingly + if (item.itemType == 'videoRecording') { + let authorName = attr(doc, 'meta[name="citation_author"]', 'content'); + if (authorName) { + item.creators = []; + if (authorName.includes(',') && authorName.split(',').length > 2) { + authorName = authorName.split(',')[0]; + item.creators.push(ZU.cleanAuthor(authorName, "author", false)); + } + } + } + + let abstractNote = attr(doc, 'meta[name="citation_abstract"]', 'content'); + item.abstractNote = abstractNote && ZU.cleanTags(abstractNote); + + item.complete(); + }); + + translator.getTranslatorObject(function (trans) { + trans.itemType = detectWeb(doc, url); + trans.doWeb(doc, url); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.accessscience.com/content/book/9781260452297", + "items": [ + { + "itemType": "book", + "title": "Casarett & Doull's Essentials of Toxicology", + "creators": [ + { + "firstName": "Curtis D.", + "lastName": "Klaassen", + "creatorType": "editor" + }, + { + "firstName": "John B. Watkins", + "lastName": "Iii", + "creatorType": "editor" + } + ], + "date": "2022", + "ISBN": "9781260452297", + "abstractNote": "Doody9s Core Titles for 2021!\n\nFor more than 25 years, Casarett & Doull9s Toxicology: The Basic Science of Poisons has set the standard for providing thorough, academic, and authoritative information in clear and engaging ways. Distilling the major principles and concepts from that renowned text, Casarett & Doull9s Essentials of Toxicology delivers an accessible and highly readable introduction to the science and clinical field of medical toxicology. The book reflects the expertise of more than 60 renowned contributors.\n\nPresented in full-color, this new edition builds on the wide success of previous editions, with extensive updates that make the book more clinically relevant to students and beginners in toxicology, pharmacology, pharmacy, and environmental sciences. Chapter-ending self-assessment Q&As and other features make the learning process more effective and efficient.\n\nCasarett and Doull9s Essentials of Toxicology is organized into seven units:\n\n• General Principles of Toxicology\n\n• Disposition of Toxicants\n\n• Nonorgan-directed Toxicity\n\n• Target Organ Toxicity\n\n• Toxic Agents\n\n• Environmental Toxicology\n\n• Applications of Toxicology\n\nSuccinct, yet comprehensive, the text covers essential principles, toxicokinetics, how toxic effects are passed on to succeeding generations, how each body system responds to poisons, and the specific effects of a wide range of toxic agents—from pesticides to radiation.", + "language": "en", + "libraryCatalog": "www.accessscience.com", + "publisher": "McGraw Hill", + "url": "https://www.accessscience.com/content/book/9781260452297", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessscience.com/content/book/9781260452297/chapter/chapter2", + "items": [ + { + "itemType": "bookSection", + "title": "Principles of Toxicology", + "creators": [ + { + "firstName": "Lauren M.", + "lastName": "Aleksunes", + "creatorType": "author" + }, + { + "firstName": "David L.", + "lastName": "Eaton", + "creatorType": "author" + }, + { + "firstName": "Curtis D.", + "lastName": "Klaassen", + "creatorType": "editor" + }, + { + "firstName": "John B. Watkins", + "lastName": "Iii", + "creatorType": "editor" + } + ], + "date": "2022", + "ISBN": "9781260452297", + "bookTitle": "Casarett & Doull's Essentials of Toxicology", + "language": "en", + "libraryCatalog": "www.accessscience.com", + "publisher": "McGraw Hill", + "url": "https://www.accessscience.com/content/book/9781260452297/chapter/chapter2", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessscience.com/content/video/V2537194263001", + "items": [ + { + "itemType": "videoRecording", + "title": "Supplementary Problem 10.12", + "creators": [ + { + "firstName": "Rebecca B.", + "lastName": "DeVasher", + "creatorType": "author" + } + ], + "date": "2013", + "abstractNote": "This video details a problem involving unit cells and the calculation of the mass of a cell, length of a cell and radius of an atom in the unit cell based on the density of a solid.", + "language": "en", + "libraryCatalog": "www.accessscience.com", + "studio": "McGraw Hill", + "url": "https://www.accessscience.com/content/video/V2537194263001", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessscience.com/content/video-biography/VB0014", + "items": [ + { + "itemType": "videoRecording", + "title": "Anderson, John R.", + "creators": [], + "date": "2011", + "language": "en", + "libraryCatalog": "www.accessscience.com", + "studio": "McGraw Hill", + "url": "https://www.accessscience.com/content/video-biography/VB0014", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessscience.com/content/article/a694300?implicit-login=true", + "items": [ + { + "itemType": "journalArticle", + "title": "3D printing", + "creators": [ + { + "firstName": "Wenchao", + "lastName": "Zhou", + "creatorType": "author" + } + ], + "date": "2023", + "DOI": "10.1036/1097-8542.694300", + "language": "en", + "libraryCatalog": "www.accessscience.com", + "url": "https://www.accessscience.com/content/article/a694300", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessscience.com/content/news/aSN2301171?implicit-login=true", + "items": [ + { + "itemType": "magazineArticle", + "title": "These chemists cracked the code to long-lasting Roman concrete", + "creators": [ + { + "firstName": "Carolyn", + "lastName": "Gramling", + "creatorType": "author" + } + ], + "date": "2023", + "extra": "DOI: 10.1036/1097-8542.SN0000000", + "language": "en", + "libraryCatalog": "www.accessscience.com", + "url": "https://www.accessscience.com/content/news/aSN2301171", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessscience.com/content/video/an600010", + "items": [ + { + "itemType": "videoRecording", + "title": "Henrietta Leavitt: The Woman Who Measured the Universe", + "creators": [], + "abstractNote": "Born in 1868, Henrietta Leavitt was an astronomer ahead of her time, whose work helped to revolutionize our understanding of the universe. While working at Harvard Observatory, Leavitt began to study stars of fluctuating brightness. This video describes her crucial observation about variable stars, which gave astronomers a new way to measure distances, ultimately leading to such impactful discoveries as the expansion of the universe.\n\nCredit: ESA Hubble Videos; Hubblecast 116: Henrietta Leavitt — ahead of her time; Directed by: Mathias Jäger; Visual design and editing: Martin Kornmesser; Written by: Sara Rigby; Narration: Sara Mendes da Costa; Images: ESA/Hubble and NASA, ESO, Hubble Heritage Team (STScI/AURA), Library of Congress Prints and Photographs Division Washington, Harvard College Observatory, Huntington Library, California Institute of Technology, Digitized Sky Survey 2, M. Kornmesser, R. Gendler, Arnold Reinhold, Davide De Martin; Videos: NASA, ESA, M. Kornmesser, Luis Calcada; Music: Johan B. Monell; Web and technical support: Mathias André and Raquel Yumi Shida; Executive producer: Lars Lindberg Christensen", + "language": "en", + "libraryCatalog": "www.accessscience.com", + "shortTitle": "Henrietta Leavitt", + "studio": "McGraw Hill", + "url": "https://www.accessscience.com/content/video/an600010", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessscience.com/content/biography/m0073908", + "items": [ + { + "itemType": "webpage", + "title": "Abbe, Cleveland (1838–1916)", + "creators": [], + "language": "en", + "url": "https://www.accessscience.com/content/biography/m0073908", + "websiteTitle": "McGraw Hill's AccessScience", + "websiteType": "text", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.accessscience.com/search?query=&items_per_page=10", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/Adam Matthew Digital.js b/translators/Adam Matthew Digital.js new file mode 100644 index 0000000..457450d --- /dev/null +++ b/translators/Adam Matthew Digital.js @@ -0,0 +1,405 @@ +{ + "translatorID": "0701696c-3523-47ba-9617-b04eee03b6ba", + "label": "Adam Matthew Digital", + "creator": "Abe Jellinek", + "target": "^https?://www\\.([^.]+)\\.amdigital\\.co\\.uk/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-10-21 05:00:48" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (url.includes('/DocumentDetails.aspx') // older collections + || url.includes('/DocumentDetailsSearch.aspx')) { + return 'manuscript'; + } + if (url.includes('/Documents/Details/') // newer collections + || url.includes('/Documents/SearchDetails')) { + return getTypeNew(doc); + } + if (getSearchResults(doc, true)) { + return "multiple"; + } + else if (doc.querySelector('.DocumentsList')) { + Z.monitorDOMChanges(doc.querySelector('.DocumentsList')); + } + return false; +} + +function getTypeNew(doc) { + let type = text(doc, 'tr[data-field-name="Document Type"] td[data-field-role="value"]'); + if (!type) { + if (doc.body.classList.contains('cinema')) { + return 'videoRecording'; + } + else { + return 'document'; + } + } + + type = ZU.trimInternal(type).toLowerCase(); + + if (type.includes('book')) { + return 'book'; + } + if (type.includes('manuscript')) { + return 'manuscript'; + } + if (type.includes('drawing') || type.includes('illustration') + || type.includes('photograph')) { + return 'artwork'; + } + if (type.includes('map')) { + return 'map'; + } + if (type.includes('correspondence')) { + return 'letter'; + } + return 'document'; +} + +function getSearchResults(doc, checkOnly) { + const items = {}; + let found = false; + const rows = doc.querySelectorAll( + '.contentsList .tableRow .descriptionCell a, .SearchList tbody .title a, .DocumentsList tbody .title a'); + for (const row of rows) { + const href = row.href; + const title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + if (url.includes('/Documents/')) { + // newer collections (served with HTTPS, no .aspx pages) have a + // completely different, and much easier to parse, structure + scrapeNew(doc, url); + } + else { + scrapeOld(doc, url); + } +} + +function scrapeNew(doc, url) { + function fromTable(fieldName) { + return text(doc, `tr[data-field-name="${fieldName}"] td[data-field-role="value"]`); + } + + let item = new Zotero.Item(getTypeNew(doc)); + + item.title = fromTable('Title'); + item.abstractNote = fromTable('Abstract') || fromTable('Additional Information'); + item.date = ZU.strToISO(fromTable('Date')); + item.place = fromTable('Places'); + item.rights = fromTable('Copyright'); + item.publisher = fromTable('Publisher'); + item.language = fromTable('Language'); + + item.creators = fromTable('Names') + .split('; ') + .map(name => ZU.cleanAuthor(name, 'author', true)); + + let director = fromTable('Director'); + if (director) { + item.creators.push(ZU.cleanAuthor(director, 'director', true)); + } + + let pageSelect = doc.querySelector('#DownloadPageFrom'); + if (pageSelect) { + item.numPages = pageSelect.childElementCount; + } + item.archive = fromTable('Library/Archive') || fromTable('Collection'); + item.archiveLocation = fromTable('Reference'); + item.libraryCatalog = extractCatalogName(doc.title); + item.url = url.replace('/SearchDetails/', '/Details/') + .replace('?SessionExpired=True', ''); + + if (item.itemType != 'videoRecording') { + item.attachments.push({ + title: "Full Text PDF", + mimeType: 'application/pdf', + url: attr(doc, 'a[href*="/FullDownload"]', 'href') + }); + } + + item.tags = [...doc.querySelectorAll('tr[data-field-name="Subjects"] td[data-field-role="value"] a')] + .map(el => ({ tag: el.textContent })); + + item.complete(); +} + +function scrapeOld(doc, url) { + function fromTable(selector) { + return text(doc, selector + ' > .detCol2') || text(doc, selector); + } + + let item = new Zotero.Item('manuscript'); + + item.title = fromTable('#Body_DocumentDetailsMeta_descSpan') + || fromTable('#Body_descriptionElement'); + let abstract = doc.querySelector('#Body_DocumentDetailsMeta_notesElement>.detCol2, #Body_notesElement>.detCol2'); + item.abstractNote = abstract ? abstract.innerText : ""; + item.date = ZU.strToISO(fromTable('#Body_DocumentDetailsMeta_dateElement')); + + let pageSelect = doc.querySelector('.pageRangeSelect'); // either will do + if (pageSelect) { + item.numPages = pageSelect.childElementCount; + } + item.archive = fromTable('#Body_DocumentDetailsMeta_sourceElement'); + + let box = fromTable('#Body_DocumentDetailsMeta_boxElement') + || fromTable('#Body_boxElement'); + let folder = fromTable('#Body_DocumentDetailsMeta_folderElement') + || fromTable('#Body_folderElement'); + item.archiveLocation = `Box ${box}, folder ${folder}`; + item.libraryCatalog = extractCatalogName(doc.title); + item.attachments.push({ + title: "Full Text PDF", + mimeType: 'application/pdf', + url: attr(doc, '.downloadPDFLink > a', 'href') + }); + // we want a URL without any search strings, navigation data, etc + item.url = url.replace(/\?.*(documentid=[^&]+).*/, '?$1'); + + item.complete(); +} + +/** + * get the site's name by taking everything after the first segment of the title: + * "Search Results - Jewish Life in America - Adam Matthew Digital" + * becomes "Jewish Life in America - Adam Matthew Digital" + */ +function extractCatalogName(title) { + return title.substring(title.indexOf('-') + 2); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://www.jewishlife.amdigital.co.uk/Contents/DocumentDetailsSearch.aspx?documentid=289906&prevPos=289906&vpath=SearchResults&searchmode=true&pi=1", + "items": [ + { + "itemType": "manuscript", + "title": "Manuscript notebook of poems", + "creators": [], + "abstractNote": "Page\n\n1 'The New Colossus'\n\n2 'Progress and Poverty'\n\n3 'Venus of the Louvre'\n\n4 'Destiny I'\n\n5 'Destiny II'\n\n6 'Influence'\n\n7 'Success'\n\n8-11 'Chopin I, II, III, IV'\n\n12 'With a Copy of Don Quixote'\n\n13 'To F.P.'\n\n14 'One Augur to Another'\n\n15 'Cranes of Ibicus'\n\n16 'Reconciliation'\n\n17 'Incident at Sea' 18 'Will O' the Wisp'\n\n19 'Assurance'\n\n20 'Echoes'\n\n21 'St. Michael's Chapel'\n\n22-23 'Under the Sea. I, II'\n\n24 'Taming of the Falcon'\n\n25 'Supreme Sacrifice'\n\n26 'Life and Art'\n\n27 'Sympathy'\n\n28 'Dreaming Castle'\n\n29 'To R.W.E.'\n\n30-37 'Symphonic Studies (after Robert Schumann). Prelude, I, II, III, IV, V, VI Epilogue'\n\n38 'City Visions'\n\n40 'Long Island Sound'\n\n41-49 Translated Sonnets:\n\nPage 41 'Art the Redeemer'\n\nPage 42 'From the French of Fran�ois Copp�'\n\nPages 44-49 'Six Sonnets from the Studies of Petrarch, a. 'In Vita LXVII', b. 'In Vita LXXVI', c. 'In Morte XLIII', d. 'In Morte II. On the Death of Cardinal Colonna and Laura', e. 'In Vita CIX', f. 'In Vita, CV'\n\n50 '1492'\n\n51 'Restlessness'\n\n52 'Child at the Bath. R. de K. G.'\n\n54 'Autumn Sadness'\n\n56 'Song. Venus'\n\n57 'From the Arabian Nights'\n\n58 'Reed Song'\n\n59 'Moonlight, from German of Eichendorff'\n\n60 'Songs from Eichendroff'\n\n61 'Lida and the Swan. Faust. Part II. Act II. Scene 2'\n\n62-72 'Phaon'\n\n73 'To the Moon after Sunrise'\n\n75-79 'Fragments from Petrarch'\n\nPage 75 'Canzone XII. 5'\n\nPage 76 'Trionfo Della Morte'\n\nPage 77 'Trionfo D'Amore'\n\nPage 78 'Triumph of Death'\n\n80 'Sunrise'\n\n85 'To Nelly [?] Sleeping'\n\n89-97 'The Creation of Man. Miwk [Mohawk] Fable'\n\n98-105 'The New Cupid. From the German of Goethe'\n\n106-111 'August Moon'\n\n112-115 'My Goddess. From the German of Goethe'\n\n116-119 'The Old Year-1883. Affectionately dedicated to W.S.P. & W.A.P.'\n\n120 'Ariel and Euphorion' [clippings pasted into notebook, unknown journal]\n\n122 'Don Rafael' [clippings pasted into notebook, unknown journal]\n\n122 'Two Sonnets' [clippings pasted into notebook, unknown journal]: 'Sonnet I. Petrarch: To a Friend', 'Sonnet II. Art, the Redeemer'\n\n123 'The New Ezekiel' [clippings pasted into notebook, unknown journal]\n\n123 'The Choice' [clippings pasted into notebook, for The American Hebrew]\n\n123 'The Supreme Sacrifice' [clippings pasted into notebook, for The American Hebrew]\n\n123 'Zulieka. Translated from Goethe's 'West Gestliche Divan' [clippings pasted into notebook, unknown journal, most possibly in Jewish Messenger]\n\n124 'The World's Justice' [clippings pasted into notebook, unknown journal]\n\n124 'The Feast of Lights' [clippings pasted into notebook, for The American Hebrew]\n\n126-130 'Grotesque'\n\n131-136 'Translations from Copp�'\n\n137-149 ['By the Waters of Babylon'] 'Little Poems in Prose:\n\nPage 137 'I. The Exodus'\n\nPage 140 'II. Treasures'\n\nPage 141 'III. The Sower'\n\nPage 143 'IV. The Test'\n\nPage 144 'V. The Prophet'\n\nPage 146-147 Pages are blank in the original\n\nPage 148 'VI. Currents'\n\nPage 149 'VII. Chrysalis'\n\n150 'Gifts'\n\n152 'A Masque of Venice'\n\n156 'To Carmen Sylva'\n\n[Page 156 is followed by 159, with no gaps in poetry]\n\n161-163 'In a Gothic Church' (never completed).", + "archive": "American Jewish Historical Society", + "archiveLocation": "Box 1, folder 2", + "libraryCatalog": "Jewish Life in America - Adam Matthew Digital", + "numPages": 165, + "url": "http://www.jewishlife.amdigital.co.uk/Contents/DocumentDetailsSearch.aspx?documentid=289906", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.jewishlife.amdigital.co.uk/Contents/DocumentDetails.aspx?documentid=288444&prevPos=288444&filter=0%7c1%7c2&vpath=contents&pi=1", + "items": [ + { + "itemType": "manuscript", + "title": "Baron de Hirsch Fund colonies and schools", + "creators": [], + "abstractNote": "See also P19/OS1/2", + "archiveLocation": "Box 3, folder 2", + "libraryCatalog": "Jewish Life in America - Adam Matthew Digital", + "numPages": 38, + "url": "http://www.jewishlife.amdigital.co.uk/Contents/DocumentDetails.aspx?documentid=288444", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.jewishlife.amdigital.co.uk/Contents/Default.aspx?filter=1%7c0", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.gender.amdigital.co.uk/Documents/Details/Etiquette%20for%20Ladies%20and%20Gentlemen%20London%201876?SessionExpired=True", + "items": [ + { + "itemType": "book", + "title": "Etiquette for Ladies and Gentlemen", + "creators": [], + "date": "1876", + "archive": "Bodleian Library, University of Oxford", + "archiveLocation": "268 c.457", + "libraryCatalog": "Defining Gender - Adam Matthew Digital", + "numPages": 65, + "publisher": "Frederick Warne and Co.", + "url": "https://www.gender.amdigital.co.uk/Documents/Details/Etiquette%20for%20Ladies%20and%20Gentlemen%20London%201876", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.americanwest.amdigital.co.uk/Documents/Details/Graff_2445", + "items": [ + { + "itemType": "document", + "title": "$150 reward. Whereas a robbery was committed in the vicinity of the town of Fort Madison, on the 22d Inst….", + "creators": [ + { + "firstName": "Jacob", + "lastName": "Guy", + "creatorType": "author" + }, + { + "firstName": "Jacob", + "lastName": "Bowers", + "creatorType": "author" + }, + { + "firstName": "W. Braxton", + "lastName": "Gillock", + "creatorType": "author" + } + ], + "date": "1840", + "archive": "Everett D. Graff Collection of Western Americana", + "archiveLocation": "Graff 2445", + "libraryCatalog": "American West - Adam Matthew Digital", + "url": "https://www.americanwest.amdigital.co.uk/Documents/Details/Graff_2445", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.socialismonfilm.amdigital.co.uk/Documents/Details/BFI_ETV_Advance_Democracy_25SD_Prores-4?SessionExpired=True#MediaSummary", + "items": [ + { + "itemType": "videoRecording", + "title": "Advance Democracy", + "creators": [ + { + "firstName": "Ralph", + "lastName": "Bond", + "creatorType": "director" + } + ], + "abstractNote": "Starts with a discussion of inequality in London contrasting the rich with the lives of the poor. Features the hard lives of dock workers and a semi-dramatization of them complaining about taxes and their uses to fight wars. A wife talks to her husband about the merits of the Co-operative, and the husband later listens to a speech about democracy and the co-operative movement which mentions the sacrifices of the Tolpuddle Martyrs, the Chartists and the Rochdale Equitable Pioneers. Warns of the dangers of Nazis (with archive footage of Hitler and war). The protagonist of the film is won over and mobilises his colleagues to march on May Day. Features a medley of labour movement songs.", + "language": "English (Dialogue)", + "libraryCatalog": "Socialism on Film: The Cold War and International Propaganda - Adam Matthew Digital", + "place": "United Kingdom  London", + "rights": "The British Film Institute", + "url": "https://www.socialismonfilm.amdigital.co.uk/Documents/Details/BFI_ETV_Advance_Democracy_25SD_Prores-4#MediaSummary", + "attachments": [], + "tags": [ + { + "tag": "Co-operatives" + }, + { + "tag": "Family" + }, + { + "tag": "Industry" + }, + { + "tag": "Music" + }, + { + "tag": "Politics" + }, + { + "tag": "Ships and shipping" + }, + { + "tag": "Shopping" + }, + { + "tag": "Social class" + }, + { + "tag": "Trade unions" + }, + { + "tag": "Women" + } + ], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Agencia del ISBN.js b/translators/Agencia del ISBN.js new file mode 100644 index 0000000..d9d0bdd --- /dev/null +++ b/translators/Agencia del ISBN.js @@ -0,0 +1,77 @@ +{ + "translatorID": "b8a86e36-c270-48c9-bdd1-22aaa167ef46", + "label": "Agencia del ISBN", + "creator": "Michael Berkowitz", + "target": "^https?://www\\.mcu\\.es/webISBN", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcs", + "lastUpdated": "2015-06-10 11:33:38" +} + +function detectWeb(doc, url) { + if (doc.evaluate('//div[@class="isbnResultado"]/div[@class="isbnResDescripcion"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { + return "multiple"; + } else if (doc.evaluate('//div[@class="fichaISBN"]/div[@class="cabecera"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { + return "book"; + } +} + +function doWeb(doc, url) { + var books = new Array(); + if (detectWeb(doc, url) == "multiple") { + var items = new Object(); + var boxes = doc.evaluate('//div[@class="isbnResultado"]/div[@class="isbnResDescripcion"]', doc, null, XPathResult.ANY_TYPE, null); + var box; + while (box = boxes.iterateNext()) { + var book = doc.evaluate('./p/span/strong/a', box, null, XPathResult.ANY_TYPE, null).iterateNext(); + items[book.href] = book.textContent; + } + Zotero.selectItems(items, function (items) { + if (!items) { + return true; + } + for (var i in items) { + books.push(i); + } + Zotero.Utilities.processDocuments(books, scrape); + }); + + } else { + scrape(doc, url); + } +} + + + function scrape (doc, url){ + var data = new Object(); + var rows = doc.evaluate('//div[@class="fichaISBN"]/table/tbody/tr', doc, null, XPathResult.ANY_TYPE, null); + var next_row; + while (next_row = rows.iterateNext()) { + var heading = doc.evaluate('./th', next_row, null, XPathResult.ANY_TYPE, null).iterateNext().textContent; + var value = doc.evaluate('./td', next_row, null, XPathResult.ANY_TYPE, null).iterateNext().textContent; + data[heading.replace(/\W/g, "")] = value; + } + var isbn = Zotero.Utilities.trimInternal(doc.evaluate('//span[@class="cabTitulo"]/strong', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); + var item = new Zotero.Item("book"); + item.ISBN = isbn; + item.title = Zotero.Utilities.trimInternal(data['Ttulo']); + item.title= item.title.replace(/\s+:/, ":"); + author = data['Autores']; + if (author) { + var authors = author.match(/\b.*,\s+\w+[^([]/g); + for (var i=0; i. + + ***** END LICENSE BLOCK ***** +*/ + + +function detectWeb(doc, _url) { + if (getJSONLD(doc)) { + return "newspaperArticle"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('h2.field-title > a'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, _url) { + let item = new Zotero.Item('newspaperArticle'); + let json = getJSONLD(doc); + + item.title = json.headline; + item.abstractNote = json.description; + item.publicationTitle = 'Ahval'; + item.date = ZU.strToISO(json.dateModified || json.datePublished); + item.section = json.articleSection; + item.language = doc.documentElement.lang; + item.url = json.url; + + if (json.author && json.author.name != 'Ahval') { + // usually no authors, sometimes one + item.creators.push(ZU.cleanAuthor(json.author.name, 'author')); + } + + item.attachments.push({ + title: 'Snapshot', + document: doc + }); + + item.complete(); +} + +function getJSONLD(doc) { + let jsonLDText = text(doc, 'script[type="application/ld+json"]'); + if (!jsonLDText.trim()) { + return null; + } + + let json = JSON.parse(jsonLDText); + if (!json['@graph']) { + return null; + } + + for (let graphObj of json['@graph']) { + if (graphObj['@type'] == 'NewsArticle') { + return graphObj; + } + } + + return null; +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://ahvalnews.com/turkish-lira/turkey-signs-2-billion-currency-swap-deal-south-korea", + "items": [ + { + "itemType": "newspaperArticle", + "title": "Turkey signs $2 billion currency swap deal with South Korea", + "creators": [], + "date": "2021-08-12", + "abstractNote": "Turkey’s central bank and the Bank of Korea signed a currency swap agreement in lira and won worth as much as $2 billion.\r\n\r\nThe deal, effective for three years from Thursday, is designed to promote bilateral trade and financial cooperation for the economic development of both countries, the Bank of Korea said in a statement on its website.\r\n\r\nTurkey has sought to obtain currency swaps with central banks around the world to help bolster its foreign exchange reserves, which have fallen into negative territory when accounting for liabilities. The agreements, which have included arrangements worth about $10 billion with Turkey’s regional ally Qatar, have failed to halt a slide in the lira’s value to successive record lows since a 2018 currency crisis.\r\n\r\nIt is interesting that “another G20 central bank seems willing to support and prolong the continuation of really questionable monetary policy settings in Turkey”, said Tim Ash, a senior emerging markets strategist at BlueBay Asset Management in London. The deal \"does not really touch the sides\" in terms of defending the lira, he said.\r\n\r\nTurkey’s central bank kept interest rates at below inflation for much of last year to help the government engineer a borrowing boom. That led to an exodus of capital from the lira as deposit holders saw returns from their investments, net of inflation, disappear.\r\n\r\nThe lira rose 0.3 percent to 8.6 per dollar after the swap deal was announced after trading up 0.1 percent earlier in the day.\r\n\r\nThe agreement with the Bank of Korea was announced hours before the Turkish central bank was due to publish a monthly decision on interest rates. The benchmark rate in Turkey stands at 19 percent, marginally above annual consumer price inflation of 18.95 percent.\r\n\r\nPresident Recep Tayyip Erdoğan is calling for rate cuts and has sacked three central bank governors in just over two years due to disagreements over monetary policy. Erdoğan holds the unorthodox view that higher interest rates are inflationary. The latest governor, appointed in March, has kept rates unchanged even as inflation accelerated from 15.6 percent in February.\r\n\r\nSouth Korean companies make substantial investments in Turkey’s economy, particularly in the construction, energy and technology industries. The investments have included a 2017 contract for the building of the world’s longest suspension bridge over the Dardanelles straits worth around $2.7 billion.", + "language": "en", + "libraryCatalog": "Ahval News", + "publicationTitle": "Ahval", + "section": "News", + "url": "https://ahvalnews.com/turkish-lira/turkey-signs-2-billion-currency-swap-deal-south-korea", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://ahvalnews.com/northern-cyprus-turkey/former-turkish-cypriot-leader-akincis-adviser-banned-entering-turkey", + "items": [ + { + "itemType": "newspaperArticle", + "title": "Former Turkish Cypriot leader Akıncı’s adviser banned from entering Turkey", + "creators": [ + { + "firstName": "Tümay", + "lastName": "Tuğyan", + "creatorType": "author" + } + ], + "date": "2021-07-13", + "abstractNote": "Ali Bizden, the press and communications coordinator of former Turkish Cypriot leader Mustafa Akıncı, was banned from entering Turkey for five years on charges of acting against the country’s national security.\r\n\r\nBizden was informed of the ban by immigration police in Turkey on Tuesday night after he sought to pass through passport control at Istanbul’s Sabiha Gökçen Airport. The ban had been ordered back in September last year, he said via social media on Wednesday.", + "language": "en", + "libraryCatalog": "Ahval News", + "publicationTitle": "Ahval", + "section": "News", + "url": "https://ahvalnews.com/northern-cyprus-turkey/former-turkish-cypriot-leader-akincis-adviser-banned-entering-turkey", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://ahvalnews.com/turkish-lira/turkey-signs-2-billion-currency-swap-deal-south-korea", + "items": [ + { + "itemType": "newspaperArticle", + "title": "Turkey signs $2 billion currency swap deal with South Korea", + "creators": [], + "date": "2021-08-12", + "abstractNote": "Turkey’s central bank and the Bank of Korea signed a currency swap agreement in lira and won worth as much as $2 billion.\r\n\r\nThe deal, effective for three years from Thursday, is designed to promote bilateral trade and financial cooperation for the economic development of both countries, the Bank of Korea said in a statement on its website.\r\n\r\nTurkey has sought to obtain currency swaps with central banks around the world to help bolster its foreign exchange reserves, which have fallen into negative territory when accounting for liabilities. The agreements, which have included arrangements worth about $10 billion with Turkey’s regional ally Qatar, have failed to halt a slide in the lira’s value to successive record lows since a 2018 currency crisis.\r\n\r\nIt is interesting that “another G20 central bank seems willing to support and prolong the continuation of really questionable monetary policy settings in Turkey”, said Tim Ash, a senior emerging markets strategist at BlueBay Asset Management in London. The deal \"does not really touch the sides\" in terms of defending the lira, he said.\r\n\r\nTurkey’s central bank kept interest rates at below inflation for much of last year to help the government engineer a borrowing boom. That led to an exodus of capital from the lira as deposit holders saw returns from their investments, net of inflation, disappear.\r\n\r\nThe lira rose 0.3 percent to 8.6 per dollar after the swap deal was announced after trading up 0.1 percent earlier in the day.\r\n\r\nThe agreement with the Bank of Korea was announced hours before the Turkish central bank was due to publish a monthly decision on interest rates. The benchmark rate in Turkey stands at 19 percent, marginally above annual consumer price inflation of 18.95 percent.\r\n\r\nPresident Recep Tayyip Erdoğan is calling for rate cuts and has sacked three central bank governors in just over two years due to disagreements over monetary policy. Erdoğan holds the unorthodox view that higher interest rates are inflationary. The latest governor, appointed in March, has kept rates unchanged even as inflation accelerated from 15.6 percent in February.\r\n\r\nSouth Korean companies make substantial investments in Turkey’s economy, particularly in the construction, energy and technology industries. The investments have included a 2017 contract for the building of the world’s longest suspension bridge over the Dardanelles straits worth around $2.7 billion.", + "language": "en", + "libraryCatalog": "Ahval News", + "publicationTitle": "Ahval", + "section": "News", + "url": "https://ahvalnews.com/turkish-lira/turkey-signs-2-billion-currency-swap-deal-south-korea", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://ahvalnews.com/tr/din/secme-sacmalar-hukuk-islam-allah-kelami-vs", + "items": [ + { + "itemType": "newspaperArticle", + "title": "Seçme saçmalar: Hukuk, İslam, Allah kelamı vs.", + "creators": [ + { + "firstName": "Sevan", + "lastName": "Nişanyan", + "creatorType": "author" + } + ], + "date": "2021-08-11", + "abstractNote": "“Laik toplumlarda kanunlar kutsal değildir. Zaman içinde insanların gelişen ihtiyaçlarına göre hukukta iyileştirme yapılabilir. Laik toplumlarda insanlar kendi yasalarını yapar, tanrı onların dünyada yaptıklarına karışmaz.”\r\n\r\nKanunları alelumum ‘insanlar’ yapmaz. ‘Birileri’ yapar. \r\n\r\n“Kanunlar zaman ve zemine göre değiştirilebilir” dediğiniz zaman kimin ne zaman ve hangi koşullarda değiştirebileceğini de belirtmeniz gerekir. \r\n\r\nYoksa birileri çıkar “arkadaşlar yarın beni padişah ilan edeceğiz” der, yahut gece yarısı torba yasa çıkarır, gık diyemezsin.\r\n\r\nKarşı taraf haklı mıdır, haksız mıdır ayrı mevzu. Ama laiklik hayranlarının yüz senedir halâ karşı tarafın gerekçesini fark etmemiş görünmeleri hayreti muciptir. \r\n\r\nKarşı taraf diyor ki, kanunlar kutsaldır. Yani kafana esti diye zırt pırt değiştiremezsin. O yetkiyi sana verirsek sonucu kaçınılmaz bir kesinlikle zorbalıktır, hukukun paçavra edilmesidir. Hukuku zamana uydurmak gerekiyor ise nasıl uydurulacağına devlet sopasını elinde tutanlar değil, ak sakallı alimler karar versin.\r\n\r\nAyrıca, müsterih olun, tanrı bir şeye karışmaz. \r\n\r\nÇünkü tanrı hayaldir. \r\n\r\nSadece yasa yapmanın farklı yöntemleri vardır.\r\n\r\n“Roma imparatorluğunda kanunlarla toplumda kutsal olan ve olmayan net bir şekilde ayrılmıştır. Laiklik esas alınmıştır.”\r\n\r\nBiraz Roma tarihi bilen bilir ki Roma hukuku ve siyasi kurumları iliğine kadar dini inanç ve törelerle yoğrulmuştur; dinsizliğin, dine zarar vermenin cezası ölümdür.  \r\n\r\nMerak ediyorsanız Mommsen yahut Fustel de Coulanges okuyun. \r\n\r\nEski Roma dini geniş meşrepli olduğundan insanları çok üzmemiştir. \r\n\r\nHıristiyanlık resmi din olduğunda ise muhtemelen insanlık tarihinin en feci yobazlık sahneleri yaşandı. Yanlış inanç sahipleri acımasızca kovuşturuldu, tapınakları yakıldı, dini zulümden kaçanlar yüzünden koca vilayetler ıssız kaldı.\r\n\r\nKutsal olanla dünyevinin ayrışması Batı Avrupa Ortaçağının eseridir. Roma devleti Batıda yıkılınca kilise uzun süre tek medeni otorite mercii olarak kaldı. Sonra devletler yeniden güçlenince gücünü onlarla paylaşmamak için çatır çatır direndi. \r\n\r\nSonunda otoriteyi paylaşmaktan ve birbirinin alanına fazla bulaşmamayı kabul etmekten başka çare bulamadılar.\r\n\r\nDoğu Roma’da devlet çökmediği için böyle bir şey olmadı. Ne Bizans’ta, ne Rusya’da, ne Osmanlı’da o yüzden din ve devletin ayrılması diye bir şey duyulmamıştır.\r\n\r\n“Kuranın tanrıdan geldiğine inanıldığından değiştirilemez özelliği vardır. Bu durumda Kurandaki toplum yönetim yasalarını, hukuku değiştirebilir misiniz? Değiştiremezsiniz.”\r\n\r\nKuran’da birtakım şiirsel imgeler, muğlak deklarasyonlar, ne manaya geldiği belirsiz meseller ve bolca öfke krizi vardır. Hemen her ayetin zıddını söyleyen bir ayet illa ki bulunur. \r\n\r\nBu tuhaf metinden (ve onu tamamlamak için uydurulan on binlerce hadisten) bir hukuk sistemi kendiliğinden üremedi. Üretmek için çağın en parlak alimleri canhıraş bir gayretle 200 sene uğraştılar. Ürettikleri sistemi yorumlamak için, eskisi kadar parlak olmayan varisleri bin küsur senedir hala uğraşıyor. Siz orada değiştirilmez bir tanrı yasası bulduğunuzu iddia ediyorsanız yolunuz açık olsun.\r\n\r\nİslam hukukunun iki ana yolu ve dört tali mezhebi (ve tabii bugün terk edilmiş olan onlarca alternatifi) Abbasi devletinin ilk yüzyıllarında oluşturuldu. \r\n\r\nYani Kuran’ın telifinden kaba hesap 100 ila 200  yıl sonra. \r\n\r\nAllah’ı referans göstermeleri politik bir tercihti. Aşırı güçlenen ve meşruiyet zemini sarsak olan halife devletine karşı hukuk mesleği sırtını “Allah kelamına” dayama ihtiyacını hissetti. Buyur askeriye senin, vergi senin, ama hukuk senin tasarrufunda değil, ilmiye sınıfının tekelidir, dediler. \r\n\r\nSenin kılıcın varsa bizim de Allahımız ve kitabımız var diye kendi kendilerini teselli ettiler.\r\n\r\nSon derece akıllıca bir hamleydi. Sonuçta ilim mesleğinin yüzyıllar içinde aşırı derecede muhafazakarlaşmasına, kılıç sahibinin tasallutuna karşı istiridye gibi içine kapanmasına yol açtı, o ayrı mevzu.\r\n\r\nBugün “İslam değişir mi? Değişmez!” diyerek kendi sorup kendi cevaplayanların bu hakikatleri aklında tutmasında yarar vardır. \r\n\r\nİslam hukuku konusunda ahkam kesmeyi toplumun en cahil ve ezik sınıflarına terk edip sonra onların kalın kafalılığından şikayet etmek pek de rasyonel bir tavır olmasa gerek.\r\n\r\n\r\n* Bu yazı, Sevan Nişanyan’ın blogundan alınmıştır.", + "language": "tr", + "libraryCatalog": "Ahval News", + "publicationTitle": "Ahval", + "section": "Yazarlar", + "shortTitle": "Seçme saçmalar", + "url": "https://ahvalnews.com/tr/din/secme-sacmalar-hukuk-islam-allah-kelami-vs", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://ahvalnews.com/ar/70-mn-alatrak-ydwn-laghlaq-alhdwd-fy-wjh-allajyyn/alnsryt-altrkyt", + "items": [ + { + "itemType": "newspaperArticle", + "title": "70% من الأتراك يدعون لإغلاق الحدود في وجه اللاجئين", + "creators": [], + "date": "2021-08-12", + "abstractNote": "اعتقلت السلطات التركية الخميس نحو ثمانين شخصا يشتبه بأنهم شجعوا أو شاركوا في الهجوم على محلات تجارية لسوريين في أنقرة على أثر مشاجرة سقط فيها قتيل في أجواء تصاعد خطاب كراهية الأجانب في تركيا.", + "language": "ar", + "libraryCatalog": "Ahval News", + "publicationTitle": "Ahval", + "section": "أخبار", + "url": "https://ahvalnews.com/ar/70-mn-alatrak-ydwn-laghlaq-alhdwd-fy-wjh-allajyyn/alnsryt-altrkyt", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://ahvalnews.com/ar/hl-ymkn-ltrkya-walhnd-ttqabla-wjhaan-lwjh-fy-afghanstan/alhnd", + "items": [ + { + "itemType": "newspaperArticle", + "title": "هل يمكن لتركيا والهند أن تتقابلا وجهاً لوجه في أفغانستان؟", + "creators": [ + { + "firstName": "نيكولاس", + "lastName": "مورغان", + "creatorType": "author" + } + ], + "date": "2021-08-10", + "abstractNote": "لماذا ترحب #الهند بدور #تركيا في #أفغانستان بعد خروج الولايات المتحدة رغم خلافات البلدين العميقة؟", + "language": "ar", + "libraryCatalog": "Ahval News", + "publicationTitle": "Ahval", + "section": "رأي", + "url": "https://ahvalnews.com/ar/hl-ymkn-ltrkya-walhnd-ttqabla-wjhaan-lwjh-fy-afghanstan/alhnd", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://ahvalnews.com/special-feature", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/Air University Journals.js b/translators/Air University Journals.js new file mode 100644 index 0000000..052f6c7 --- /dev/null +++ b/translators/Air University Journals.js @@ -0,0 +1,236 @@ +{ + "translatorID": "e317b4d4-03cf-4356-aa3c-defadc6fd10e", + "label": "Air University Journals", + "creator": "Sebastian Karcher", + "target": "https?://www\\.airuniversity\\.af\\.edu/(ASPJ|SSQ)", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-10-14 19:04:37" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2017 Sebastian Karcher + + 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 ***** +*/ + +// eslint-disable-next-line no-unused-vars +function detectWeb(doc, url) { + if (text(doc, 'a[title="View Article"], h2>a[href*="documents"]', 1)) { + return "multiple"; + } + return false; +} + + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + var rows = ZU.xpath(doc, '//div[@class="da_black"]/table[tbody//a[@title="View Article"]]'); + if (rows.length < 3) { + rows = ZU.xpath(doc, '//div[@class="da_black"]//p[span//a[@title="View Article"]]'); + } + if (!rows.length) { + // New layout, e.g. https://www.airuniversity.af.edu/SSQ/Display/Article/2748342/volume-15-issue-3-fall-2021/ + rows = ZU.xpath(doc, '//div[@class="da_black"]//li//div[h2/a or h2/em/a]'); + } + + var items = {}; + var journal, abbr, ISSN; + if (url.includes("/ASPJ/")) { + journal = "Air & Space Power Journal"; + abbr = "ASPJ"; + ISSN = "1554-2505"; + } + else if (url.includes("/SSQ/")) { + journal = "Strategic Studies Quarterly"; + abbr = "SSQ"; + ISSN = "1936-1815"; + } + var voliss = text(doc, 'h1.title'); + var date = text(doc, 'p.da_story_info'); + for (let i = 0; i < rows.length; i++) { + var title = text(rows[i], 'span > a[title="View Article"]'); + var id = attr(rows[i], 'span > a[title="View Article"]', "href"); + if (!title) { + title = text(rows[i], 'strong > a[title="View Article"]'); + id = attr(rows[i], 'strong > a[title="View Article"]', "href"); + } + + if (!title) { + title = text(rows[i], 'h2 > a, h2>em>a'); + id = attr(rows[i], 'h2 > a, h2>em>a', "href"); + } + if (title !== null) { + items[id] = title; + } + } + + Zotero.selectItems(items, function (items) { + // Z.debug(items); + if (!items) { + return; + } + for (let id in items) { + scrapeMultiples(doc, id, date, voliss, journal, abbr, ISSN); + } + }); + } +} + + +function scrapeMultiples(doc, id, date, voliss, journal, abbr, ISSN) { + var item = new Z.Item('journalArticle'); + + var titleXpath = '//span/a[contains(@href, "' + id + '")]'; + var title = ZU.xpathText(doc, titleXpath); + var link = id; + + if (!title) { + titleXpath = '//strong/a[contains(@href, "' + id + '")]'; + title = ZU.xpathText(doc, titleXpath); + link = id; + } + + // Newer issues + if (!title) { + titleXpath = '//h2//a[contains(@href, "' + id + '")]'; + title = ZU.xpathText(doc, titleXpath); + link = id; + } + item.title = ZU.trimInternal(title.trim()); + + var sectionXpath = '//div[@class="da_black"]/table[tbody//a[@href="' + id + '"]]'; + var section = ZU.xpath(doc, sectionXpath); + if (!section.length) { + sectionXpath = '//div[@class="da_black"]/p[span//a[@href="' + id + '"]]'; + section = ZU.xpath(doc, sectionXpath); + } + + // Newer issues + if (!section.length) { + sectionXpath = '//div[@class="da_black"]//div[h2//a[@href="' + id + '"]]'; + section = ZU.xpath(doc, sectionXpath); + } + + if (section.length) { + var authors = text(section[0], 'p>span>strong'); + if (!authors) authors = text(section[0], 'p>strong>span'); + + // Newer issues + if (!authors) authors = text(section[0], 'strong'); + + if (authors) { + if (authors.includes("Reviewed by")) { + var reviewedAuthor = authors.match(/^by\s(.+)/); + var reviewer = authors.match(/Reviewed by\s(.+)/); + + if (reviewedAuthor) { + reviewedAuthor = parseAuthors(reviewedAuthor[1], "reviewedAuthor"); + } + if (reviewer) { + reviewer = parseAuthors(reviewer[1], "author"); + } + + if (reviewedAuthor && reviewer) { + item.creators = reviewer.concat(reviewedAuthor); + } + + else { + item.creators = reviewer || reviewedAuthor; + } + } + else { + authors = ZU.trimInternal(authors.trim()); + // delete name suffixes + item.creators = parseAuthors(authors, "author"); + } + } + // ASPJ + var abstract = text(section[0], 'p > span', 1); + + // SSQ + if (!abstract) abstract = ZU.xpathText(section[0], './/p/span[1]/text()'); + + // Newer issues + if (!abstract) abstract = ZU.xpathText(section[0], './/p/text()'); + if (abstract) { + item.abstractNote = ZU.trimInternal(abstract.trim().replace(/^,\s/, "")); + } + } + + if (date && date.includes("Published ")) { + item.date = date.match(/Published (.+)/)[1]; + } + + + if (voliss && voliss.includes("Volume")) { + item.volume = voliss.match(/Volume (\d+)/)[1]; + } + if (voliss && voliss.includes("Issue")) { + item.issue = voliss.match(/Issue (\d+)/)[1]; + } + + item.publicationTitle = journal; + item.journalAbbreviation = abbr; + item.ISSN = ISSN; + + item.attachments.push({ + url: link, + title: "Full Text PDF", + mimeType: "application/pdf" + }); + item.complete(); +} + +function parseAuthors(creators, type) { + creators = ZU.trimInternal(creators.trim()); + // delete name suffixes + creators = creators.replace(/, (USAF|USN|Retired|PE|LMFT|USA|[^,]+Air Force)\b/g, ""); + let creatorsList = creators.split(/\/|,?\sand\s|,\s/); + var rank = /^(By:|Adm|Rear Adm|Col|Lt Col|LTC|Brig Gen|Gen|Maj Gen \(sel\)|Maj|Capt|CAPT|Maj Gen|2nd Lt|W(in)?g Cdr|Mr?s\.|Mr\.|Dr\.)\s/; + var creatorsArray = []; + for (let creator of creatorsList) { + creator = creator.trim().replace(rank, ""); + creatorsArray.push(ZU.cleanAuthor(creator, type)); + } + return creatorsArray; +}/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.airuniversity.af.edu/SSQ/Display/Article/1261066/volume-11-issue-3-fall-2017/", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.airuniversity.af.edu/ASPJ/Display/Article/1151902/volume-30-issue-2-summer-2016/", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.airuniversity.af.edu/SSQ/Display/Article/2748342/volume-15-issue-3-fall-2021/", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/Airiti.js b/translators/Airiti.js new file mode 100644 index 0000000..a20b161 --- /dev/null +++ b/translators/Airiti.js @@ -0,0 +1,423 @@ +{ + "translatorID": "5f0ca39b-898a-4b1e-b98d-8cd0d6ce9801", + "label": "Airiti", + "creator": "Aurimas Vinckevicius", + "target": "^https?://([^/]+\\.)?airitilibrary\\.com/Publication/alDetailedMesh", + "minVersion": "3.0", + "maxVersion": "", + "priority": 110, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-08-04 05:04:16" +} + +function detectWeb(doc, url) { + // How can we distinguish thesis from journal article?? + if (ZU.xpathText(doc, '/html/head/meta[@name="citation_title"]/@content')) { + return 'journalArticle'; + } +} + +function getDocId(url) { + var m = url.match(/\bDocID=([^&#]+)/i); + if (!m) return; + return m[1]; +} + +async function doWeb(doc, url) { + var docID = getDocId(url); + await scrape([docID], function(item) { + if (!item.url) { + // Maybe we shouldn't. Looks more like a catalog. + item.url = url; + } + + item.attachments.push({ + title: 'Snapshot', + document: doc + }); + + item.complete(); + }); +} + +async function scrape(docIDs, itemDoneHandler) { + let tokenParams = new URLSearchParams(); + tokenParams.append('BER', JSON.stringify(docIDs.map(id => ({ + DocID: id, + IsCanAddShoppingCar: null + })))); + tokenParams.append('IsShowLink', 'false'); + tokenParams.append('keepThis', 'true'); + // This sets the necessary cookies: + await requestDocument('https://www.airitilibrary.com/Publication/MetaExport?' + tokenParams); + + var bibTeXUrl = buildQuery(docIDs); + ZU.doGet(bibTeXUrl, function(text) { + var translator = Zotero.loadTranslator("import"); + // BibTeX + translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4"); + translator.setString(text); + translator.setHandler('itemDone', function(obj, item) { + // Chinese names are not split correctly + // Sometimes, English name is provided as well in parentheses + for (var i=0, n=item.creators.length; i 1) { + c.firstName = name.substr(1, name.length); + } else { + delete c.firstName; + c.fieldMode = 1; + } + } + + // language is sometimes written in chinese + // use "zh", since I think dialect actually varies in this catalog + item.language = "zh"; + + // search- and web-specific itemDone handlers + if (itemDoneHandler) itemDoneHandler(item); + else item.complete(); + }); + translator.translate(); + }); +} + +function buildQuery(docIDs) { + var url = 'https://www.airitilibrary.com/publication/ExportTo?ExportType=BibTex' + + '¶meter=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16'; + for (var i=0; i
+
Example Site
+
Longer title
+
+ */ + +var MAX_DETECT_LINES = 150; +var bookmarkRE = /
[\s\r\n]*]+HREF[\s\r\n]*=[\s\r\n]*(['"])([^"]+)\1[^>]*>([^<\n]+?)<\/A>/gi; +var collectionRE = /
[\s\r\n]*]*>([^<]+?)<\/H3>/gi; +var collectionEndRE = /<\/DL>/gi; +var descriptionRE = /
([\s\S]*?)(?=<(?:DT|\/DL|HR)>)/gi; +var bookmarkDetailsRE = /[\s\r\n](HREF|TAGS|ADD_DATE|SHORTCUTURL|DESCRIPTION)[s\r\n]*=[s\r\n]*(['"])([\s\S]*?)\2/gi; + +function detectImport() { + var text = ""; + var line, m; + var lastIndex = 0; + var i = 0; + while ((line = Zotero.read()) !== false && (i++ < MAX_DETECT_LINES)) { + text += line; + + bookmarkRE.lastIndex = lastIndex; //don't restart searches from begining + m = bookmarkRE.exec(text); + if (m && lastIndex < bookmarkRE.lastIndex) lastIndex = bookmarkRE.lastIndex; + + if (m && m[2].toUpperCase().indexOf('PLACE:') !== 0) { + Zotero.debug("Found a match with line: "+m[0]); + return true; + } + } + return false; +} + +function doImport() { + var itemID = 0; + var l, m, re, line = ''; + var allREs = { + b: bookmarkRE, + c: collectionRE, + ce: collectionEndRE, + d: descriptionRE + }; + var firstMatch, firstMatchAt, openItem, lastIndex = 0; + var collectionStack = [], collection; + + while ((l = Zotero.read()) !== false) { + line += '\n' + l; + bookmarkRE.lastIndex = collectionRE.lastIndex = descriptionRE.lastIndex = 0; + do { + firstMatch = false; + firstMatchType = false; + + for (var re in allREs) { + if (re == 'd' && !openItem) { + continue; + } + + allREs[re].lastIndex = lastIndex; + m = allREs[re].exec(line); + if (m && (!firstMatchType || m.index < firstMatch.index)) { + firstMatch = m; + firstMatchType = re; + } + } + + if (firstMatchType) { + m = firstMatch; + lastIndex = allREs[firstMatchType].lastIndex; + } + + switch (firstMatchType) { + case 'b': //create new webpage item + if (openItem) openItem.complete(); + + var title = m[3].trim(); + + if (!title || m[2].toUpperCase().indexOf('PLACE:') == 0) { + Z.debug('Skipping item with no title or special "place:" item'); + openItem = false; + break; + } + + openItem = new Zotero.Item("webpage"); + openItem.title = ZU.unescapeHTML(title); + openItem.itemID = openItem.id = itemID++; + if (collection) collection.children.push(openItem); + + bookmarkDetailsRE.lastIndex = 0; + var detailMatch; + while (detailMatch = bookmarkDetailsRE.exec(m[0])) { + switch (detailMatch[1].toUpperCase()) { + case 'HREF': + openItem.url = detailMatch[3]; + break; + case 'DESCRIPTION': + openItem.abstractNote = detailMatch[3]; + break; + case 'TAGS': + case 'SHORTCUTURL': + openItem.tags = openItem.tags.concat(detailMatch[3].split(/[\s\r\n]*,[\s\r\n]*/)); + break; + case 'ADD_DATE': + openItem.accessDate = convertDate(detailMatch[3]) + break; + } + } + break; + case 'c': //start a collection + if (openItem) { + openItem.complete(); + openItem = false; + } + + if (collection) collectionStack.push(collection) + + collection = new Zotero.Collection(); + collection.type = 'collection'; + collection.name = ZU.unescapeHTML(m[1]); + Zotero.debug("Starting collection: "+ collection.name); + collection.children = new Array(); + break; + case 'ce': //end a collection + if (openItem) { + openItem.complete(); + openItem = false; + } + + var parentCollection = collectionStack.pop(); + + if (parentCollection) { + if (collection.children.length) { + parentCollection.children.push(collection); + } + collection = parentCollection; + } else if (collection && collection.children.length) { + collection.complete(); + collection = false; + } + break; + case 'd': //add description to bookmark and complete item + openItem.abstractNote = ZU.trimInternal(m[1]); + openItem.complete(); + openItem = false; + break; + } + } while (firstMatch); + + line = line.substr(lastIndex); + lastIndex = 0; + } + + if (openItem) openItem.complete(); + if (collection) { + var parentCollection; + while (parentCollection = collectionStack.pop()) { + if (collection.children.length) { + parentCollection.children.push(collection); + } + collection = parentCollection; + } + if (collection.children.length) { + collection.complete(); + } + } +} + +function convertDate(timestamp){ + var d = new Date(timestamp*1000); + function pad(n) { return ZU.lpad(n, '0', 2) }; + return ZU.lpad(d.getUTCFullYear(), '0', 4)+'-' + + pad(d.getUTCMonth()+1)+'-' + + pad(d.getUTCDate())+' ' + + pad(d.getUTCHours())+':' + + pad(d.getUTCMinutes())+':' + + pad(d.getUTCSeconds()); + } + + + +function doExport() { + var item; + + var header = '\n'+ +'\n'+ +'\n'+ +'Bookmarks\n'+ +'

Bookmarks Menu

\n'+ +'
\n'; + var footer = '
'; + + Zotero.write(header); + while (item = Zotero.nextItem()) { + // TODO Be more verbose, making an informative title and including more metadata + let tags = item.tags.map(tag => tag.tag).join(','); + if (item.url) { + Zotero.write('
'+item.title+'\n'); + } + else Zotero.debug("Skipping item without URL: "+item.title); + } + Zotero.write(footer); +} + + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "import", + "input": "\n\nBookmarks\n

Bookmarks for anarcat from SemanticScuttle

\n
\n
Pond - Pond\n\n", + "items": [ + { + "itemType": "webpage", + "creators": [], + "notes": [], + "tags": [ + "software", + "security", + "social_networking", + "todo" + ], + "seeAlso": [], + "attachments": [], + "title": "Pond - Pond", + "id": 0, + "itemID": 0, + "url": "https://pond.imperialviolet.org", + "abstractNote": "For secure, synchronous communication we have OTR and, when run over Tor, this is pretty good. But while we have secure asynchronous messaging in the form of PGP email, it's not forward secure and it gratuitously leaks traffic information. While a desire for forward secure PGP is hardly new, it still hasn't materialised in a widely usable manner.\n\nAdditionally, email is used predominately for insecure communications (mailing lists, etc) and is useful because it allows previously unconnected people to communicate as long as a (public) email address is known to one party. But the flip side to this is that volume and spam are driving people to use centralised email services. These provide such huge benefits to the majority of email communication, so it's unlikely that this trend is going to reverse. But, even with PGP, these services are trusted with hugely valuable traffic information if any party uses them.\n\nSo Pond is not email. Pond is forward secure, asynchronous messaging for the discerning. Pond messages are asynchronous, but are not a record; they expire automatically a week after they are received. Pond seeks to prevent leaking traffic information against everyone except a global passive attacker.", + "accessDate": "2014-03-31 08:06:22" + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Bookshop.org.js b/translators/Bookshop.org.js new file mode 100644 index 0000000..8f6f6ab --- /dev/null +++ b/translators/Bookshop.org.js @@ -0,0 +1,223 @@ +{ + "translatorID": "05997944-d1c2-41bf-a399-9932268c81e5", + "label": "Bookshop.org", + "creator": "Abe Jellinek", + "target": "^https://bookshop\\.org/books", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-07-01 17:14:32" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (/\/books\/[^/]+\/[0-9]+/.test(url) + && attr('meta[property="og:type"]', 'content') == 'book') { + return "book"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('h2 a[href*="/books/"]'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', function (obj, item) { + item.numPages = text(doc, '[itemprop="numberOfPages"]'); + item.publisher = text(doc, '[itemprop="publisher"]'); + + item.tags = []; + item.attachments = []; + item.url = ''; + + for (let author of doc.querySelectorAll('span[itemprop="author"]')) { + let name = text(author, 'span[itemprop="name"]'); + let type = author.parentNode.nextSibling.textContent; + + if (type.includes('Author')) { + type = 'author'; + } + else if (type.includes('Editor')) { + type = 'editor'; + } + else if (type.includes('Translator')) { + type = 'translator'; + } + else { + type = 'contributor'; + } + + item.creators.push(ZU.cleanAuthor(name, type)); + } + + item.complete(); + }); + + translator.getTranslatorObject(function (trans) { + trans.itemType = "book"; + trans.doWeb(doc, url); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://bookshop.org/books/crying-in-h-mart-a-memoir/9780525657743", + "items": [ + { + "itemType": "book", + "title": "Crying in H Mart: A Memoir", + "creators": [ + { + "firstName": "Michelle", + "lastName": "Zauner", + "creatorType": "author" + } + ], + "date": "2021-04-20T12:00:00-04:00", + "ISBN": "9780525657743", + "abstractNote": "NEW YORK TIMES BEST SELLER - A Best Book of 2021: AV Club - Bustle - Entertainment Weekly - Good Morning America - Chicago Review of Books - Fortune - TIME - CNN Underscored - Apartment Therapy - Popsugar - Hello Giggles - Business Insider - The Millions - Wall Street Journal Magazine - Glamour From the indie rockstar of Japanese Breakfast fame, and author of the viral 2018 New Yorker essay that shares the title of this book, an unflinching, powerful memoir about growing up Korean American, losing her mother, and forging her own identity. In this exquisite story of family, food, grief, and endurance, Michelle Zauner proves herself far more than a dazzling singer, songwriter, and guitarist. With humor and heart, she tells of growing up one of the few Asian American kids at her school in Eugene, Oregon; of struggling with her mother's particular, high expectations of her; of a painful adolescence; of treasured months spent in her grandmother's tiny apartment in Seoul, where she and her mother would bond, late at night, over heaping plates of food. As she grew up, moving to the East Coast for college, finding work in the restaurant industry, and performing gigs with her fledgling band--and meeting the man who would become her husband--her Koreanness began to feel ever more distant, even as she found the life she wanted to live. It was her mother's diagnosis of terminal cancer, when Michelle was twenty-five, that forced a reckoning with her identity and brought her to reclaim the gifts of taste, language, and history her mother had given her. Vivacious and plainspoken, lyrical and honest, Zauner's voice is as radiantly alive on the page as it is onstage. Rich with intimate anecdotes that will resonate widely, and complete with family photos, Crying in H Mart is a book to cherish, share, and reread.", + "language": "en", + "libraryCatalog": "bookshop.org", + "numPages": "256", + "publisher": "Knopf Publishing Group", + "shortTitle": "Crying in H Mart", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://bookshop.org/books/organic-chemistry-for-babies/9781492671169", + "items": [ + { + "itemType": "book", + "title": "Organic Chemistry for Babies", + "creators": [ + { + "firstName": "Chris", + "lastName": "Ferrie", + "creatorType": "author" + }, + { + "firstName": "Cara", + "lastName": "Florance", + "creatorType": "author" + } + ], + "date": "2018-05-01T12:00:00-04:00", + "ISBN": "9781492671169", + "abstractNote": "Fans of Chris Ferrie's Rocket Science for Babies, Quantum Physics for Babies, and 8 Little Planets will love this introduction to organic chemistry for babies and toddlers!It only takes a small spark to ignite a child's mind.Written by an expert, Organic Chemistry for Babies is a colorfully simple introduction to the structure of organic, carbon-containing compounds and materials. Gift your special little one the opportunity to learn with this perfect science baby gift and help them be one step ahead of pre-med students! With a tongue-in-cheek approach that adults will love, this installment of the Baby University baby board book series is the perfect way to introduce STEM concepts for babies and toddlers. After all, it's never too early to become an organic chemist!If you're looking for the perfect STEAM book for teachers, science toys for babies, or chemistry toys for kids, look no further! Organic Chemistry for Babies offers fun early learning for your little scientist!", + "language": "en", + "libraryCatalog": "bookshop.org", + "numPages": "24", + "publisher": "Sourcebooks Explore", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://bookshop.org/books?keywords=pippi", + "items": "multiple" + }, + { + "type": "web", + "url": "https://bookshop.org/books/meditations-a-new-translation-7be5ded9-87a9-4056-af72-d6c917125a29/9780812968255", + "items": [ + { + "itemType": "book", + "title": "Meditations: A New Translation", + "creators": [ + { + "firstName": "Marcus", + "lastName": "Aurelius", + "creatorType": "author" + }, + { + "firstName": "Gregory", + "lastName": "Hays", + "creatorType": "translator" + } + ], + "date": "2003-05-06T12:00:00-04:00", + "ISBN": "9780812968255", + "abstractNote": "Nearly two thousand years after it was written, Meditations remains profoundly relevant for anyone seeking to lead a meaningful life. Few ancient works have been as influential as the Meditations of Marcus Aurelius, philosopher and emperor of Rome (A.D. 161-180). A series of spiritual exercises filled with wisdom, practical guidance, and profound understanding of human behavior, it remains one of the greatest works of spiritual and ethical reflection ever written. Marcus's insights and advice--on everything from living in the world to coping with adversity and interacting with others--have made the Meditations required reading for statesmen and philosophers alike, while generations of ordinary readers have responded to the straightforward intimacy of his style. For anyone who struggles to reconcile the demands of leadership with a concern for personal integrity and spiritual well-being, the Meditations remains as relevant now as it was two thousand years ago. In Gregory Hays's new translation--the first in thirty-five years--Marcus's thoughts speak with a new immediacy. In fresh and unencumbered English, Hays vividly conveys the spareness and compression of the original Greek text. Never before have Marcus's insights been so directly and powerfully presented. With an Introduction that outlines Marcus's life and career, the essentials of Stoic doctrine, the style and construction of the Meditations, and the work's ongoing influence, this edition makes it possible to fully rediscover the thoughts of one of the most enlightened and intelligent leaders of any era.", + "language": "en", + "libraryCatalog": "bookshop.org", + "numPages": "256", + "publisher": "Modern Library", + "shortTitle": "Meditations", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Boston Review.js b/translators/Boston Review.js new file mode 100644 index 0000000..b583ced --- /dev/null +++ b/translators/Boston Review.js @@ -0,0 +1,332 @@ +{ + "translatorID": "55d28a64-e56e-4d3c-93db-a5fc584776de", + "label": "Boston Review", + "creator": "Sebastian Karcher", + "target": "^https?://(www\\.)?bostonreview\\.net/", + "minVersion": "6.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-08-18 06:17:49" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2012/2013 Sebastian Karcher, Zoë C. Ma, and contributors + + 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) { + let pageURL = new URL(url); + // Some content may not be in the print edition, but the web publication + // is a magazine nonetheless + if (/^\/(articles|forum(_response)?|us)\/.+/.test(pageURL.pathname)) { + return 'magazineArticle'; + } + else if (getSearchResults(doc, true)) { + return 'multiple'; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + let outerSelectors = [ + "[data-elementor-type='search-results']", // search page + "[data-elementor-post-type='issue']", // issue TOC + "[data-elementor-post-type='special-project']", // special project + ]; + // Titles are in an "h3 a" inside the outer container element + // The computed selector looks like "container1 h3 a, container2 h3 a ..." + let selectors = outerSelectors.map(s => s + " h3 a").join(", "); + // Legacy issue pages; although many of the links are broken + selectors += ", [data-elementor-post-type='elementor_library'] h6 a"; + var rows = doc.querySelectorAll(selectors); + for (let row of rows) { + let href = row.href; + 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) { + let translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', (_obj, item) => { + item.publicationTitle = item.libraryCatalog = "Boston Review"; + let ldInfo = text(doc, "script[type='application/ld+json']"); + let date; + if (ldInfo) { + // Get schema.org metadata for the web page from JSON-LD + let pageInfo + = (JSON.parse(ldInfo)["@graph"] || []) + .filter(x => x["@type"] === "WebPage")[0]; + date = pageInfo && pageInfo.datePublished; + } + if (!date) { + // Only as fallback; despite the itemprop value, this doesn't + // always appear to be "date modified"; rather, it's the original + // publication date + date = text(doc, ".elementor-post-info [itemprop='dateModified']"); + } + if (date) { + item.date = ZU.strToISO(date); + } + + // Remove suffix " - Boston Review" in title + item.title = item.title.replace(/\s+-\s+Boston Review\s*$/, ""); + + // NOTE: the href property match takes care of both /author and + // /author-custom paths + let authors = doc.querySelectorAll("h2 a[href^='https://www.bostonreview.net/author']"); + for (let author of authors) { + let authorName = ZU.trimInternal(author.textContent.trim()); + item.creators.push(ZU.cleanAuthor(authorName, "author")); + } + + for (let tag of doc.querySelectorAll("a[href^='https://www.bostonreview.net/tag/']")) { + item.tags.push(ZU.trimInternal(tag.textContent)); + } + + // NOTE that in general there's no sure way to determine whether an + // article belongs to a print issue (hence no volume/issue numbers and + // no ISSN which is for the print publication). If you can help, please + // contribute! + + item.complete(); + }); + + let em = await translator.getTranslatorObject(); + em.itemType = 'magazineArticle'; + await em.doWeb(doc, url); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.bostonreview.net/forum_response/rethinking-family-life-robin-west/", + "items": [ + { + "itemType": "magazineArticle", + "title": "Rethinking Family Life", + "creators": [ + { + "firstName": "Robin", + "lastName": "West", + "creatorType": "author" + } + ], + "date": "2012-11-09", + "abstractNote": "Rethinking Family Life James Heckman provides an economic argument for a claim that is often thought to be supported at most by moral considerations:", + "language": "en-US", + "libraryCatalog": "Boston Review", + "publicationTitle": "Boston Review", + "url": "https://www.bostonreview.net/forum_response/rethinking-family-life-robin-west/", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.bostonreview.net/forum/can-global-brands-create-just-supply-chains-richard-locke", + "items": [ + { + "itemType": "magazineArticle", + "title": "Can Global Brands Create Just Supply Chains?", + "creators": [ + { + "firstName": "Richard M.", + "lastName": "Locke", + "creatorType": "author" + } + ], + "date": "2013-05-21", + "abstractNote": "When Jia Jingchuan, a 27-year-old electronics worker in Suzhou, China, sought compensation for the chemical poisoning he suffered at work, he appealed", + "language": "en-US", + "libraryCatalog": "Boston Review", + "publicationTitle": "Boston Review", + "url": "https://www.bostonreview.net/forum/can-global-brands-create-just-supply-chains-richard-locke/", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "Global" + }, + { + "tag": "Human Rights" + }, + { + "tag": "Labor" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.bostonreview.net/articles/government-loansharking/", + "items": [ + { + "itemType": "magazineArticle", + "title": "Government Loansharking", + "creators": [ + { + "firstName": "Malcolm", + "lastName": "Harris", + "creatorType": "author" + } + ], + "date": "2013-06-07", + "abstractNote": "Last November when I first wrote about student loans for Boston Review, the Department of Education estimated it would be pulling in around $25 billion in", + "language": "en-US", + "libraryCatalog": "Boston Review", + "publicationTitle": "Boston Review", + "url": "https://www.bostonreview.net/articles/government-loansharking/", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "Economy" + }, + { + "tag": "Education" + }, + { + "tag": "Politics" + }, + { + "tag": "U.S." + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://bostonreview.net/issue/september-october-2012/", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.bostonreview.net/?s=labor", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.bostonreview.net/articles/astra-taylor-wolson-interview/", + "items": [ + { + "itemType": "magazineArticle", + "title": "Beyond the Neoliberal University", + "creators": [ + { + "firstName": "Astra", + "lastName": "Taylor", + "creatorType": "author" + }, + { + "firstName": "Todd", + "lastName": "Wolfson", + "creatorType": "author" + } + ], + "date": "2020-08-04", + "abstractNote": "Astra Taylor talks with Rutgers faculty union president Todd Wolfson about organizing academic communities in the age of COVID-19.", + "language": "en-US", + "libraryCatalog": "Boston Review", + "publicationTitle": "Boston Review", + "url": "https://www.bostonreview.net/articles/astra-taylor-wolson-interview/", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "COVID-19" + }, + { + "tag": "Education" + }, + { + "tag": "Interview" + }, + { + "tag": "Labor" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.bostonreview.net/special_project/opportunity-after-neoliberalism/", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/Bosworth Toller's Anglo-Saxon Dictionary Online.js b/translators/Bosworth Toller's Anglo-Saxon Dictionary Online.js new file mode 100644 index 0000000..34f78a2 --- /dev/null +++ b/translators/Bosworth Toller's Anglo-Saxon Dictionary Online.js @@ -0,0 +1,496 @@ +{ + "translatorID": "b2d07a2a-c8c6-4426-ba6b-35f094a4d916", + "label": "Bosworth Toller's Anglo-Saxon Dictionary Online", + "creator": "Zoë C. Ma", + "target": "^https://bosworthtoller\\.com/", + "minVersion": "5.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-08-18 07:39:58" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2023 Zoë C. Ma + + 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) { + // The logic is that "a page's type is determined by its content", because + // the current implementation of the dictionary web app may not be able to + // sync URL correctly all the time. + if (getSearchResults(doc, true/* checkOnly */)) { + return "multiple"; + } + + if (doc.querySelector("#btd--entry-single")) { + return "dictionaryEntry"; + } + + return false; +} + +function getSearchResults(doc, checkOnly = false) { + let items = {}; + let found = false; + let rows = doc.querySelectorAll(".btd--search-entry"); + for (let row of rows) { + // Don't retrieve the "similar entry" links + let href = attr(row, ".btd--search-entry-header a", "href"); + let title = ZU.trimInternal(text(row, ".btd--entry-grammar").trim()); + if (!title) { + title = text(row, ".btd--search-entry-header a"); // fallback + } + 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) === 'multiple') { + let items = await Z.selectItems(getSearchResults(doc)); + if (!items) return; + for (let url of Object.keys(items)) { + scrape(await requestDocument(url)); + } + } + else { + scrape(doc, url); + } +} + +const BOSWORTH_TOLLER_INFO = { + dictionaryTitle: "An Anglo-Saxon Dictionary Online", + language: "en", + place: "Prague", + publisher: "Faculty of Arts, Charles University", + date: "2014", + creators: [ + { firstName: "Joseph", lastName: "Bosworth", creatorType: "author" }, + { firstName: "Thomas Northcote", lastName: "Toller", creatorType: "editor" }, + { firstName: "Christ", lastName: "Sean", creatorType: "editor" }, + { firstName: "Ondřej", lastName: "Tichy", creatorType: "editor" }, + ], +}; + +function scrape(doc, url = doc.location.href) { + let item = new Z.Item("dictionaryEntry"); + + // "Constant" fields + Object.assign(item, BOSWORTH_TOLLER_INFO); + + // Page-specific data + item.url = url; + + // Word entry + item.title = normalizeLemma(doc) || "[Unknown entry]"; + + // Original publication and page number in it, if any, as extra + item.extra = getExtraInfo(doc); + + // Snapshot + item.attachments = [{ + document: doc, + title: "Snapshot", + mimeType: "text/html" + }]; + + item.complete(); +} + +// See https://bosworthtoller.com/images-dictionary/frontback_matter.pdf +var BOOK_ORIG_INFO = { + b: "Original Dictionary Title: An Anglo-Saxon Dictionary, Based on the Manuscript Collections of the Late Joseph Bosworth, D.D., F.R.S.\nOriginal Date: 1898\nOriginal Publisher: Oxford University Press\nOriginal Place: London", + d: "Original Dictionary Title: An Anglo-Saxon Dictionary, Based on the Manuscript Collections of the Late Joseph Bosworth; Supplement\nOriginal Date: 1921\nOriginal Publisher: Oxford University Press\nOriginal Place: London", +}; + +// Get the extra info including original volume info and page number by parsing +// the URL of the scanned page linked to the article. Returns a string where +// each extra entry occupies one line in `key: value` format, or empty string +// if the original book and page cannot be determined. +function getExtraInfo(doc) { + let imageURL = attr(doc, ".btd--image-pin-pan > img", "src"); + if (!imageURL) { + return ""; + } + // "b" for main book (1898), "d" for supplement (1912) + let pageMatch = imageURL.match(/^\/images-dictionary\/bt_([bd])(\d+)\..+$/); + if (!pageMatch) { + return ""; + } + let [, bookKey, page] = pageMatch; + return BOOK_ORIG_INFO[bookKey] // static original publication info + + "\nOriginal Page: " + page.replace(/^0*/, ""); // trim leading zero +} + +// Normalize the lemma's vowel display-form, following the original book's +// orthography (acute for long vowel). +// Why is this necessary? Because the lemma prominently displayed on the page +// main body can be configured by the user (by clicking on the icons: acute, +// macron, and none). But we want the form used in our item data normalized, no +// matter the display option, in order to not lose information and avoid +// duplication. +// NOTE that the letter case is not normalized -- the display on the page +// corresponds to the lemma in the original book. +function normalizeLemma(doc) { + // The key is to apply the correct vowel length even if the user disables + // its display. This "canonical" form (which corresponds to the original + // form in the print book) can be found either in the metadata or in the + // "citation" block under "entry information" in the doc, no matter the + // citation style in use on the page. + let titleRaw = text(doc, "#btd--entry-lemma").trim(); + let titleNormalized = removeDiacritics(titleRaw); + + // lemma from the meta field, not normally amenable to client-side + // modification + let metaTitle = attr(doc, 'meta[property="og:title"]', "content").trim(); + let metaTitleNormalized = removeDiacritics(metaTitle); + + if (metaTitle && titleNormalized === metaTitleNormalized) { + return metaTitle; + } + + return null; +} + +// Utility functions + +// Remove the acute accent and macron if any. +function removeDiacritics(str) { + return str.normalize("NFD").replace(/[\u0301\u0304]/g, ""); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://bosworthtoller.com/search?q=heorte", + "defer": true, + "items": "multiple" + }, + { + "type": "web", + "url": "https://bosworthtoller.com/search/advanced?q=%7B%22minFields%22%3A1,%22fields%22%3A%5B%7B%22query%22%3A%22diacon%22,%22field%22%3A%22headword%22,%22is_regex%22%3Afalse%7D,%7B%22query%22%3A%22%22,%22field%22%3A%22headword%22,%22condition%22%3A%22and%22,%22is_regex%22%3Afalse%7D%5D,%22wordclass%22%3A%7B%22include%22%3A%5B%221%22%5D,%22exclude%22%3A%5B%5D%7D,%22gender%22%3A%7B%22include%22%3A%5B%221%22%5D,%22exclude%22%3A%5B%5D%7D,%22subcategory%22%3A%7B%22include%22%3A%5B%5D,%22exclude%22%3A%5B%5D%7D,%22volume%22%3Anull%7D", + "defer": true, + "items": "multiple" + }, + { + "type": "web", + "url": "https://bosworthtoller.com/23205", + "items": [ + { + "itemType": "dictionaryEntry", + "title": "mucg-wyrt", + "creators": [ + { + "firstName": "Joseph", + "lastName": "Bosworth", + "creatorType": "author" + }, + { + "firstName": "Thomas Northcote", + "lastName": "Toller", + "creatorType": "editor" + }, + { + "firstName": "Christ", + "lastName": "Sean", + "creatorType": "editor" + }, + { + "firstName": "Ondřej", + "lastName": "Tichy", + "creatorType": "editor" + } + ], + "date": "2014", + "dictionaryTitle": "An Anglo-Saxon Dictionary Online", + "extra": "Original Dictionary Title: An Anglo-Saxon Dictionary, Based on the Manuscript Collections of the Late Joseph Bosworth, D.D., F.R.S.\nOriginal Date: 1898\nOriginal Publisher: Oxford University Press\nOriginal Place: London\nOriginal Page: 700", + "language": "en", + "libraryCatalog": "Bosworth Toller's Anglo-Saxon Dictionary Online", + "place": "Prague", + "publisher": "Faculty of Arts, Charles University", + "url": "https://bosworthtoller.com/23205", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://bosworthtoller.com/7096", + "items": [ + { + "itemType": "dictionaryEntry", + "title": "CYN", + "creators": [ + { + "firstName": "Joseph", + "lastName": "Bosworth", + "creatorType": "author" + }, + { + "firstName": "Thomas Northcote", + "lastName": "Toller", + "creatorType": "editor" + }, + { + "firstName": "Christ", + "lastName": "Sean", + "creatorType": "editor" + }, + { + "firstName": "Ondřej", + "lastName": "Tichy", + "creatorType": "editor" + } + ], + "date": "2014", + "dictionaryTitle": "An Anglo-Saxon Dictionary Online", + "extra": "Original Dictionary Title: An Anglo-Saxon Dictionary, Based on the Manuscript Collections of the Late Joseph Bosworth, D.D., F.R.S.\nOriginal Date: 1898\nOriginal Publisher: Oxford University Press\nOriginal Place: London\nOriginal Page: 183", + "language": "en", + "libraryCatalog": "Bosworth Toller's Anglo-Saxon Dictionary Online", + "place": "Prague", + "publisher": "Faculty of Arts, Charles University", + "url": "https://bosworthtoller.com/7096", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://bosworthtoller.com/27305", + "items": [ + { + "itemType": "dictionaryEntry", + "title": "secgan", + "creators": [ + { + "firstName": "Joseph", + "lastName": "Bosworth", + "creatorType": "author" + }, + { + "firstName": "Thomas Northcote", + "lastName": "Toller", + "creatorType": "editor" + }, + { + "firstName": "Christ", + "lastName": "Sean", + "creatorType": "editor" + }, + { + "firstName": "Ondřej", + "lastName": "Tichy", + "creatorType": "editor" + } + ], + "date": "2014", + "dictionaryTitle": "An Anglo-Saxon Dictionary Online", + "extra": "Original Dictionary Title: An Anglo-Saxon Dictionary, Based on the Manuscript Collections of the Late Joseph Bosworth, D.D., F.R.S.\nOriginal Date: 1898\nOriginal Publisher: Oxford University Press\nOriginal Place: London\nOriginal Page: 855", + "language": "en", + "libraryCatalog": "Bosworth Toller's Anglo-Saxon Dictionary Online", + "place": "Prague", + "publisher": "Faculty of Arts, Charles University", + "url": "https://bosworthtoller.com/27305", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://bosworthtoller.com/23035", + "items": [ + { + "itemType": "dictionaryEntry", + "title": "mód-c-wánig", + "creators": [ + { + "firstName": "Joseph", + "lastName": "Bosworth", + "creatorType": "author" + }, + { + "firstName": "Thomas Northcote", + "lastName": "Toller", + "creatorType": "editor" + }, + { + "firstName": "Christ", + "lastName": "Sean", + "creatorType": "editor" + }, + { + "firstName": "Ondřej", + "lastName": "Tichy", + "creatorType": "editor" + } + ], + "date": "2014", + "dictionaryTitle": "An Anglo-Saxon Dictionary Online", + "extra": "Original Dictionary Title: An Anglo-Saxon Dictionary, Based on the Manuscript Collections of the Late Joseph Bosworth, D.D., F.R.S.\nOriginal Date: 1898\nOriginal Publisher: Oxford University Press\nOriginal Place: London\nOriginal Page: 694", + "language": "en", + "libraryCatalog": "Bosworth Toller's Anglo-Saxon Dictionary Online", + "place": "Prague", + "publisher": "Faculty of Arts, Charles University", + "url": "https://bosworthtoller.com/23035", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://bosworthtoller.com/53107", + "items": [ + { + "itemType": "dictionaryEntry", + "title": "hrǽw", + "creators": [ + { + "firstName": "Joseph", + "lastName": "Bosworth", + "creatorType": "author" + }, + { + "firstName": "Thomas Northcote", + "lastName": "Toller", + "creatorType": "editor" + }, + { + "firstName": "Christ", + "lastName": "Sean", + "creatorType": "editor" + }, + { + "firstName": "Ondřej", + "lastName": "Tichy", + "creatorType": "editor" + } + ], + "date": "2014", + "dictionaryTitle": "An Anglo-Saxon Dictionary Online", + "extra": "Original Dictionary Title: An Anglo-Saxon Dictionary, Based on the Manuscript Collections of the Late Joseph Bosworth; Supplement\nOriginal Date: 1921\nOriginal Publisher: Oxford University Press\nOriginal Place: London\nOriginal Page: 562", + "language": "en", + "libraryCatalog": "Bosworth Toller's Anglo-Saxon Dictionary Online", + "place": "Prague", + "publisher": "Faculty of Arts, Charles University", + "url": "https://bosworthtoller.com/53107", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://bosworthtoller.com/42878", + "items": [ + { + "itemType": "dictionaryEntry", + "title": "dón", + "creators": [ + { + "firstName": "Joseph", + "lastName": "Bosworth", + "creatorType": "author" + }, + { + "firstName": "Thomas Northcote", + "lastName": "Toller", + "creatorType": "editor" + }, + { + "firstName": "Christ", + "lastName": "Sean", + "creatorType": "editor" + }, + { + "firstName": "Ondřej", + "lastName": "Tichy", + "creatorType": "editor" + } + ], + "date": "2014", + "dictionaryTitle": "An Anglo-Saxon Dictionary Online", + "extra": "Original Dictionary Title: An Anglo-Saxon Dictionary, Based on the Manuscript Collections of the Late Joseph Bosworth; Supplement\nOriginal Date: 1921\nOriginal Publisher: Oxford University Press\nOriginal Place: London\nOriginal Page: 154", + "language": "en", + "libraryCatalog": "Bosworth Toller's Anglo-Saxon Dictionary Online", + "place": "Prague", + "publisher": "Faculty of Arts, Charles University", + "url": "https://bosworthtoller.com/42878", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Bracero History Archive.js b/translators/Bracero History Archive.js new file mode 100644 index 0000000..d2b062e --- /dev/null +++ b/translators/Bracero History Archive.js @@ -0,0 +1,200 @@ +{ + "translatorID": "f9373e49-e6ac-46f7-aafe-bb24a2fbc3f0", + "label": "Bracero History Archive", + "creator": "Adam Crymble", + "target": "^https?://braceroarchive\\.org", + "minVersion": "1.0.0b4.r5", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-12-28 04:32:48" +} + +function detectWeb(doc, url) { + if (doc.title.match("Item")) { + return "book"; + } else if (doc.evaluate('//div[@class="item-meta"]/h2/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { + return "multiple"; + } +} + +//Bracero History Archive translator; Code by Adam Crymble + +function associateData (newItem, dataTags, field, zoteroField) { + if (dataTags[field]) { + newItem[zoteroField] = dataTags[field]; + } +} + +function scrape(doc, url) { + + var namespace = doc.documentElement.namespaceURI; + var nsResolver = namespace ? function(prefix) { + if (prefix == 'x') return namespace; else return null; + } : null; + + var dataTags = new Object(); + var fieldTitle; + var contents1; + + var headers = doc.evaluate('//h3', doc, nsResolver, XPathResult.ANY_TYPE, null); + var contents = doc.evaluate('//div[@class="field"]/div', doc, nsResolver, XPathResult.ANY_TYPE, null); + var xPathCount = doc.evaluate('count (//div[@class="field"]/div)', doc, nsResolver, XPathResult.ANY_TYPE, null); + + for (i=0; i. + + ***** END LICENSE BLOCK ***** +*/ + + +function detectWeb(doc, url) { + if (doc.querySelector('meta[name="citation_title"]')) { + if (url.includes('/journals/')) { + return 'journalArticle'; + } + else { + return 'book'; + } + } + else if (url.includes('referenceworks.brill.com/display/')) { + return 'encyclopediaArticle'; + } + else if (url.includes('bibliographies.brill.com/items/') + && doc.querySelector('form.export-item')) { + return 'journalArticle'; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('#searchContent .text-headline a, .type-article .text-headline a, .result-item .book-title a'); + if (!rows.length) { + rows = doc.querySelectorAll('#bibliography a.item-container'); + } + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(text(row, '.item-title span:last-child') || row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + if (url.includes('bibliographies.brill.com/items/')) { + scrapeBibliography(doc); + return; + } + + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', function (obj, item) { + if (item.date) { + item.date = ZU.strToISO(item.date); + } + + if (item.itemType == 'journalArticle' && item.section) { + delete item.section; + } + + if (item.itemType == 'book' && item.publicationTitle) { + delete item.publicationTitle; + } + + if (item.itemType == 'encyclopediaArticle' && !item.encyclopediaTitle) { + item.encyclopediaTitle = text(doc, '.source-link a'); + } + + if (item.abstractNote && item.abstractNote.endsWith('by Brill.')) { + delete item.abstractNote; + } + + if (!item.publisher) { + item.publisher = 'Brill'; + } + + if (!item.creators.length) { + let creatorNames = []; + let creatorType = 'author'; + let line = doc.querySelector('.contributor-line'); + if (line) { + switch (text(line, '.creator-type-label').trim()) { + case 'Author:': + case 'Authors:': + creatorType = 'author'; + break; + case 'Editor:': + case 'Editors:': + creatorType = 'editor'; + break; + } + creatorNames = line.querySelectorAll('.contributor-details .contributor-unlinked, .contributor-details .contributor-details-link'); + } + for (let creatorName of creatorNames) { + item.creators.push(ZU.cleanAuthor(creatorName.textContent, creatorType)); + } + } + + if (item.attachments.length > 1) { + // only remove snapshot if we get a PDF + item.attachments = item.attachments.filter(at => at.title != 'Snapshot'); + } + + item.complete(); + }); + + translator.getTranslatorObject(function (trans) { + if (url.includes('referenceworks.brill.com/display/entries/')) { + trans.itemType = 'encyclopediaArticle'; + } + else if (url.includes('brill.com/edcollbook/')) { + // Delete citation_inbook_title if this is actually a book, not a book section + // Prevents EM from mis-detecting as a bookSection in a way that even setting + // trans.itemType can't override + let bookTitleMeta = doc.querySelector('meta[name="citation_inbook_title"]'); + if (bookTitleMeta) { + bookTitleMeta.remove(); + } + trans.itemType = 'book'; + } + + trans.doWeb(doc, url); + }); +} + +function scrapeBibliography(doc) { + let params = new URLSearchParams({ + keys: attr(doc, 'input[name="keys"]', 'value'), + }).toString(); + + ZU.doGet('/BSLO/export/?' + params, function (ris) { + var translator = Zotero.loadTranslator("import"); + translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); // RIS + translator.setString(ris); + translator.setHandler("itemDone", function (obj, item) { + if (item.journalAbbreviation == item.publicationTitle) { + delete item.journalAbbreviation; + } + + if (item.url) { + item.url = item.url.replace(':443', ''); + } + + item.complete(); + }); + translator.translate(); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://brill.com/view/journals/afdi/5/1/article-p27_3.xml", + "items": [ + { + "itemType": "journalArticle", + "title": "African Trading Post in Guangzhou: Emergent or Recurrent Commercial Form?", + "creators": [ + { + "firstName": "Sylvie", + "lastName": "Bredeloup", + "creatorType": "author" + } + ], + "date": "2012-01-01", + "DOI": "10.1163/187254612X646206", + "ISSN": "1872-5457, 1872-5465", + "abstractNote": "Abstract In the early 2000s, nationals of Sub-Saharan Africa who had settled in the market places of Hong Kong, Bangkok, Jakarta, and Kuala Lumpur, moved to Guangzhou and opened offices in the upper floors of buildings in Baiyun and Yuexiu Districts. These were located in the northwest of the city, near the central railway station and one of the two fairs of Canton. Gradually these traders were able to create the necessary conditions of hospitality by opening community restaurants on upper floors, increasing the number of showrooms and offices as well as the services of freight and customs clearance in order to live up to an African itinerant customer’s expectations. From interviews carried out between 2006 and 2009 in the People’s Republic of China and in Hong Kong, Bangkok, Dubai, and West Africa, the article will first highlight the economic logics which have contributed to the constitution of African trading posts in China and describe their extension from the Middle East and from Asia. The second part will determine the respective roles of migrants and traveling Sub-Saharan entrepreneurs, before exploring their interactions with Chinese society in the setting up of these commercial networks. It will also look at the impact of toughening immigration policies. It is the principle of the African trading posts of anchoring of some traders in strategic places negotiated with the host society that allows the movement but also the temporary settlement of many visitors. The first established traders purchase products manufactured in the hinterland to fulfill the demand of the itinerant merchants who in turn supply customers located in other continents.", + "issue": "1", + "language": "en", + "libraryCatalog": "brill.com", + "pages": "27-50", + "publicationTitle": "African Diaspora", + "shortTitle": "African Trading Post in Guangzhou", + "url": "https://brill.com/view/journals/afdi/5/1/article-p27_3.xml", + "volume": "5", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "African entrepreneurs" + }, + { + "tag": "African migration" + }, + { + "tag": "Guangzhou" + }, + { + "tag": "comptoir commercial" + }, + { + "tag": "entrepreneurs africains" + }, + { + "tag": "migration africaine" + }, + { + "tag": "trading post" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://brill.com/search?q2=ottoman+missionary", + "items": "multiple" + }, + { + "type": "web", + "url": "https://brill.com/view/journals/jal/49/3/article-p171_1.xml", + "items": [ + { + "itemType": "journalArticle", + "title": "The Arabic Adventures of Télémaque: Trajectory of a Global Enlightenment Text in the Nahḍah", + "creators": [ + { + "firstName": "Peter", + "lastName": "Hill", + "creatorType": "author" + } + ], + "date": "2018-08-17", + "DOI": "10.1163/1570064x-12341367", + "ISSN": "0085-2376, 1570-064x", + "abstractNote": "Abstract The Marquis de Fénelon’s internationally popular didactic narrative, Les aventures de Télémaque, went through a remarkable number of metamorphoses in the Nahḍah, the Arab world’s cultural revival movement of the long nineteenth century. This article examines two early manuscript translations by Syrian Christian writers in the 1810s, the rhymed prose version by Rifāʿah Rāfiʿ al-Ṭahṭāwī in the 1860s; its rewriting by Shāhīn ʿAṭiyyah in 1885; and Saʿdallāh al-Bustānī’s musical drama of 1869, the basis for performances later in the century by the famous actor Salāmah Ḥijāzī. Placing Télémaque’s Arabic trajectory within its global vogue in the Enlightenment suggests ways of reading the Nahḍah between theories of world literature and ‘transnational mass-texts’, and more specific local histories of translation and literary adaptation. The ambiguity of Télémaque, its hybrid and transitional form, was important to its success in milieux facing analogous kinds of hybridity and transition—among them those of the Arab Nahḍah.", + "issue": "3", + "language": "eng", + "libraryCatalog": "brill.com", + "pages": "171-203", + "publicationTitle": "Journal of Arabic Literature", + "shortTitle": "The Arabic Adventures of Télémaque", + "url": "https://brill.com/view/journals/jal/49/3/article-p171_1.xml", + "volume": "49", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Arab theater" + }, + { + "tag": "Beirut" + }, + { + "tag": "Cairo" + }, + { + "tag": "Enlightenment" + }, + { + "tag": "Fénelon" + }, + { + "tag": "Nahḍah" + }, + { + "tag": "adaptation" + }, + { + "tag": "translation" + }, + { + "tag": "world literature" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://brill.com/edcollbook/title/58302", + "items": [ + { + "itemType": "book", + "title": "Encyclopaedia of Islam - Three 2021-3", + "creators": [ + { + "firstName": "Kate", + "lastName": "Fleet", + "creatorType": "editor" + }, + { + "firstName": "Gudrun", + "lastName": "Krämer", + "creatorType": "editor" + }, + { + "firstName": "Denis", + "lastName": "Matringe", + "creatorType": "editor" + }, + { + "firstName": "John", + "lastName": "Nawas", + "creatorType": "editor" + }, + { + "firstName": "Everett", + "lastName": "Rowson", + "creatorType": "editor" + } + ], + "date": "2021-04-30", + "ISBN": "9789004435957", + "language": "en", + "libraryCatalog": "brill.com", + "publisher": "Brill", + "url": "https://brill.com/edcollbook/title/58302", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "General" + }, + { + "tag": "Middle East and Islamic Studies" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://brill.com/view/journals/ejjs/15/2/ejjs.15.issue-2.xml", + "items": "multiple" + }, + { + "type": "web", + "url": "https://referenceworks.brill.com/display/entries/EIRO/COM-362360.xml", + "items": [ + { + "itemType": "encyclopediaArticle", + "title": "ABAEV, VASILIĬ IVANOVICH", + "creators": [ + { + "firstName": "Ilya", + "lastName": "Yakubovich", + "creatorType": "author" + } + ], + "encyclopediaTitle": "Encyclopaedia Iranica Online", + "extra": "DOI: 10.1163/2330-4804_EIRO_COM_362360", + "language": "en", + "libraryCatalog": "referenceworks.brill.com", + "url": "https://referenceworks.brill.com/display/entries/EIRO/COM-362360.xml", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://bibliographies.brill.com/BSLO/items/", + "defer": true, + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/Brukerhandboken.js b/translators/Brukerhandboken.js new file mode 100644 index 0000000..8de533d --- /dev/null +++ b/translators/Brukerhandboken.js @@ -0,0 +1,153 @@ +{ + "translatorID": "6c94ba9a-8639-4f58-bea3-076f774cf3a1", + "label": "Brukerhåndboken", + "creator": "Sondre Bogen-Straume", + "target": "https://brukerhandboken\\.miraheze\\.org/", + "minVersion": "5", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2024-06-27 16:03:43" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2024 Sondre Bogen-Straume + + 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) { + if (url.includes('/wiki/') && doc.querySelector('.printfooter a[href*="oldid="]')) { + return 'encyclopediaArticle'; + } + return false; +} + +async function doWeb(doc, url) { + await scrape(doc, url); +} + +async function scrape(doc, url = doc.location.href) { + let translator = Zotero.loadTranslator('web'); + // Wikipedia + translator.setTranslator('e5dc9733-f8fc-4c00-8c40-e53e0bb14664'); + translator.setDocument(doc); + + translator.setHandler('itemDone', (_obj, item) => { + item.encyclopediaTitle = 'Brukerhåndboken'; + item.rights = 'Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International'; + item.complete(); + }); + await translator.translate(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://brukerhandboken.miraheze.org/wiki/Brukermedvirkning", + "items": [ + { + "itemType": "encyclopediaArticle", + "title": "Brukermedvirkning", + "creators": [], + "date": "2024-05-01T08:31:53Z", + "abstractNote": "Informasjon om brukermedvirkning her.", + "encyclopediaTitle": "Brukerhåndboken", + "extra": "Page Version ID: 912", + "language": "nb", + "libraryCatalog": "Brukerhåndboken", + "rights": "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International", + "url": "https://brukerhandboken.miraheze.org/wiki/Brukermedvirkning?oldid=912", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html", + "snapshot": true + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://brukerhandboken.miraheze.org/wiki/Forside", + "items": [ + { + "itemType": "encyclopediaArticle", + "title": "Forside", + "creators": [], + "date": "2024-05-04T17:20:37Z", + "encyclopediaTitle": "Brukerhåndboken", + "extra": "Page Version ID: 933", + "language": "nb", + "libraryCatalog": "Brukerhåndboken", + "rights": "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International", + "url": "https://brukerhandboken.miraheze.org/wiki/Forside?oldid=933", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html", + "snapshot": true + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://brukerhandboken.miraheze.org/wiki/Ord_og_forkortelser", + "items": [ + { + "itemType": "encyclopediaArticle", + "title": "Ord og forkortelser", + "creators": [], + "date": "2024-06-13T18:54:19Z", + "abstractNote": "Databaseoppføring: Ord og forkortelser - For brukerrepresentanter i helsetjenesten (Q1)\nOrd og forkortelser er en ordbok for brukerrepresentanter i helsetjenesten. Den inneholder ord og forkortelser som brukes hyppig i helsevesenet, og som er som er nyttig å kunne for brukerrepresentanter i helse- og omsorgstjenesten. Innholdet er kurert fra ulike nettsider, dokumenter og liknende. Det er altså ikke jeg som har skrevet alle forklaringene. Henvisning til kildene for tekstene (hvor de er hentet fra) ble når jeg startet på listen ikke tatt med da jeg ikke planla å gjøre den offentlig. Jeg tar nå med kilde i nye oppføringer der det er relevant.\n\nListen er sortert alfabetisk og ment brukt elektronisk da det finnes lenker i tekstene.\nVed forslag til nye ord og forkortelser bruk dette skjemaet: Send inn nytt ord (Airtable) eller e-post. \nVed forslag til endringer eller du har spørsmål ta gjerne kontakt med meg på e-post.\n\nLista er sortert alfabetisk og ment brukt elektronisk da det finnes lenker i tekstene. Noen forkortelser er det brukt punktum.\nLast ned som PDF her.\n\n{{#unlinkedwikibase| id=Q1 }}\n\nOpprettet:\nMal:History-user", + "encyclopediaTitle": "Brukerhåndboken", + "extra": "Page Version ID: 1640", + "language": "nb", + "libraryCatalog": "Brukerhåndboken", + "rights": "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International", + "url": "https://brukerhandboken.miraheze.org/wiki/Ord_og_forkortelser?oldid=1640", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html", + "snapshot": true + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Bryn Mawr Classical Review.js b/translators/Bryn Mawr Classical Review.js new file mode 100644 index 0000000..fa3d5dc --- /dev/null +++ b/translators/Bryn Mawr Classical Review.js @@ -0,0 +1,303 @@ +{ + "translatorID": "635c1246-e0c8-40a0-8799-a73a0b013ad8", + "label": "Bryn Mawr Classical Review", + "creator": "Michael Berkowitz, John Muccigrosso, and Abe Jellinek", + "target": "^https?://bmcr\\.brynmawr\\.edu/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-06-22 05:27:16" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + Copyright © 2016-2021 Michael Berkowitz, John Muccigrosso, and Abe Jellinek + 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) { + if (url.match(/\d\/?$/) && doc.querySelector('.entry-title')) { + return "journalArticle"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('a.ref-wrapper'); + for (var i = 0; i < rows.length; i++) { + var href = rows[i].href; + var title = ZU.trimInternal(text(rows[i], '.ref-title')); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (!items) { + return; + } + var articles = []; + for (var i in items) { + articles.push(i); + } + ZU.processDocuments(articles, scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + let item = new Zotero.Item("journalArticle"); + + let bmcrID = text(doc, '.ref-id').replace(/^BMCR /, ''); + + let title = text(doc, '.entry-title'); + // trim BMCR ID off the beginning when present + item.title = "Review of: " + + ZU.trimInternal(title).replace(/^\d{2,4}\.\d{1,2}\.\d{1,2}, /, ''); + item.shortTitle = ''; + + let authors = doc.querySelectorAll('.meta-affiliation[itemprop="author"] [itemprop="name"]'); + for (let author of authors) { + item.creators.push(ZU.cleanAuthor(author.textContent, "author")); + } + + let reviewedAuthors = doc.querySelectorAll('.entry-citation [itemprop="author"]'); + for (let author of reviewedAuthors) { + item.creators.push(ZU.cleanAuthor(author.textContent, "reviewedAuthor")); + } + + item.date = ZU.strToISO(attr(doc, 'meta[itemprop="datePublished"]', 'content')); + item.extra = "BMCR ID: " + bmcrID; + + item.publicationTitle = "Bryn Mawr Classical Review"; + item.journalAbbreviation = "Bryn Mawr Class. Rev."; + item.ISSN = "1055-7660"; + item.url = url; + item.attachments.push({ + document: doc, + title: "Full Text Snapshot" + }); + + item.complete(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://bmcr.brynmawr.edu/2010/2010.01.02", + "items": [ + { + "itemType": "journalArticle", + "title": "Review of: Sallust: The War Against Jugurtha. Aris and Phillips Classical Texts", + "creators": [ + { + "firstName": "Christina S.", + "lastName": "Kraus", + "creatorType": "author" + }, + { + "firstName": "Michael", + "lastName": "Comber", + "creatorType": "reviewedAuthor" + }, + { + "firstName": "Catalina", + "lastName": "Balmaceda", + "creatorType": "reviewedAuthor" + } + ], + "date": "2010-01-02", + "ISSN": "1055-7660", + "extra": "BMCR ID: 2010.01.02", + "journalAbbreviation": "Bryn Mawr Class. Rev.", + "libraryCatalog": "Bryn Mawr Classical Review", + "publicationTitle": "Bryn Mawr Classical Review", + "url": "https://bmcr.brynmawr.edu/2010/2010.01.02", + "attachments": [ + { + "title": "Full Text Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://bmcr.brynmawr.edu/2013/2013.01.44", + "items": [ + { + "itemType": "journalArticle", + "title": "Review of: The Classical Tradition", + "creators": [ + { + "firstName": "Christina S.", + "lastName": "Kraus", + "creatorType": "author" + }, + { + "firstName": "Anthony", + "lastName": "Grafton", + "creatorType": "reviewedAuthor" + }, + { + "firstName": "Glenn W.", + "lastName": "Most", + "creatorType": "reviewedAuthor" + }, + { + "firstName": "Salvatore", + "lastName": "Settis", + "creatorType": "reviewedAuthor" + } + ], + "date": "2013-01-30", + "ISSN": "1055-7660", + "extra": "BMCR ID: 2013.01.44", + "journalAbbreviation": "Bryn Mawr Class. Rev.", + "libraryCatalog": "Bryn Mawr Classical Review", + "publicationTitle": "Bryn Mawr Classical Review", + "url": "https://bmcr.brynmawr.edu/2013/2013.01.44", + "attachments": [ + { + "title": "Full Text Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://bmcr.brynmawr.edu/Archive/", + "items": "multiple" + }, + { + "type": "web", + "url": "https://bmcr.brynmawr.edu/1999/1999.11.02", + "items": [ + { + "itemType": "journalArticle", + "title": "Review of: Epic traditions in the contemporary world : the poetics of community", + "creators": [ + { + "firstName": "James V.", + "lastName": "Morrison", + "creatorType": "author" + }, + { + "firstName": "Margaret", + "lastName": "Beissinger", + "creatorType": "reviewedAuthor" + }, + { + "firstName": "Jane", + "lastName": "Tylus", + "creatorType": "reviewedAuthor" + }, + { + "firstName": "Susanne", + "lastName": "Wofford", + "creatorType": "reviewedAuthor" + } + ], + "date": "1999-11-02", + "ISSN": "1055-7660", + "extra": "BMCR ID: 1999.11.02", + "journalAbbreviation": "Bryn Mawr Class. Rev.", + "libraryCatalog": "Bryn Mawr Classical Review", + "publicationTitle": "Bryn Mawr Classical Review", + "url": "https://bmcr.brynmawr.edu/1999/1999.11.02", + "attachments": [ + { + "title": "Full Text Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://bmcr.brynmawr.edu/1998/1998.01.04/", + "items": [ + { + "itemType": "journalArticle", + "title": "Review of: Athens and Persians in the Fifth Century BC: A Study in Cultural Receptivity", + "creators": [ + { + "firstName": "Balbina", + "lastName": "Baebler", + "creatorType": "author" + }, + { + "firstName": "Margaret Christina", + "lastName": "Miller", + "creatorType": "reviewedAuthor" + } + ], + "date": "1998-01-04", + "ISSN": "1055-7660", + "extra": "BMCR ID: 1998.01.04", + "journalAbbreviation": "Bryn Mawr Class. Rev.", + "libraryCatalog": "Bryn Mawr Classical Review", + "publicationTitle": "Bryn Mawr Classical Review", + "url": "https://bmcr.brynmawr.edu/1998/1998.01.04/", + "attachments": [ + { + "title": "Full Text Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://bmcr.brynmawr.edu/?s=cicero", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/Bundesgesetzblatt.js b/translators/Bundesgesetzblatt.js new file mode 100644 index 0000000..8fd1837 --- /dev/null +++ b/translators/Bundesgesetzblatt.js @@ -0,0 +1,231 @@ +{ + "translatorID": "e23afbe8-b5cb-42cc-af90-e915b2c00de2", + "label": "Bundesgesetzblatt", + "creator": "Philipp Zumstein", + "target": "^https?://www\\.bgbl\\.de/", + "minVersion": "4.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2017-07-22 20:35:31" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2014 Philipp Zumstein + + 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 ***** +*/ + + +//Disclaimer: Single Documents and Browsing is supported +//(not the search, becauses there it was not clear how to +//receive the correct, stable url for the processDocuments) + +function detectWeb(doc, url) { + //we have to listen to dom changes for the correct icon: + var contentDiv = doc.getElementById('xaver_component_Text_0');//txtcontent topUB + if (contentDiv) { + Z.monitorDOMChanges(contentDiv, {childList: true}); + } + + if (onTextView(doc) && doc.getElementById('PDFcontainer') && extractTitle(doc)) {//single item + return "journalArticle"; + } else if (getSearchResults(doc, true)) { + return "multiple"; + } +} + +function onTextView(doc) { + if (doc.getElementById('showTextClickable')) { + return doc.getElementById('showTextClickable').classList.contains('on'); + } else { + return false; + } +} + +//extract the title for articles +//but returns false for complete issue and table of contents +//(used in detectWeb and scrape) +function extractTitle(doc) { + if (doc.getElementsByClassName('ubLast').length>0) { + var title = doc.getElementsByClassName('ubLast')[0].getAttribute('title'); + if (!title || title == 'Komplette Ausgabe' || title == 'Inhaltsverzeichnis') { + return false + } else { + return title; + } + } else { + return false; + } +} + +//for testing in detectWeb use true for checkOnly +//for the items in doWeb use false for checkOnly +//then the items will be an object containing the href/title pairs +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = ZU.xpath(doc, '//span[contains(@class,"xaver-link")]/a');//for search |//div[contains(@class,"HitContext")]/a + for (var i=0; i4) { + var infoArray = pdfinfo.split('/'); + item.publicationTitle = infoArray[1]; + item.date = infoArray[2];//can be overwritten in cleanup part + item.issue = infoArray[3]; + var pdfName = infoArray[4]; + var parts = pdfName.split('s'); + //e.g. parts[0] = bgbl149 (i.e. BGBl Teil 1, 1949) --> no new information + // parts[1] = 0001.pdf (i.e. article starts on page 1) + item.pages = parts[1].replace(/\D/g,'').replace(/^0+/,''); + + item.url = 'http://www.bgbl.de/xaver/bgbl/start.xav?startbk=Bundesanzeiger_BGBl&jumpTo='+pdfName; + var embeddedPdf = ZU.xpathText(doc, '//div[@id="PDFcontainer"]/iframe/@src'); + //e.g. media.xav/bgbl117s2262_75530.pdf?SID=&name=A730335D9081EC7D0035E5213AFA9AF8%2Fbgbl117s2262_75530.pdf&iid=75530 + var m = embeddedPdf.match(/&name=([^&]+)/); + if (m) { + var pdfLink = '/xaver/bgbl/media/' + decodeURIComponent(m[1]); + //Z.debug(pdfLink); + item.attachments.push({ + title: 'Full Text PDF', + url: pdfLink, + mimeType: 'application/pdf' + }); + } + } else { + item.publicationTitle = doc.getElementsByClassName('ub2')[0].getAttribute('title'); + item.date = doc.getElementsByClassName('ub3')[0].getAttribute('title'); + item.issue = doc.getElementsByClassName('ub4')[0].getAttribute('title'); + } + + //cleanup + if (item.issue.indexOf('vom')>-1) {//e.g. Nr. 47 vom 17.10.2014 + var parts = item.issue.split('vom'); + item.issue = parts[0].replace('Nr.',''); + var dateparts = ZU.trim(parts[1]).split('.'); + item.date = dateparts[2]+'-'+dateparts[1]+'-'+dateparts[0]; + } + + item.complete(); + +}/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.bgbl.de/xaver/bgbl/start.xav?startbk=Bundesanzeiger_BGBl&jumpTo=bgbl114s1602.pdf#__bgbl__%2F%2F*%5B%40attr_id%3D%27bgbl114s1602.pdf%27%5D__1500114233404", + "items": [ + { + "itemType": "journalArticle", + "title": "Sechsundfünfzigste Verordnung zur Durchführung des § 172 des Bundesentschädigungsgesetzes", + "creators": [], + "date": "2014-10-17", + "issue": "47", + "libraryCatalog": "Bundesgesetzblatt", + "pages": "1602", + "publicationTitle": "Bundesgesetzblatt Teil I", + "url": "http://www.bgbl.de/xaver/bgbl/start.xav?startbk=Bundesanzeiger_BGBl&jumpTo=bgbl114s1602.pdf", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.bgbl.de/xaver/bgbl/start.xav?startbk=Bundesanzeiger_BGBl&jumpTo=bgbl149s0001.pdf#__bgbl__%2F%2F*%5B%40attr_id%3D%27bgbl149s0001.pdf%27%5D__1500114236442", + "items": [ + { + "itemType": "journalArticle", + "title": "Grundgesetz für die Bundesrepublik Deutschland vom 23. Mai 1949", + "creators": [], + "date": "1949-05-23", + "issue": "1", + "libraryCatalog": "Bundesgesetzblatt", + "pages": "1", + "publicationTitle": "Bundesgesetzblatt Teil I", + "url": "http://www.bgbl.de/xaver/bgbl/start.xav?startbk=Bundesanzeiger_BGBl&jumpTo=bgbl149s0001.pdf", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ \ No newline at end of file diff --git a/translators/Business Standard.js b/translators/Business Standard.js new file mode 100644 index 0000000..2553bfd --- /dev/null +++ b/translators/Business Standard.js @@ -0,0 +1,151 @@ +{ + "translatorID": "e8d40f4b-c4c9-41ca-a59f-cf4deb3d3dc5", + "label": "Business Standard", + "creator": "Sebastian Karcher", + "target": "^https?://www\\.business-standard\\.com", + "minVersion": "2.1.9", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2016-11-01 18:25:24" +} + +/* FW LINE 59:b820c6d */ function flatten(t){var e=new Array;for(var i in t){var r=t[i];r instanceof Array?e=e.concat(flatten(r)):e.push(r)}return e}var FW={_scrapers:new Array};FW._Base=function(){this.callHook=function(t,e,i,r){if("object"==typeof this.hooks){var n=this.hooks[t];"function"==typeof n&&n(e,i,r)}},this.evaluateThing=function(t,e,i){var r=typeof t;if("object"===r){if(t instanceof Array){var n=this.evaluateThing,a=t.map(function(t){return n(t,e,i)});return flatten(a)}return t.evaluate(e,i)}return"function"===r?t(e,i):t},this.makeItems=function(t,e,i,r,n){n()}},FW.Scraper=function(t){FW._scrapers.push(new FW._Scraper(t))},FW._Scraper=function(t){for(x in t)this[x]=t[x];this._singleFieldNames=["abstractNote","applicationNumber","archive","archiveLocation","artworkMedium","artworkSize","assignee","audioFileType","audioRecordingType","billNumber","blogTitle","bookTitle","callNumber","caseName","code","codeNumber","codePages","codeVolume","committee","company","conferenceName","country","court","date","dateDecided","dateEnacted","dictionaryTitle","distributor","docketNumber","documentNumber","DOI","edition","encyclopediaTitle","episodeNumber","extra","filingDate","firstPage","forumTitle","genre","history","institution","interviewMedium","ISBN","ISSN","issue","issueDate","issuingAuthority","journalAbbreviation","label","language","legalStatus","legislativeBody","letterType","libraryCatalog","manuscriptType","mapType","medium","meetingName","nameOfAct","network","number","numberOfVolumes","numPages","pages","patentNumber","place","postType","presentationType","priorityNumbers","proceedingsTitle","programTitle","programmingLanguage","publicLawNumber","publicationTitle","publisher","references","reportNumber","reportType","reporter","reporterVolume","rights","runningTime","scale","section","series","seriesNumber","seriesText","seriesTitle","session","shortTitle","studio","subject","system","thesisType","title","type","university","url","version","videoRecordingType","volume","websiteTitle","websiteType"],this._makeAttachments=function(t,e,i,r){if(i instanceof Array)i.forEach(function(i){this._makeAttachments(t,e,i,r)},this);else if("object"==typeof i){var n=i.urls||i.url,a=i.types||i.type,s=i.titles||i.title,o=i.snapshots||i.snapshot,u=this.evaluateThing(n,t,e),l=this.evaluateThing(s,t,e),c=this.evaluateThing(a,t,e),h=this.evaluateThing(o,t,e);u instanceof Array||(u=[u]);for(var f in u){var p,m,v,d=u[f];p=c instanceof Array?c[f]:c,m=l instanceof Array?l[f]:l,v=h instanceof Array?h[f]:h,r.attachments.push({url:d,title:m,mimeType:p,snapshot:v})}}},this.makeItems=function(t,e,i,r,n){var a=new Zotero.Item(this.itemType);a.url=e;for(var s in this._singleFieldNames){var o=this._singleFieldNames[s];if(this[o]){var u=this.evaluateThing(this[o],t,e);u instanceof Array?a[o]=u[0]:a[o]=u}}var l=["creators","tags"];for(var c in l){var h=l[c],f=this.evaluateThing(this[h],t,e);if(f)for(var p in f)a[h].push(f[p])}this._makeAttachments(t,e,this.attachments,a),r(a,this,t,e),n()}},FW._Scraper.prototype=new FW._Base,FW.MultiScraper=function(t){FW._scrapers.push(new FW._MultiScraper(t))},FW._MultiScraper=function(t){for(x in t)this[x]=t[x];this._mkSelectItems=function(t,e){var i=new Object;for(var r in t)i[e[r]]=t[r];return i},this._selectItems=function(t,e,i){var r=new Array;Zotero.selectItems(this._mkSelectItems(t,e),function(t){for(var e in t)r.push(e);i(r)})},this._mkAttachments=function(t,e,i){var r=this.evaluateThing(this.attachments,t,e),n=new Object;if(r)for(var a in i)n[i[a]]=r[a];return n},this._makeChoices=function(t,e,i,r,n){if(t instanceof Array)t.forEach(function(t){this._makeTitlesUrls(t,e,i,r,n)},this);else if("object"==typeof t){var a=t.urls||t.url,s=t.titles||t.title,o=this.evaluateThing(a,e,i),u=this.evaluateThing(s,e,i),l=u instanceof Array;o instanceof Array||(o=[o]);for(var c in o){var h,f=o[c];h=l?u[c]:u,n.push(f),r.push(h)}}},this.makeItems=function(t,e,i,r,n){if(this.beforeFilter){var a=this.beforeFilter(t,e);if(a!=e)return void this.makeItems(t,a,i,r,n)}var s=[],o=[];this._makeChoices(this.choices,t,e,s,o);var u=this._mkAttachments(t,e,o),l=this.itemTrans;this._selectItems(s,o,function(t){if(t){var e=function(t){var e=t.documentURI,i=l;void 0===i&&(i=FW.getScraper(t,e)),void 0===i||i.makeItems(t,e,u[e],r,function(){})};Zotero.Utilities.processDocuments(t,e,n)}else n()})}},FW._MultiScraper.prototype=new FW._Base,FW.WebDelegateTranslator=function(t){return new FW._WebDelegateTranslator(t)},FW._WebDelegateTranslator=function(t){for(x in t)this[x]=t[x];this.makeItems=function(t,e,i,r,n){var a=this,s=Zotero.loadTranslator("web");s.setHandler("itemDone",function(i,n){r(n,a,t,e)}),s.setDocument(t),this.translatorId?(s.setTranslator(this.translatorId),s.translate()):(s.setHandler("translators",function(t,e){e.length&&(s.setTranslator(e[0]),s.translate())}),s.getTranslators()),n()}},FW._WebDelegateTranslator.prototype=new FW._Base,FW._StringMagic=function(){this._filters=new Array,this.addFilter=function(t){return this._filters.push(t),this},this.split=function(t){return this.addFilter(function(e){return e.split(t).filter(function(t){return""!=t})})},this.replace=function(t,e,i){return this.addFilter(function(r){return r.match(t)?r.replace(t,e,i):r})},this.prepend=function(t){return this.replace(/^/,t)},this.append=function(t){return this.replace(/$/,t)},this.remove=function(t,e){return this.replace(t,"",e)},this.trim=function(){return this.addFilter(function(t){return Zotero.Utilities.trim(t)})},this.trimInternal=function(){return this.addFilter(function(t){return Zotero.Utilities.trimInternal(t)})},this.match=function(t,e){return e||(e=0),this.addFilter(function(i){var r=i.match(t);return void 0===r||null===r?void 0:r[e]})},this.cleanAuthor=function(t,e){return this.addFilter(function(i){return Zotero.Utilities.cleanAuthor(i,t,e)})},this.key=function(t){return this.addFilter(function(e){return e[t]})},this.capitalizeTitle=function(){return this.addFilter(function(t){return Zotero.Utilities.capitalizeTitle(t)})},this.unescapeHTML=function(){return this.addFilter(function(t){return Zotero.Utilities.unescapeHTML(t)})},this.unescape=function(){return this.addFilter(function(t){return unescape(t)})},this._applyFilters=function(t,e){for(i in this._filters){t=flatten(t),t=t.filter(function(t){return void 0!==t&&null!==t});for(var r=0;r0&&a[0])return n}},FW.getScraper=function(t,e){var i=FW.detectWeb(t,e);return FW._scrapers.filter(function(r){return r.evaluateThing(r.itemType,t,e)==i&&r.evaluateThing(r.detect,t,e)})[0]},FW.doWeb=function(t,e){var i=FW.getScraper(t,e);i.makeItems(t,e,[],function(t,e,i,r){e.callHook("scraperDone",t,i,r),t.title||(t.title=""),t.complete()},function(){Zotero.done()}),Zotero.wait()}; + +/* + Business Standard India Translator + Copyright (C) 2012 Sebastian Karcher an Avram Lyon + + This program 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. + + This program 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 this program. If not, see . +*/ + +function detectWeb(doc, url) { return FW.detectWeb(doc, url); } +function doWeb(doc, url) { return FW.doWeb(doc, url); } + +FW.MultiScraper({ +itemType : 'multiple', +detect : FW.Url().match(/\/search\?/), +choices : { + titles : FW.Xpath('//div[contains(@class, "main-cont-left")]//h2/a').text().trim(), + urls : FW.Xpath('//div[contains(@class, "main-cont-left")]//h2/a').key("href") +} +}); + +/** Articles */ +FW.Scraper({ +itemType : 'newspaperArticle', +detect : FW.Xpath('//div[@class="content-main"]//h1'), +title : FW.Xpath('//div[@class="content-main"]//h1').text().trim(), +attachments : [{ url: FW.Url().replace(/node/,"print"), + title: "Business Standard India Snapshot", + type: "text/html" }], +creators : FW.Xpath('//p[contains(@class, "fL")]/span[1]').text().trimInternal().remove(/\|\n?.+/g).cleanAuthor("author"), +date : FW.Xpath('//meta[@itemprop="datePublished"]/@content').text(), +tags : FW.Xpath('//div[@class="related-keyword"]//div[contains(@class, "readmore_tagBG")]').text().split(/\s*,\s*/), +abstractNote : FW.Xpath('//meta[@name="description"]/@content').text(), +publicationTitle : "Business Standard India" +}); + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://www.business-standard.com/article/companies/air-india-unions-withdraw-strike-threat-112033100032_1.html", + "items": [ + { + "itemType": "newspaperArticle", + "title": "Air India unions withdraw strike threat", + "creators": [ + { + "firstName": "B. S.", + "lastName": "Reporter", + "creatorType": "author" + } + ], + "date": "2012-03-31", + "abstractNote": "Read more about Air India unions withdraw strike threat on Business Standard. Air India employees have withdrawn their threat to go on “no pay, no work” strike after the airline on Friday assured them of clearing all pay dues by June end.", + "libraryCatalog": "Business Standard", + "publicationTitle": "Business Standard India", + "url": "http://www.business-standard.com/article/companies/air-india-unions-withdraw-strike-threat-112033100032_1.html", + "attachments": [ + { + "title": "Business Standard India Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + "Air India", + "Companies", + "News", + "Rohit Nandan", + "Strike" + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.business-standard.com/article/opinion/t-n-ninan-make-believe-solutions-112033100081_1.html", + "items": [ + { + "itemType": "newspaperArticle", + "title": "T N Ninan: Make-believe solutions", + "creators": [ + { + "firstName": "T. N.", + "lastName": "Ninan", + "creatorType": "author" + } + ], + "date": "2012-03-31", + "abstractNote": "Read more about T N Ninan: Make-believe solutions on Business Standard. The government has to deliver solutions that work, not indulge in action for the sake of demonstrating lack of paralysis", + "libraryCatalog": "Business Standard", + "publicationTitle": "Business Standard India", + "shortTitle": "T N Ninan", + "url": "http://www.business-standard.com/article/opinion/t-n-ninan-make-believe-solutions-112033100081_1.html", + "attachments": [ + { + "title": "Business Standard India Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + "Coal India", + "Columns", + "Fdi In Retail Trade", + "Kingfisher", + "Lic", + "New Manufacturing Policy", + "Ongc", + "Opinion", + "Power Stations", + "Railway Budget", + "Weekend Ruminations" + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.business-standard.com/india/search_news.php?search=argentina&select=keyword", + "items": "multiple" + } +] +/** END TEST CASES **/ \ No newline at end of file diff --git a/translators/CABI - CAB Abstracts.js b/translators/CABI - CAB Abstracts.js new file mode 100644 index 0000000..059f601 --- /dev/null +++ b/translators/CABI - CAB Abstracts.js @@ -0,0 +1,317 @@ +{ + "translatorID": "a29d22b3-c2e4-4cc0-ace4-6c2326144332", + "label": "CABI - CAB Abstracts", + "creator": "Sebastian Karcher", + "target": "^https?://(www\\.)?cabidirect\\.org/cabdirect", + "minVersion": "3.0.4", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2017-06-14 03:41:30" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2017 Sebastian Karcher + + 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) { + if (url.indexOf('cabdirect/abstract/')>-1 || url.indexOf('cabdirect/FullTextPDF/')>-1) { + //this isn't always right, but getting the item type from the page involves so much guessing as to be meaningless + return "journalArticle"; + } else if (url.indexOf("cabdirect/search") != -1 && getSearchResults(doc, true)) { + return "multiple"; + } +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = ZU.xpath(doc, '//div[@class="list-content"]/h2/a[contains(@href, "/abstract/")]'); + for (var i=0; iAuthor Affiliation: Department of Health Policy and Management, Gillings School of Global Public Health, University of North Carolina at Chapel Hill, Chapel Hill, North Carolina, USA.

Author Email: harsha@unc.edu

" + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cabdirect.org/cabdirect/FullTextPDF/2016/20163134586.pdf", + "items": [ + { + "itemType": "journalArticle", + "title": "Exploring factors associated with recent HIV testing among heterosexuals at high risk for HIV infection recruited with venue-based sampling.", + "creators": [ + { + "lastName": "Gwadz", + "firstName": "M.", + "creatorType": "author" + }, + { + "lastName": "Cleland", + "firstName": "C. M.", + "creatorType": "author" + }, + { + "lastName": "Jenness", + "firstName": "S. M.", + "creatorType": "author" + }, + { + "lastName": "Silverman", + "firstName": "E.", + "creatorType": "author" + }, + { + "lastName": "Hagan", + "firstName": "H.", + "creatorType": "author" + }, + { + "lastName": "Ritchie", + "firstName": "A. S.", + "creatorType": "author" + }, + { + "lastName": "Leonard", + "firstName": "N. R.", + "creatorType": "author" + }, + { + "lastName": "McCright-Gill", + "firstName": "T.", + "creatorType": "author" + }, + { + "lastName": "Martinez", + "firstName": "B.", + "creatorType": "author" + }, + { + "lastName": "Swain", + "firstName": "Q.", + "creatorType": "author" + }, + { + "lastName": "Kutnick", + "firstName": "A.", + "creatorType": "author" + }, + { + "lastName": "Sherpa", + "firstName": "D.", + "creatorType": "author" + } + ], + "date": "2016", + "ISSN": "2155-6113", + "abstractNote": "Annual HIV testing is recommended for high-risk populations in the United States, to identify HIV infections early and provide timely linkage to treatment. However, heterosexuals at high risk for HIV, due to their residence in urban areas of high poverty and elevated HIV prevalence, test for HIV less frequently than other risk groups, and late diagnosis of HIV is common. Yet the factors impeding HIV testing in this group, which is predominantly African American/Black and Latino/Hispanic, are poorly understood. The present study addresses this gap. Using a systematic community-based sampling method, venue-based sampling (VBS), we estimate rates of lifetime and recent (past year) HIV testing among high-risk heterosexuals (HRH), and explore a set of putative multi-level barriers to and facilitators of recent testing, by gender. Participants were 338 HRH African American/Black and Latino/Hispanic adults recruited using VBS, who completed a computerized structured assessment battery guided by the Theory of Triadic Influence, comprised of reliable/valid measures on socio-demographic characteristics, HIV testing history, and multi-level barriers to HIV testing. Logistic regression analysis was used to identify factors associated with HIV testing within the past year. Most HRH had tested at least once (94%), and more than half had tested within the past year (58%), but only 37% tested annually. In both men and women, the odds of recent testing were similar and associated with structural factors (better access to testing) and sexually transmitted infection (STI) testing and diagnosis. Thus VBS identified serious gaps in rates of annual HIV testing among HRH. Improvements in access to high-quality HIV testing and leveraging of STI testing are needed to increase the proportion of HRH testing annually for HIV. Such improvements could increase early detection of HIV, improve the long-term health of individuals, and reduce HIV transmission by increasing rates of viral suppression.", + "issue": "2", + "journalAbbreviation": "Journal of AIDS and Clinical Research", + "language": "English", + "libraryCatalog": "CABI - CAB Abstracts", + "pages": "544", + "publicationTitle": "Journal of AIDS and Clinical Research", + "url": "https://www.cabdirect.org/cabdirect/abstract/20163134586", + "volume": "7", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "Snapshot" + } + ], + "tags": [], + "notes": [ + { + "note": "

Author Affiliation: Center for Drug Use and HIV Research (CDUHR), New York University College of Nursing, 433 First Avenue, Room 748, New York, NY 10010, USA.

Author Email: mg2890@nyu.edu

" + } + ], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/CAOD.js b/translators/CAOD.js new file mode 100644 index 0000000..0022352 --- /dev/null +++ b/translators/CAOD.js @@ -0,0 +1,260 @@ +{ + "translatorID": "d2a9e388-5b79-403a-b4ec-e7099ca1bb7f", + "label": "CAOD", + "creator": "Guy Aglionby", + "target": "^https?://caod\\.oriprobe\\.com/articles/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2018-09-08 13:38:50" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2018 Guy Aglionby + 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) { + if (url.includes('articles/found.htm?')) { + if (getSearchResults(doc, true)) { + return 'multiple'; + } + } else { + return 'journalArticle'; + } +} + +function scrape(doc, url) { + var translator = Zotero.loadTranslator('web'); + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + translator.setHandler('itemDone', function(obj, item) { + // Necessary as author surname comes first and is often capitalised, so Zotero thinks it's actually initials. + let authors = ZU.xpath(doc, '//span[@itemprop="author"]/a'); + item.creators = authors.map(function(author) { + let authorNames = author.text.split(' '); + authorNames[0] = authorNames[0].charAt(0) + authorNames[0].substr(1).toLowerCase(); + return ZU.cleanAuthor(authorNames.reverse().join(' '), 'author'); + }); + + let keywords = ZU.xpath(doc, '//span[@itemprop="headline"]/a'); + item.tags = keywords.map(function (keyword) { + return keyword.textContent; + }); + item.complete(); + }); + translator.translate(); +} + +function getSearchResults(doc, checkOnly) { + let items = {}; + let found = false; + let rows = ZU.xpath(doc, '//div[@class="searchlist"]/a[b]'); + for (let i=0; i. + + ***** END LICENSE BLOCK ***** +*/ + + +function detectWeb(doc, url) { + let path = new URL(url).pathname; + if (path.includes("/search?") && getSearchResults(doc, true)) { + return 'multiple'; + } + else if ((/(news|sports|radio|books|arts|music|life|television|archives)\//.test(path)) && getLD(doc)) { + return "newspaperArticle"; + } + else if (path.includes("/player/")) { + return "videoRecording"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + // Adjust the CSS Selectors + var rows = doc.querySelectorAll('.card.cardListing'); + for (const row of rows) { + var href = row.href; + var title = text(row, 'h3.headline'); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + + +function getLD(doc) { + let ldScript = text(doc, "script[type='application/ld+json']"); + if (ldScript) return JSON.parse(ldScript); + return null; +} + +function getMetaContent(doc, attribute, text) { + return attr(doc.head, 'meta[' + attribute + '="' + text + '"]', 'content'); +} + + +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.language = "en-CA"; + let ld = getLD(doc); + + // only do processing if page has ld + if (ld) { + item.url = getMetaContent(doc, 'property', "og:url"); + + item.title = ld.headline ? ld.headline : ld.name; + if (item.itemType == "videoRecording") { + item.date = ZU.strToISO(ld.uploadDate); + } + else { + item.date = ZU.strToISO(ld.datePublished); + } + item.abstractNote = ld.description; + + item.creators = []; // clear existing authors + // ignore organization authors + if (ld.hasOwnProperty("author") && ld.author[0]['@type'] != "Organization") { + // either single author or multiple comma separated in one entry + if (ld.author.length == 1) { + let authors = ld.author[0].name; + if (authors.includes(',')) { + let authorsList = authors.split(','); + for (const a of authorsList) { + item.creators.push(ZU.cleanAuthor(a, "author")); + } + } + else { + item.creators.push(ZU.cleanAuthor(authors, "author")); + } + } + else { + for (const a of ld.author) { + item.creators.push(ZU.cleanAuthor(a.name, "author")); + } + } + } + + + let siteName = "CBC"; + if (item.itemType != "videoRecording") { + // get department (e.g. News, Sports, Radio) + // remove .ca/ manually, as regex lookbehind doesn't seem to work + let dept = (/\.ca\/\w+(?=\/)/.exec(item.url))[0].replace(".ca/", ""); + // capitalize department + dept = dept[0].toUpperCase() + dept.slice(1); + siteName += " " + dept; + } + item.publicationTitle = siteName; + item.libraryCatalog = "CBC.ca"; + } + item.complete(); + }); + + let em = await translator.getTranslatorObject(); + em.itemType = detectWeb(doc, url); + await em.doWeb(doc, url); +} + +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); + } +} + + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.cbc.ca/news/canada/online-groups-pressuring-youth-self-harm-1.7107885", + "items": [ + { + "itemType": "newspaperArticle", + "title": "Violent online groups are pressuring youth into harming themselves, authorities warn", + "creators": [ + { + "firstName": "Ioanna", + "lastName": "Roumeliotis", + "creatorType": "author" + }, + { + "firstName": "Laurence", + "lastName": "Mathieu-Leger", + "creatorType": "author" + }, + { + "firstName": "Andrew", + "lastName": "Culbert", + "creatorType": "author" + } + ], + "date": "2024-02-09", + "abstractNote": "Authorities in Canada and the U.S. are warning the public about violent online groups that deliberately target vulnerable minors and pressure them into recording or livestreaming self-harm and producing child sexual abuse material.", + "language": "en-CA", + "libraryCatalog": "CBC.ca", + "publicationTitle": "CBC News", + "url": "https://www.cbc.ca/news/canada/online-groups-pressuring-youth-self-harm-1.7107885", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cbc.ca/sports/hockey/nhl/elias-pettersson-contract-extension-canucks-nhl-1.7132138", + "items": [ + { + "itemType": "newspaperArticle", + "title": "Canucks star forward Elias Pettersson signs 8-year contract extension", + "creators": [ + { + "firstName": "Nick", + "lastName": "Wells", + "creatorType": "author" + } + ], + "date": "2024-03-02", + "abstractNote": "The Vancouver Canucks and star centre Elias Pettersson have agreed to an eight-year contract extension, the team announced Saturday. He is second in team scoring this season with 75 points on 29 goals and 46 assists.", + "language": "en-CA", + "libraryCatalog": "CBC.ca", + "publicationTitle": "CBC Sports", + "url": "https://www.cbc.ca/sports/hockey/nhl/elias-pettersson-contract-extension-canucks-nhl-1.7132138", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cbc.ca/player/play/2313671747656", + "items": [ + { + "itemType": "videoRecording", + "title": "If you get pulled over by police this month in Regina, expect to take a breathalyzer test", + "creators": [], + "date": "2024-03-02", + "abstractNote": "Everyone who gets pulled over for any reason will get a test. SGI and police are telling people about the plan because not everyone is aware of a 2018 federal law that allows it. CBC's Darla Ponace has more on what you need to know about mandatory roadside alcohol tests.", + "language": "en-CA", + "libraryCatalog": "CBC.ca", + "runningTime": "82.849", + "url": "https://www.cbc.ca/player/play/2313671747656", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cbc.ca/radio/thecurrent/airport-facial-recognition-biometrics-1.7130000", + "items": [ + { + "itemType": "newspaperArticle", + "title": "Airports want to scan your face to make travelling easier. Privacy experts caution it's not ready for takeoff", + "creators": [ + { + "firstName": "Jason", + "lastName": "Vermes", + "creatorType": "author" + } + ], + "date": "2024-03-03", + "abstractNote": "While airlines and airports say facial recognition can make air travel — an often tedious experience — more efficient and seamless, privacy advocates argue the use of biometric data is fraught and open to abuse.", + "language": "en-CA", + "libraryCatalog": "CBC.ca", + "publicationTitle": "CBC Radio", + "url": "https://www.cbc.ca/radio/thecurrent/airport-facial-recognition-biometrics-1.7130000", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cbc.ca/radio/frequency", + "detectedItemType": false, + "items": [] + }, + { + "type": "web", + "url": "https://www.cbc.ca/news/politics/trudeau-meloni-pro-palestinian-protesters-toronto-1.7132378", + "items": [ + { + "itemType": "newspaperArticle", + "title": "Trudeau's Toronto event with Italy PM Meloni cancelled due to pro-Palestinian protest", + "creators": [ + { + "firstName": "Justin", + "lastName": "Li", + "creatorType": "author" + }, + { + "firstName": "Christian", + "lastName": "Paas-Lang", + "creatorType": "author" + } + ], + "date": "2024-03-03", + "abstractNote": "A Toronto event where Canadian Prime Minister Justin Trudeau was scheduled to host his Italian counterpart was cancelled on Saturday due to security concerns as hundreds of pro-Palestinian protesters gathered outside the venue, a spokesperson for the Prime Minister's Office said.", + "language": "en-CA", + "libraryCatalog": "CBC.ca", + "publicationTitle": "CBC News", + "url": "https://www.cbc.ca/news/politics/trudeau-meloni-pro-palestinian-protesters-toronto-1.7132378", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cbc.ca/music/canadian-reggae-songs-record-labels-1.7116717", + "items": [ + { + "itemType": "newspaperArticle", + "title": "Canadian reggae's past, present and future", + "creators": [ + { + "firstName": "Kelsey", + "lastName": "Adams", + "creatorType": "author" + } + ], + "date": "2024-02-23", + "abstractNote": "From the 1st recording on Canadian soil to the newcomers pushing the genre forward today.", + "language": "en-CA", + "libraryCatalog": "CBC.ca", + "publicationTitle": "CBC Music", + "url": "https://www.cbc.ca/music/canadian-reggae-songs-record-labels-1.7116717", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cbc.ca/life/culture/the-best-card-games-to-play-with-a-standard-deck-1.5836447", + "items": [ + { + "itemType": "newspaperArticle", + "title": "The best card games to play with a standard deck", + "creators": [ + { + "firstName": "Sebastian", + "lastName": "Yūe", + "creatorType": "author" + } + ], + "date": "2020-12-10", + "abstractNote": "This list will have you suggesting card night every chance you get!", + "language": "en-CA", + "libraryCatalog": "CBC.ca", + "publicationTitle": "CBC Life", + "url": "https://www.cbc.ca/life/culture/the-best-card-games-to-play-with-a-standard-deck-1.5836447", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cbc.ca/television/he-landed-a-sitcom-role-on-his-first-audition-i-was-really-hyped-says-scarborough-teen-1.7101522", + "items": [ + { + "itemType": "newspaperArticle", + "title": "He landed a sitcom role on his first audition. 'I was really hyped,' says Scarborough teen", + "creators": [ + { + "firstName": "Russ", + "lastName": "Martin", + "creatorType": "author" + } + ], + "date": "2024-02-05", + "abstractNote": "The new CBC workplace comedy One More Time follows the manager of a second-hand sporting goods shop, DJ, played by comedian D.J. Demers, and the hijinks of his beloved gang of oddball employees. Among the motley crew is Keeran Devkar, a very green first-time associate played by 15-year-old Seran Sathiyaseelan.", + "language": "en-CA", + "libraryCatalog": "CBC.ca", + "publicationTitle": "CBC Television", + "url": "https://www.cbc.ca/television/he-landed-a-sitcom-role-on-his-first-audition-i-was-really-hyped-says-scarborough-teen-1.7101522", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cbc.ca/search?q=Windows%2011§ion=arts&sortOrder=relevance&media=all", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/CCfr (BnF).js b/translators/CCfr (BnF).js new file mode 100644 index 0000000..3d0603c --- /dev/null +++ b/translators/CCfr (BnF).js @@ -0,0 +1,162 @@ +{ + "translatorID": "899d10f5-3f35-40e6-8dfb-f8ee2dfb1849", + "label": "CCfr (BnF)", + "creator": "Sylvain Machefert, Aurimas Vinckevicius", + "target": "^https?://ccfr\\.bnf\\.fr/portailccfr/.*\\b(action=search|menu=menu_view_grappage|search\\.jsp)\\b", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "g", + "lastUpdated": "2014-09-18 14:08:05" +} + +function detectWeb(doc, url) { + if (getSearchResults(doc)) + { + return "multiple"; + } + else if (url.indexOf("menu=menu_view_grappage") != -1) { + return CCFRTypeDoc(doc); + } +} + +function doWeb(doc, url) +{ + var items = getSearchResults(doc); + if (items) + { + Z.selectItems(items, function(selectedItems) { + if (!selectedItems) return true; + + var links = new Array(); + for (var i in selectedItems) { + links.push(getMarcUrl(i)); + } + ZU.processDocuments(links, scrape); + }); + } else { + // Looking for ID + var memRecordId = ZU.xpathText(doc, '(//input[@id="memRecordId"])[1]/@value'); + var urlMarc = getMarcUrl(memRecordId); + if (urlMarc) + { + ZU.processDocuments(urlMarc, scrape); + } + } +} + +function getMarcUrl(memRecordId) +{ + if (match = memRecordId.match(/^([^:]*):(.*)$/)) + { + var url = '/portailccfr/jsp/ccfr/view/'; + if (memRecordId.indexOf('oai') == 0) + { + url = url + "oai/"; + } + url = url + encodeURIComponent(match[1]) + '_pro.jsp?recordId=' + encodeURIComponent(memRecordId); + return url; + } + else + { + return false; + } +} + +function scrape(newDoc, uri) +{ + var translator = Zotero.loadTranslator("import"); + translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); + translator.getTranslatorObject(function (marc) { + + var record = new marc.record(); + + var xpath = '//table/tbody/tr'; + var elmts = newDoc.evaluate(xpath, newDoc, null, XPathResult.ANY_TYPE, null); + while (elmt = elmts.iterateNext()) { + var field = newDoc.evaluate('./th[1]/text()[1]', elmt, null, XPathResult.ANY_TYPE, null).iterateNext().nodeValue; + var ind = newDoc.evaluate('./td[1]/text()[1]', elmt, null, XPathResult.ANY_TYPE, null).iterateNext().nodeValue; + ind = ZU.trimInternal(ind); + var value = newDoc.evaluate('./td[2]', elmt, null, XPathResult.ANY_TYPE, null).iterateNext().textContent; + value = ZU.trimInternal(value); + value = value.replace(/\$/g, marc.subfieldDelimiter); + + if (field == "LABEL") + { + record.leader = value; + } + else + { + record.addField(field, ind, value); + } + } + var newItem = new Zotero.Item(); + record.translate(newItem); + newItem.complete(); + }); +} + +function CCFRTypeDoc(doc) +{ + if ( (ZU.xpathText(doc, "//div[@class='notice-contenu']")) && (ZU.xpathText(doc, "//div[@id='vueCourante']/table/tbody/tr")) ) + { + var xpath = "//div[@id='vueCourante']/table/tbody/tr"; + var rows = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null); + while (row = rows.iterateNext()) + { + var label = ZU.trimInternal(doc.evaluate("./th[@class='view-field-label-ccfr']", row, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); + + if (label == "Type document") + { + var value = doc.evaluate("./td[@class='view-field-value-ccfr']", row, null, XPathResult.ANY_TYPE, null).iterateNext(); + var valueTxt = ZU.trimInternal(value.textContent); + + switch (valueTxt) { + case "Livre": + return "book"; + break; + case "Document électronique": + return "book"; + break; + case "Document sonore": + return "audioRecording"; + break; + case "Images Animées": + return "film"; + case "Carte": + return "map"; + default: + Zotero.debug("Unmanaged doc type : " + valueTxt); + return "book"; + } + } + } + } + else + { + return null; + } +} + +function getSearchResults(doc) { + var items = {}, + rec = doc.getElementsByName('record'); + if (!doc.getElementById('sourceResultsPane')) return false; + + var xpath = "//form[@name='frmSearchResult']/table"; + var rows = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null); + var row; + + var found = false; + + while (row = rows.iterateNext()) + { + found = true; + var id = doc.evaluate(".//td[@class='ident-check']/input[@type='checkbox']", row, null, XPathResult.ANY_TYPE, null).iterateNext().value; + var title = ZU.trimInternal(doc.evaluate(".//td[@class='Ident']/span/a[@title='Voir la Notice']", row, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); + items[id] = title; + } + return found ? items : false; +} diff --git a/translators/CERN Document Server.js b/translators/CERN Document Server.js new file mode 100644 index 0000000..c3b6030 --- /dev/null +++ b/translators/CERN Document Server.js @@ -0,0 +1,277 @@ +{ + "translatorID": "e4b51f32-bb3f-4d37-a46d-083efe534233", + "label": "CERN Document Server", + "creator": "Sebastian Karcher", + "target": "^https?://cds\\.cern\\.ch/(search\\?|collection/|record/)", + "minVersion": "5.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-04-13 01:12:36" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2023 Sebastian Karcher + + 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) { + if (url.includes('/record/')) { + return getItemType(doc); + } + else if (getSearchResults(doc, true)) { + return 'multiple'; + } + return false; +} + +function getItemType(doc) { + var type = text(doc, '.formatRecordHeader').trim(); + // These are the most important one, but could probably be expanded further + switch (type) { + case "Article": + return "journalArticle"; + case "Thesis": + return "thesis"; + case "Report": + return "report"; + case "Book": + case "Books": + return "book"; + case "Preprint": + return "preprint"; + case "Talks": + return "presentation"; + default: + return "document"; + } +} +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('strong>a.titlelink'); + for (let row of rows) { + let href = row.href; + 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) { + var pdfUrl = attr(doc, '#detailedrecordminipanelfile a[href*=".pdf"]', 'href'); + var abstract = attr(doc, 'meta[property="og:description"]', 'content'); + var thesisUniversity = attr(doc, 'meta[name="citation_dissertation_institution"]', 'content'); + // Z.debug(pdfUrl); + let bibUrl = url.replace(/[#?].*/, "") + '/export/hx?ln=en'; + let bibText = await requestText(bibUrl); + bibText = bibText.match(/
([\s\S]+?)<\/pre>/)[1];
+	// Z.debug(bibText)
+	let translator = Zotero.loadTranslator("import");
+	translator.setTranslator('9cb70025-a888-4a29-a210-93ec52da40d4');
+	translator.setString(bibText);
+	translator.setHandler('itemDone', (_obj, item) => {
+		if (pdfUrl) {
+			item.attachments.push({ url: pdfUrl, title: "Full Text PDF", mimeType: "application/pdf" });
+		}
+		delete item.itemID;
+		if (item.itemType == "thesis" && !item.university) {
+			item.university = thesisUniversity;
+		}
+		item.abstractNote = abstract;
+		item.itemType = getItemType(doc);
+		item.extra = "";
+		item.complete();
+	});
+	await translator.translate();
+}
+
+/** BEGIN TEST CASES **/
+var testCases = [
+	{
+		"type": "web",
+		"url": "https://cds.cern.ch/search?ln=en&sc=1&p=testing&action_search=Search&op1=a&m1=a&p1=&f1=&c=Articles+%26+Preprints&c=Books+%26+Proceedings&c=Presentations+%26+Talks&c=Periodicals+%26+Progress+Reports&c=Multimedia+%26+Outreach&c=International+Collaborations",
+		"detectedItemType": "multiple",
+		"items": "multiple"
+	},
+	{
+		"type": "web",
+		"url": "https://cds.cern.ch/record/2855572?ln=en",
+		"detectedItemType": "preprint",
+		"items": [
+			{
+				"itemType": "preprint",
+				"title": "A short history of Internet protocols at CERN",
+				"creators": [
+					{
+						"firstName": "Ben",
+						"lastName": "Segal",
+						"creatorType": "author"
+					}
+				],
+				"date": "1995",
+				"libraryCatalog": "CERN Document Server",
+				"place": "Geneva",
+				"repository": "CERN",
+				"url": "https://cds.cern.ch/record/2855572",
+				"attachments": [
+					{
+						"title": "Full Text PDF",
+						"mimeType": "application/pdf"
+					}
+				],
+				"tags": [],
+				"notes": [],
+				"seeAlso": []
+			}
+		]
+	},
+	{
+		"type": "web",
+		"url": "https://cds.cern.ch/collection/Published%20Articles?ln=en",
+		"detectedItemType": "multiple",
+		"items": "multiple"
+	},
+	{
+		"type": "web",
+		"url": "https://cds.cern.ch/record/2855446?ln=de",
+		"detectedItemType": "journalArticle",
+		"items": [
+			{
+				"itemType": "journalArticle",
+				"title": "Production of Σ⁰ Hyperon and Search of Σ⁰ Hypernuclei at LHC with ALICE",
+				"creators": [
+					{
+						"firstName": "Alexander",
+						"lastName": "Borissov",
+						"creatorType": "author"
+					},
+					{
+						"firstName": "Sergei",
+						"lastName": "Solokhin",
+						"creatorType": "author"
+					}
+				],
+				"date": "2023",
+				"DOI": "10.1134/S1063778823010131",
+				"abstractNote": "The first measurements of the transverse momentum ($p_{{{T}}}$) spectra and integrated yields and mean $p_{{T}}$ of $\\Sigma^{0}$ and $\\overline{\\Sigma}^{0}$ hyperons in $pp$ collisions at $\\sqrt{s}=7$ TeV at the LHC are presented. The $\\Sigma^{0}$($\\overline{\\Sigma}^{0}$) is reconstructed via its electromagnetic decay channel $\\Lambda$($\\overline{\\Lambda})+\\gamma$. The $\\Lambda$ ($\\overline{\\Lambda}$) baryon is reconstructed via its decay into $p+\\pi^{-}$ ($\\overline{{{p}}}+\\pi^{+}$), while the photon is detected by exploiting the unique capability of the ALICE detector to measure low-energy photons via conversion into $e^{+}e^{-}$ pairs in the detector material. The yield of $\\Sigma^{0}$ is compared to that of the $\\Lambda$ baryon, which has the same quark content but different isospin. These data contribute to the understanding of hadron production mechanisms and provide a reference for constraining QCD-inspired models and tuning Monte Carlo event generators such as PYTHIA. In addition, the feasibility of a search for a bound state of proton, neutron and $\\Sigma^{0}$($\\Sigma^{0}$ hypernuclei ${}^{3}_{\\Sigma^{0}}$H) is presented, based on the luminosities foreseen for the LHC Runs 3 and 4.",
+				"issue": "6",
+				"libraryCatalog": "CERN Document Server",
+				"pages": "970-975",
+				"publicationTitle": "Phys. At. Nucl.",
+				"url": "https://cds.cern.ch/record/2855446",
+				"volume": "85",
+				"attachments": [],
+				"tags": [],
+				"notes": [],
+				"seeAlso": []
+			}
+		]
+	},
+	{
+		"type": "web",
+		"url": "https://cds.cern.ch/record/2854594?ln=en",
+		"detectedItemType": "report",
+		"items": [
+			{
+				"itemType": "report",
+				"title": "Notes on the machine studies team informal seminars on transitional phenomena",
+				"creators": [
+					{
+						"firstName": "O",
+						"lastName": "Barbalat",
+						"creatorType": "author"
+					}
+				],
+				"date": "1968",
+				"institution": "CERN",
+				"libraryCatalog": "CERN Document Server",
+				"place": "Geneva",
+				"url": "https://cds.cern.ch/record/2854594",
+				"attachments": [
+					{
+						"title": "Full Text PDF",
+						"mimeType": "application/pdf"
+					}
+				],
+				"tags": [],
+				"notes": [],
+				"seeAlso": []
+			}
+		]
+	},
+	{
+		"type": "web",
+		"url": "https://cds.cern.ch/record/2854931?ln=en",
+		"detectedItemType": "thesis",
+		"items": [
+			{
+				"itemType": "thesis",
+				"title": "Pathlength-dependent jet quenching in the quark–gluon plasma at ALICE",
+				"creators": [
+					{
+						"firstName": "Caitlin",
+						"lastName": "Beattie",
+						"creatorType": "author"
+					}
+				],
+				"date": "2023",
+				"abstractNote": "At extremely high temperatures, the quarks and gluons that compose the fundamental building blocks of our universe undergo a phase transition from stable hadronic matter to become a deconfined quark--gluon plasma (QGP). One way to study this medium is through collisions of heavy ions, where extraordinarily high energy densities produce just such a deconfined state. Of particular interest are jets, collimated showers of hadrons that originate early in the collision and undergo modification as they traverse the QGP, thus probing the medium's properties and enabling the study of quantum chromodynamics at multiple scales. Notably, jets lose energy as they propagate through the medium, the pathlength dependence of which remains an open question. The answer is of significant interest, however, given that quantitative constraints on this dependence are closely related to the underlying mechanisms that drive jet quenching phenomena. This thesis will discuss the first measurement of jets using a technique known as event-shape engineering (ESE), a measurement made in an effort to constrain the pathlength dependence of jet energy loss. For this thesis, charged jets were measured in Pb--Pb collisions using the ALICE detector at the CERN Large Hadron Collider. These jets were then classified according to their angle with respect to the event plane, as well as the shape of the event that they traversed. No sensitivity of the jet spectra to the event shape was observed; however, the yields were seen to be dependent on the event-plane angle. Moreover, this dependence was stronger for highly-elliptical events and weaker for highly-isotropic events. Such results are consistent with descriptions of pathlength distributions that were studied in Trajectum and the assumption that jets lose energy in a pathlength-dependent manner. Further theoretical models are required to extract quantitative constraints from this study.",
+				"libraryCatalog": "CERN Document Server",
+				"university": "Yale University (US)",
+				"url": "https://cds.cern.ch/record/2854931",
+				"attachments": [
+					{
+						"title": "Full Text PDF",
+						"mimeType": "application/pdf"
+					}
+				],
+				"tags": [],
+				"notes": [
+					{
+						"note": "

Presented 07 Mar 2023

" + } + ], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/CEUR Workshop Proceedings.js b/translators/CEUR Workshop Proceedings.js new file mode 100644 index 0000000..6799c03 --- /dev/null +++ b/translators/CEUR Workshop Proceedings.js @@ -0,0 +1,145 @@ +{ + "translatorID": "5f88a099-564d-4885-9a2a-e72939be3a8c", + "label": "CEUR Workshop Proceedings", + "creator": "Abe Jellinek", + "target": "https?://ceur-ws\\.org/Vol-", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-08-25 17:43:52" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (url.endsWith('.pdf')) { + return 'conferencePaper'; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('ul li[id]'); + for (let row of rows) { + let id = row.id; + let title = ZU.trimInternal(text(row, 'a')); + if (!id || !title) continue; + if (checkOnly) return true; + found = true; + items[id] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) scrapeIDs(doc, url, Object.keys(items)); + }); + } + else { + let id = url.match(/([^/])\.pdf/)[1]; + ZU.processDocuments('index.html', doc => + scrapeIDs(doc, url.replace(/[^/]+\.pdf.*/, ''), [id])); + } +} + +function scrapeIDs(doc, url, ids) { + for (let id of ids) { + let row = doc.getElementById(id); + + let item = new Zotero.Item('conferencePaper'); + item.title = text(row, '.CEURTITLE') + || text(row, '.AUXTITLE').replace(' (invited paper)', '') + || row.textContent; + item.date = ZU.strToISO(text(doc, '.CEURLOCTIME')) + || ZU.strToISO(text(doc, '.CEURPUBDATE')); + item.proceedingsTitle = text(doc, '.CEURFULLTITLE'); + item.conferenceName = text(doc, '.CEURVOLTITLE'); + item.place = text(doc, '.CEURLOCTIME') + .match(/((?:(?:,\s*)?[^\d,]+){0,2})/)[1] + .replace(/,\s*$/, ''); + item.publisher = 'CEUR'; + item.volume = text(doc, '.CEURVOLNR').replace('Vol-', ''); + item.series = 'CEUR Workshop Proceedings'; + item.pages = text(row, '.CEURPAGES'); + item.language = 'en'; + item.ISSN = '1613-0073'; + item.url = url.replace(/[#?].*/, '') + '#' + id; + + for (let author of row.querySelectorAll('.CEURAUTHOR, .AUXAUTHOR')) { + item.creators.push(ZU.cleanAuthor(author.textContent, 'author')); + } + + for (let author of text(row, '.CEURAUTHORS').split(', ')) { + item.creators.push(ZU.cleanAuthor(author, 'author')); + } + + for (let editor of doc.querySelectorAll('.CEURVOLEDITOR')) { + item.creators.push(ZU.cleanAuthor(editor.textContent, 'editor')); + } + + item.attachments.push({ + title: 'Full Text PDF', + mimeType: 'application/pdf', + url: attr(row, 'a', 'href') + }); + + item.complete(); + } +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://ceur-ws.org/Vol-2460/", + "items": "multiple" + }, + { + "type": "web", + "url": "http://ceur-ws.org/Vol-2919/", + "items": "multiple" + }, + { + "type": "web", + "url": "http://ceur-ws.org/Vol-1117/", + "items": "multiple" + }, + { + "type": "web", + "url": "http://ceur-ws.org/Vol-2636/", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/CFF References.js b/translators/CFF References.js new file mode 100644 index 0000000..cb075e3 --- /dev/null +++ b/translators/CFF References.js @@ -0,0 +1,170 @@ +{ + "translatorID": "99A6641F-A8C2-4923-9BBB-0DA87F1E5187", + "label": "CFF References", + "creator": "Sebastian Karcher, Dave Bunten", + "target": "cff", + "minVersion": "5.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 2, + "lastUpdated": "2024-05-17 20:02:13" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2024 Sebastian Karcher, Dave Bunten + + 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 ***** +*/ + +// set a global for spacing purposes under the references key of a citation.cff file +var referencesSpacing = ' '; + +function writeArray(array) { + if (!array.length) return false; + let output = "\n"; + for (let elem of array) { + if (!elem) continue; + output += referencesSpacing + " - " + elem + "\n"; + } + return output.replace(/\n$/, ""); +} + +function writeDOI(itemDOI) { + if (!itemDOI) return false; + let doi = "\n" + referencesSpacing + " - type: doi\n" + referencesSpacing + " value: " + itemDOI; + return doi; +} + +function writeCreators(itemCreators, creatorType="") { + let itemAuthors = []; + for (let creator of itemCreators) { + if (creatorType != "" && ZU.getCreatorsForType(creator.itemType)[0] == creatorType) { + itemAuthors.push(creator); + } + else { + itemAuthors.push(creator); + } + } + if (!itemAuthors.length) return false; + let authors = "\n"; + for (let author of itemAuthors) { + authors += referencesSpacing + " - family-names: " + author.lastName + "\n"; + if (author.firstName) { + authors += referencesSpacing + " given-names: " + author.firstName + "\n"; + } + } + return authors.replace(/\n$/, ""); +} + +function doExport() { + var item; + + Zotero.write('# This CITATION.cff reference content was generated from Zotero.\n'); + Zotero.write('references:\n'); + + while ((item = Zotero.nextItem())) { + var cff = {}; + cff.title = ">-\n" + referencesSpacing + " " + item.title + "\n"; + cff.abstract = item.abstractNote; + cff.type = item.itemType; + cff.license = item.rights; + cff.version = item.versionNumber; + + cff.collection_title = item.proceedingsTitle; + cff.conference = item.conferenceName; + cff.copyright = item.rights; + cff.database = item.libraryCatalog; + cff.date_accessed = item.accessDate; + cff.edition = item.edition; + cff.editors_series = item.series + cff.format = item.format; + cff.institution = item.institution; + cff.isbn = item.ISBN; + cff.issn = item.ISSN; + cff.issue = item.issue; + cff.issue_date = item.issueDate; + cff.journal = item.journalAbbreviation; + cff.languages = writeArray([item.language]); + cff.location = item.archiveLocation; + cff.medium = item.medium; + cff.number = item.number; + cff.number_volumes = item.numberOfVolumes; + cff.pages = item.pages; + // match for pmcid within extras content + if (item.extra && /^pmcid:/i.test(item.extra)) { + cff.pmcid = item.extra.match(/pmcid:\s*(\S+)/); + } + cff.publisher = item.publisher; + cff.repository = item.repository; + cff.section = item.section; + cff.thesis_type = item.thesisType; + cff.volume = item.volume; + cff.url = item.url; + cff.keywords = writeArray(item.tags.map(tag => tag.tag || tag)); + if (["letter", "email", "instantMessage"].includes(item.itemType)) { + cff.senders = writeCreators(item.creators, "author"); + } + else { + cff.authors = writeCreators(item.creators, ZU.getCreatorsForType(item.itemType)[0]); + } + cff.editors = writeCreators(item.creators, "editor"); + cff.recipients = writeCreators(item.creators, "recipient"); + cff.translators = writeCreators(item.creators, "translator"); + + if (item.date) { + // if we have a dataset or software, use date-released field + if (item.itemType == "dataset" || item.itemType == "computerProgram") { + cff["date-released"] = ZU.strToISO(item.date); + } + // include date published for any item types + cff["date-published"] = ZU.strToISO(item.date); + } + // get DOI from Extra for software; this will stop running automatically once software supports DOI + if (!ZU.fieldIsValidForType('DOI', item.itemType) && /^doi:/im.test(item.extra)) { + item.DOI = ZU.cleanDOI(item.extra); + } + cff.identifiers = writeDOI(item.DOI); + + // prep the entry as a new item + Zotero.write(' - '); + + // loop through the cff elements and write output + for (let field in cff) { + if (!cff[field]) continue; + if (field == "title") { + // rely on prep dash for item start above for titles + Zotero.write(field + ": " + cff[field]); + } + else if (field == "abstract") { + // multiline + Zotero.write(referencesSpacing + field + ": |" + cff[field].replace(/^|\n/g, "\n" + referencesSpacing + " ") + "\n"); + } + else { + Zotero.write(referencesSpacing + field.replace("_", "-") + ": " + cff[field] + "\n"); + } + } + } +} + +/** BEGIN TEST CASES **/ +var testCases = [ +] +/** END TEST CASES **/ diff --git a/translators/CFF.js b/translators/CFF.js new file mode 100644 index 0000000..8ce6213 --- /dev/null +++ b/translators/CFF.js @@ -0,0 +1,113 @@ +{ + "translatorID": "e782b521-99ed-47c7-b021-62351a0a4f91", + "label": "CFF", + "creator": "Sebastian Karcher", + "target": "cff", + "minVersion": "5.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 2, + "lastUpdated": "2023-05-04 13:21:10" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2023 Sebastian Karcher + + 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 writeKeywords(tags) { + if (!tags.length) return false; + let keywords = "\n"; + for (let tag of tags) { + keywords += " - " + tag.tag + "\n"; + } + return keywords.replace(/\\n$/, ""); +} + +function writeDOI(itemDOI) { + if (!itemDOI) return false; + let doi = "\n - type: doi\n value: " + itemDOI + "\n"; + return doi; +} + +function writeAuthors(itemCreators) { + let itemAuthors = []; + for (let creator of itemCreators) { + if (creator.creatorType == "author" || creator.creatorType == "programmer") { + itemAuthors.push(creator); + } + } + if (!itemAuthors.length) return false; + let authors = "\n"; + for (let author of itemAuthors) { + authors += " - family-names: " + author.lastName + "\n"; + if (author.firstName) { + authors += " given-names: " + author.firstName + "\n"; + } + } + return authors; +} + +function doExport() { + var item; + Zotero.write('# This CITATION.cff file was generated with Zotero.\n'); + // eslint-disable-next-line no-cond-assign + while (item = Zotero.nextItem()) { + // Only use for dataset and software + if (item.itemType != "dataset" && item.itemType != "computerProgram") { + continue; + } + var cff = {}; + cff.title = " >-\n " + item.title; + cff.abstract = item.abstractNote; + cff.type = item.itemType == 'dataset' ? 'dataset' : 'software'; + cff.license = item.rights; + cff.version = item.versionNumber; + cff.url = item.url; + cff.keywords = writeKeywords(item.tags); + cff.authors = writeAuthors(item.creators); + if (item.date) { + cff["date-released"] = ZU.strToISO(item.date); + } + // get DOI from Extra for software; this will stop running automatically once software supports DOI + if (!ZU.fieldIsValidForType('DOI', item.itemType) && /^doi:/i.test(item.extra)) { + item.DOI = ZU.cleanDOI(item.extra); + } + cff.identifiers = writeDOI(item.DOI); + + Zotero.write(`\ncff-version: 1.2.0\nmessage: >-\n If you use this ${cff.type}, please cite it using the metadata from this file.\n`); + for (let field in cff) { + if (!cff[field]) continue; + if (field == "authors" || field == "keywords") { + Zotero.write(field + ": " + cff[field]); + } + else { + Zotero.write(field + ": " + cff[field] + "\n"); + } + } + } +} + +/** BEGIN TEST CASES **/ +var testCases = [ +] +/** END TEST CASES **/ diff --git a/translators/CIA World Factbook.js b/translators/CIA World Factbook.js new file mode 100644 index 0000000..2e224c4 --- /dev/null +++ b/translators/CIA World Factbook.js @@ -0,0 +1,128 @@ +{ + "translatorID": "d9d4822f-f69e-4f31-b094-5324b2a04761", + "label": "CIA World Factbook", + "creator": "Abe Jellinek", + "target": "^https?://www\\.cia\\.gov/the-world-factbook/countries/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-07-20 03:58:54" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (getSearchResults(doc, true)) { + return "multiple"; + } + else if (doc.querySelector('h1.hero-title')) { + return "encyclopediaArticle"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('#index-content-section a[href*="/countries/"]'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + let item = new Zotero.Item('encyclopediaArticle'); + + item.title = text(doc, 'h1.hero-title'); + item.encyclopediaTitle = 'The World Factbook'; + item.publisher = 'Central Intelligence Agency'; + item.date = ZU.strToISO(text(doc, '.header-subsection-date')); + item.url = url; + item.language = 'en'; + item.libraryCatalog = 'CIA.gov'; + + item.attachments.push({ + title: 'Snapshot', + document: doc + }); + + item.complete(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.cia.gov/the-world-factbook/countries/australia/", + "items": [ + { + "itemType": "encyclopediaArticle", + "title": "Australia", + "creators": [], + "date": "2021-07-06", + "encyclopediaTitle": "The World Factbook", + "language": "en", + "libraryCatalog": "CIA.gov", + "publisher": "Central Intelligence Agency", + "url": "https://www.cia.gov/the-world-factbook/countries/australia/", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cia.gov/the-world-factbook/countries/", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/CLACSO.js b/translators/CLACSO.js new file mode 100644 index 0000000..f5d71f8 --- /dev/null +++ b/translators/CLACSO.js @@ -0,0 +1,226 @@ +{ + "translatorID": "a6f95213-468c-4558-94a3-59b2436cbcdd", + "label": "CLACSO", + "creator": "Sebastian Karcher", + "target": "^https?://biblioteca\\.clacso\\.edu\\.ar/gsdl/cgi-bin/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "g", + "lastUpdated": "2013-02-28 14:47:57" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2013 Sebastian Karcher + + 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) { + if (ZU.xpath(doc, '//div[@class="document"]/div[@class="documenttext"]').length>0) return getType(doc); + else if (ZU.xpath(doc, '//div[@class="document"]/div[@class="divbar"]').length>0) return "multiple"; +} + +function cleanAuthorstring(author) { + //removes author function + author = author.replace(/-\s*(Autor\/a|Compilador\/a o Editor\/a)/, ""); + return author +} + +function authorRole(author){ + var role; + //this may be overkill for a function, but may be necessary to add more. + if (author.search(/\-\s*Compilador\/a o Editor\/a/)!=-1) role = "editor"; + else role = "author"; + return role; + } + +function getType (doc){ + var itemType = ZU.xpathText(doc, '//tbody/tr/td[b[contains(text(), "Tipo de documento")]]/following-sibling::td'); + var type; + if (itemType){ + if (itemType.indexOf("Doc. de trabajo")!=-1){ + type= "report"; + } + else if (itemType.indexOf("Capítulo de Libro")!=-1){ + type= "bookSection"; + } + else if (itemType.indexOf("Capítulo de Libro")!=-1){ + type= "bookSection"; + } + else if (itemType.indexOf("Artículo")!=-1){ + type= "journalArticle"; + } + else if (itemType.indexOf("Ponencia")!=-1){ + type= "presentation"; + } + else if (itemType.indexOf("Tesis")!=-1){ + type= "thesis"; + } + else type = "book"; + + return type; + } +} + +function scrape(doc, url) { + + var newItem = new Zotero.Item(getType(doc)); + var title = ZU.xpathText(doc, '//tbody/tr/td[span/b[contains(text(), "Título")]]/following-sibling::td'); + var publication = ZU.xpathText(doc, '//tr/td[@id="bold" and contains(text(), "Revista")]/following-sibling::td'); + var date = ZU.xpathText(doc, '//tbody/tr/td[b[contains(text(), "Fecha")]]/following-sibling::td'); + var identifier = ZU.xpathText(doc, '//tbody/tr/td[b[contains(text(), "Identificador")]]/following-sibling::td/text()'); + var language = ZU.xpathText(doc, '//tbody/tr/td[b[contains(text(), "Idioma")]]/following-sibling::td/text()'); + var publisher = ZU.xpathText(doc, '//tbody/tr/td[b[contains(text(), "Editorial")]]/following-sibling::td'); + var place = ZU.xpathText(doc, '//tbody/tr/td[b[contains(text(), "Ciudad")]]/following-sibling::td'); + var abstract = ZU.xpathText(doc, '//tbody/tr/td[b[contains(text(), "Resumen")]]/following-sibling::td'); + var content = ZU.xpathText(doc, '//tbody/tr/td[b[contains(text(), "Contenidos")]]/following-sibling::td'); + var pages = ZU.xpathText(doc, '//tbody/tr/td[b[contains(text(), "Extensión")]]/following-sibling::td'); + var fulltext = ZU.xpathText(doc, '//tbody/tr/td[b[contains(text(), "URL")]]/following-sibling::td'); + + + //Descripción field has pages, issue and volume + var publication; + var volume; + var issue; + var description = ZU.xpathText(doc, '//tbody/tr/td[b[contains(text(), "Cita Bibliográfica")]]/following-sibling::td'); + if (description) { + //We perform regex acrobatics to maybe parse some of the citation info. It's not great, but better than nothing + publication = description.match(/^(En:)?\s*(.+?)\s*([.\(\,]|Año)/); + volume = description.match(/(Año|vol\.?)\s*([\dIVX]+)/); + issue = description.match(/no\.\s*(\d+)/); + } + + //Authors + var authors = ZU.xpath(doc, '//tbody/tr/td[b[contains(text(), "Autor")]]/following-sibling::td/a'); + var author; + var role; + for (var i in authors) { + role; + //TODO: define more author roles + author = cleanAuthorstring(authors[i].textContent); + role = authorRole(author) + newItem.creators.push(ZU.cleanAuthor(author, role, true)); + } + + + // TAGS + var tags = ZU.xpath(doc, '//tbody/tr/td[b[contains(text(), "Temas")]]/following-sibling::td/a'); + for (var i in tags) { + newItem.tags.push(tags[i].textContent); + } + + //distinguish between page ranges and num of pages + var numPages; + var pagerange; + if (pages){ + if (pages.search(/\sp\./)!=-1){ + numPages = pages.replace(/p\./, ""); + } + else if (pages.search(/pp\./)!=-1){ + pagerange = pages.replace(/pp\./, ""); + } + } + + var ISBN; + var ISSN; + if (identifier){ + if (identifier.indexOf("ISBN")!=-1){ + ISBN = ZU.cleanISBN(identifier) + } + if (identifier.indexOf("ISSN")!=-1){ + ISSN = identifier; + } + + } + + if (fulltext) { + fulltext = fulltext.trim(); + if (fulltext.search(/\.pdf/) != -1) { + newItem.attachments.push({ + url: fulltext, + title: "CLASSO Full Text PDF", + mimeType: "application/pdf" + }) + } else { + newItem.attachments.push({ + url: fulltext, + title: "CLACSO Full Text", + mimeType: "text/html" + }) + } + } + newItem.attachments.push({ + document: doc, + title: "CLACSO Record Snapshot", + mimeType: "text/html" + }) + newItem.title = title; + if (publication) newItem.publication = publication[2]; + newItem.date = date; + newItem.place = place; + newItem.publisher = publisher; + newItem.numPages = numPages; + newItem.pages = pagerange; + if (volume) newItem.volume = volume[2]; + if (issue) newItem.issue = issue[1]; + if (abstract) newItem.abstractNote = abstract.replace(/\n+/g, "; "); + newItem.ISSN = ISSN; + newItem.ISBN = ISBN; + newItem.language = language; + if (content) newItem.notes.push(content); + newItem.complete(); +} + + +function doWeb(doc, url) { + + var articles = new Array(); + var items = {}; + if (detectWeb(doc, url) == "multiple") { + //this currently doesn't do anything as multiple detect is disabled + var rows = ZU.xpath(doc, '//table[@id="toc_top"]/tbody/tr'); + var title; + var link; + for (var i in rows){ + title = ZU.xpathText(rows[i], './td/b'); + link = ZU.xpathText(rows[i], './td/a[contains(@href, "/gsdl/cgi-bin/library.cgi?")]/@href'); + items[link] = title; + } + + Zotero.selectItems(items, function (items) { + if (!items) { + return true; + } + for (var i in items) { + articles.push(i); + } + //Z.debug(articles) + Zotero.Utilities.processDocuments(articles, scrape); + }) + } else { + scrape(doc, url); + } +}/** BEGIN TEST CASES **/ +var testCases = [] +/** END TEST CASES **/ \ No newline at end of file diff --git a/translators/CLASE.js b/translators/CLASE.js new file mode 100644 index 0000000..099486f --- /dev/null +++ b/translators/CLASE.js @@ -0,0 +1,135 @@ +{ + "translatorID": "1dd21245-29cf-434d-b5b8-49eae0a6912a", + "label": "CLASE", + "creator": "Sebastian Karcher", + "target": "^https?://132\\.248\\.9\\.1\\:", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2013-12-07 15:15:58" +} + +function detectWeb(doc, url) { + if (url.indexOf("func=full-set") != -1) return "journalArticle" + else if (url.indexOf("func=short") != -1 || url.indexOf("func=find") != -1) return "multiple"; +} + +function cleanAuthorstring(author) { + //removes author number in parentheses and e-mails + author = author.replace(/\(\d+\)/, "").replace(/[^\s]+@[^\s]+/, "").replace(/\-\s*$/, "") + return author +} + +function scrape(doc, url) { + var newItem = new Zotero.Item("journalArticle"); + var title = ZU.xpathText(doc, '//tr/th[contains(@class, "txtLeft") and contains(text(), "Título")]/following-sibling::td'); + var publication = ZU.xpathText(doc, '//tr/th[contains(@class, "txtLeft") and contains(text(), "Revista")]/following-sibling::td'); + var date = ZU.xpathText(doc, '//tr/th[contains(@class, "txtLeft") and contains(text(), "Año de la revista")]/following-sibling::td'); + var ISSN = ZU.xpathText(doc, '//tr/th[contains(@class, "txtLeft") and contains(text(), "ISSN")]/following-sibling::td'); + var language = ZU.xpathText(doc, '//tr/th[contains(@class, "txtLeft") and contains(text(), "Idioma") and not(contains(text(), "resumen"))]/following-sibling::td'); + var abstract = ZU.xpathText(doc, '//tr/th[contains(@class, "txtLeft") and contains(text(), "Resumen")]/following-sibling::td'); + var fulltext = ZU.xpathText(doc, '//tr/th[contains(@class, "txtLeft") and contains(text(), "Texto completo")]/following-sibling::td'); + //Descripción field has pages, issue and volume + var description = ZU.xpathText(doc, '//tr/th[contains(@class, "txtLeft") and contains(text(), "Descripción")]/following-sibling::td'); + if (description) { + var volume = description.match(/V([^\s]+)/); + var issue = description.match(/N([^\s]+)/); + var pages = description.match(/P([^\s]+)/); + } + + + //Authors and Tags can have multiple rows. In that case the td[1] remains empty we loop through them until that's no longer the case + + var author1 = ZU.xpathText(doc, '//tr/th[contains(@class, "txtLeft") and contains(text(), "Autor")]/following-sibling::td'); + if (author1) newItem.creators.push(ZU.cleanAuthor(cleanAuthorstring(author1), "author", true)) + var authorloop = ZU.xpath(doc, '//tr[td[@id="bold" and contains(text(), "Autor")]]/following-sibling::tr/td[1]') + var author; + for (var i in authorloop) { + if (authorloop[i].textContent.search(/[^\s]/) == -1) { + author = ZU.xpathText(authorloop[i], './following-sibling::td') + if (author.length > 0) newItem.creators.push(ZU.cleanAuthor(cleanAuthorstring(author), "author", true)); + } else { + break + } + } + + + var tag1 = ZU.xpathText(doc, '//tr/th[contains(@class, "txtLeft") and contains(text(), "Palabra Clave")]/following-sibling::td'); + if (tag1) newItem.tags.push(tag1.trim()) + var tagloop = ZU.xpath(doc, '//tr[th[contains(@class, "txtLeft") and contains(text(), "Palabra Clave")]]/following-sibling::tr/td[1]') + var tag; + for (var i in tagloop) { + if (tagloop[i].textContent.search(/[^\s]/) == -1) { + tag = ZU.xpathText(tagloop[i], './following-sibling::td').trim() + if (tag.length > 0) newItem.tags.push(tag); + } else { + break + } + } + + if (fulltext) { + fulltext = fulltext.trim(); + if (fulltext.search(/\.pdf/) != -1) { + newItem.attachments.push({ + url: fulltext, + title: "CLASE Full Text PDF", + mimeType: "application/pdf" + }) + } else { + newItem.attachments.push({ + url: fulltext, + title: "CLASE Full Text", + mimeType: "text/html" + }) + } + } + newItem.attachments.push({ + document: doc, + title: "CLASE Record Snapshot", + mimeType: "text/html" + }) + newItem.title = title; + newItem.publication = publication; + newItem.date = date; + if (pages) newItem.pages = pages[1]; + if (volume) newItem.volume = volume[1]; + if (issue) newItem.issue = issue[1]; + newItem.abstractNote = abstract; + newItem.ISSN = ISSN; + newItem.language = language; + + newItem.complete(); +} + + +function doWeb(doc, url) { + + var articles = new Array(); + var items = {}; + if (detectWeb(doc, url) == "multiple") { + //this currently doesn't do anything as multiple detect is disabled + var titles = doc.evaluate('//tr/td/a[contains(@href, "func=full-set-set")][2]', doc, null, XPathResult.ANY_TYPE, null); + var next_title; + while (next_title = titles.iterateNext()) { + items[next_title.href] = next_title.textContent; + } + + Zotero.selectItems(items, function (items) { + if (!items) { + return true; + } + for (var i in items) { + articles.push(i); + } + Z.debug(articles) + Zotero.Utilities.processDocuments(articles, scrape); + }) + } else { + scrape(doc, url); + } +}/** BEGIN TEST CASES **/ +var testCases = [] +/** END TEST CASES **/ \ No newline at end of file diff --git a/translators/CNKI.js b/translators/CNKI.js new file mode 100644 index 0000000..61d41ac --- /dev/null +++ b/translators/CNKI.js @@ -0,0 +1,731 @@ +{ + "translatorID": "5c95b67b-41c5-4f55-b71a-48d5d7183063", + "label": "CNKI", + "creator": "Aurimas Vinckevicius, Xingzhong Lin, Zoë C. Ma", + "target": "^https?://([^/]+\\.)?cnki\\.net", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-11-27 05:30:22" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + CNKI(China National Knowledge Infrastructure) Translator + Copyright © 2013 Aurimas Vinckevicius + + 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 ***** +*/ + +// Fetches RefWorks records for provided IDs and calls onDataAvailable with resulting text +// ids should be in the form [{dbname: "CDFDLAST2013", filename: "1013102302.nh"}] +function toStdRef(reftext) { + return reftext + .body + .replace("
  • ", "") + .replace("
", "") + .replace("
  • ", "") // divide results + .replace(/
    |\r/g, "\n") + .replace(/vo (\d+)\n/, "VO $1\n") // Divide VO and IS to different line + .replace(/IS (\d+)\nvo/, "IS $1\nVO")// Uppercase VO + .replace(/IS 0(\d+)\n/g, "IS $1\n")// Remove leading 0 + .replace(/VO 0(\d+)\n/g, "VO $1\n") + .replace(/\n+/g, "\n") + .replace(/\n([A-Z][A-Z1-9]\s)/g, "
    $1") + .replace(/\n/g, "") + .replace(/
    /g, "\n") + .replace(/(K1 .*[\u4e00-\u9fa5]) ([a-zA-Z])/g, "$1;$2")// cn keywwords and en keywords + .replace(/\t/g, "") // \t in abstract + .replace( + /^RT\s+Conference Proceeding/gim, + "RT Conference Proceedings" + ) + .replace(/^RT\s+Dissertation\/Thesis/gim, "RT Dissertation") + .replace(/^(A[1-4]|U2)\s*([^\r\n]+)/gm, function (m, tag, authors) { + authors = authors.split(/\s*[;,,]\s*/); // that's a special comma + if (!authors[authors.length - 1].trim()) authors.pop(); + return tag + " " + authors.join("\n" + tag + " "); + }) + .replace(/LA 中文;?/g, "LA zh-CN") + .trim(); +} + +function getIDFromURL(url) { + if (!url) return false; + + var dbname = url.match(/[?&]dbname=([^&#]*)/i); + var filename = url.match(/[?&]filename=([^&#]*)/i); + if (!dbname || !dbname[1] || !filename || !filename[1]) return false; + + return { dbname: dbname[1], filename: filename[1], url: url }; +} + +// 网络首发期刊信息并不能从URL获取dbname和filename信息 +// Get dbname and filename from pre-released article web page. +function getIDFromRef(doc, url) { + let database = attr(doc, '#paramdbname', 'value'); + let filename = attr(doc, '#paramfilename', 'value'); + if (database && filename) { + return { dbname: database, filename: filename, url: url }; + } + else { + return false; + } +} + +// Get dbname and filename from the link target on the "take note" button in +// the doc as a fallback. +// NOTE: As of now (8 Mar 2023) the document sent by CNKI may contain duplicate +// element ids in the buttons row. In addition, for different article sources, +// the buttons may follow different patterns, sometimes lacking all the +// required info. The note-taking button appears more stable across the CNKI +// domains. +function getIDFromNoteTakerLink(doc, url) { + const noteURLString = attr(doc, "li.btn-note a", "href"); + if (!noteURLString) return false; + + const urlParams = new URLSearchParams(new URL(noteURLString).search); + const dbnameValue = urlParams.get("tablename"); + const filenameValue = urlParams.get("filename"); + + if (!dbnameValue || !filenameValue) return false; + + return { dbname: dbnameValue, filename: filenameValue, url: url }; +} + +function getIDFromSearchRow(row) { + var dbcode = attr(row, "a.icon-collect", "data-dbname"); + var filename = attr(row, "a.icon-collect", "data-filename"); + if (dbcode && filename) { + return { dbcode: dbcode, dbname: dbcode, filename: filename }; + } + else { + return false; + } +} + +function getIDFromPage(doc, url) { + return getIDFromURL(url) + || getIDFromRef(doc, url) + || getIDFromNoteTakerLink(doc, url); +} + +function getTypeFromDBName(dbname) { + var dbType = { + CJFQ: "journalArticle", + CJFD: "journalArticle", + CAPJ: "journalArticle", + SJES: "journalArticle", + SJPD: "journalArticle", + SSJD: "journalArticle", + CCJD: "journalArticle", + CDMD: "journalArticle", + CYFD: "journalArticle", + CDFD: "thesis", + CMFD: "thesis", + CLKM: "thesis", + CCND: "newspaperArticle", + CPFD: "conferencePaper", + IPFD: "conferencePaper", + SCPD: "patent" + }; + var db = dbname.substring(0, 4).toUpperCase(); + if (dbType[db]) { + return dbType[db]; + } + else { + return false; + } +} + +function getItemsFromSearchResults(doc, url, itemInfo) { + var iframe = doc.getElementById('iframeResult'); + if (iframe) { + var innerDoc = iframe.contentDocument || iframe.contentWindow.document; + if (innerDoc) { + doc = innerDoc; + } + } + + var links = ZU.xpath(doc, '//tr[not(.//tr) and .//a[@class="fz14"]]'); + var aXpath = './/a[@class="fz14"]'; + if (!links.length) { + links = ZU.xpath(doc, '//table[@class="GridTableContent"]/tbody/tr[./td[2]/a]'); + aXpath = './td[2]/a'; + } + if (!links.length) { + return false; + } + var items = {}; + for (var i = 0, n = links.length; i < n; i++) { + // Z.debug(links[i].innerHTML) + var a = ZU.xpath(links[i], aXpath)[0]; + var title = ZU.xpathText(a, './node()[not(name()="SCRIPT")]', null, ''); + if (title) title = ZU.trimInternal(title); + var id = getIDFromURL(a.href) || getIDFromSearchRow(links[i]); + // pre-released item can not get ID from URL, try to get ID from element.value + if (!id) { + var td1 = ZU.xpath(links[i], './td')[0]; + var tmp = td1.value.split('!'); + id = { dbname: tmp[0], filename: tmp[1], url: a.href }; + } + if (!title || !id) continue; + if (itemInfo) { + itemInfo[a.href] = { id: id }; + } + items[a.href] = title; + } + return items; +} + +function detectWeb(doc, url) { + // Z.debug(doc); + var id = getIDFromPage(doc, url); + var items = getItemsFromSearchResults(doc, url); + var searchResult = doc.querySelector("#ModuleSearchResult"); + if (searchResult) { + Z.monitorDOMChanges(searchResult, { childList: true, subtree: true }); + } + if (id) { + return getTypeFromDBName(id.dbname); + } + else if (items) { + return "multiple"; + } + else { + return false; + } +} + +async function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + var itemInfo = {}; + var items = getItemsFromSearchResults(doc, url, itemInfo); + let selectItems = await Z.selectItems(items); + if (selectItems) { + for (let url in selectItems) { + await scrape(itemInfo[url].id, doc, { url: url }); + } + } + } + else { + await scrape(getIDFromPage(doc, url), doc); + } +} + +async function scrape(id, doc, extraData) { + var { dbname, filename } = id; + var postData = `FileName=${dbname}!${filename}!1!0&DisplayMode=Refworks&OrderParam=0&OrderType=desc&SelectField=&PageIndex=1&PageSize=20&language=&uniplatform=NZKPT&random=0.30585230060685187`; + var refer = `https://kns.cnki.net/dm/manage/export.html?filename=${dbname}!${filename}!1!0&displaymode=NEW&uniplatform=NZKPT`; + var reftext = await request( + 'https://kns.cnki.net/dm/api/ShowExport', + { + method: "POST", + body: postData, + headers: { + Referer: refer + } + } + ); + var translator = Z.loadTranslator('import'); + translator.setTranslator('1a3506da-a303-4b0a-a1cd-f216e6138d86'); // RefWorks Tagged + translator.setString(toStdRef(reftext)); + + translator.setHandler('itemDone', function (obj, newItem) { + // split names + for (var i = 0, n = newItem.creators.length; i < n; i++) { + var creator = newItem.creators[i]; + if (creator.firstName) continue; + + var lastSpace = creator.lastName.lastIndexOf(' '); + var lastMiddleDot = creator.lastName.lastIndexOf('·'); + if (/[A-Za-z]/.test(creator.lastName) && lastSpace !== -1) { + // western name. split on last space + creator.firstName = creator.lastName.substring(0, lastSpace); + creator.lastName = creator.lastName.substring(lastSpace + 1); + } + else if (lastMiddleDot !== -1) { + // translated western name with · as separator + creator.firstName = creator.lastName.substring(0, lastMiddleDot); + creator.lastName = creator.lastName.substring(lastMiddleDot + 1); + } + else { + // Chinese name. first character is last name, the rest are first name + creator.firstName = creator.lastName.substring(1); + creator.lastName = creator.lastName.charAt(0); + } + } + + if (newItem.abstractNote) { + newItem.abstractNote = newItem.abstractNote.replace(/\s*[\r\n]\s*/g, '\n'); + } + + // clean up tags. Remove numbers from end + for (var j = 0, l = newItem.tags.length; j < l; j++) { + newItem.tags[j] = newItem.tags[j].replace(/:\d+$/, ''); + } + + newItem.title = ZU.trimInternal(newItem.title); + if (extraData) { + newItem.url = extraData.url; + } + else { + newItem.url = id.url; + } + + // CN 中国刊物编号,非refworks中的callNumber + // CN in CNKI refworks format explains Chinese version of ISSN + if (newItem.callNumber) { + // newItem.extra = 'CN ' + newItem.callNumber; + newItem.callNumber = ""; + } + // don't download PDF/CAJ on searchResult(multiple) + var webType = detectWeb(doc, id.url); + if (webType && webType != 'multiple') { + newItem.attachments = getAttachments(doc, newItem); + } + newItem.complete(); + }); + translator.translate(); +} + +// get pdf download link +function getPDF(doc, itemType) { + // retrieve PDF links from CNKI oversea + var pdf = itemType == 'thesis' + ? ZU.xpath(doc, "//div[@id='DownLoadParts']/a[contains(text(), 'PDF')]") + : ZU.xpath(doc, "//a[@name='pdfDown']"); + return pdf.length ? pdf[0].href : false; +} + +// caj download link, default is the whole article for thesis. +function getCAJ(doc, itemType) { + // //div[@id='DownLoadParts'] + var caj = itemType == 'thesis' + ? ZU.xpath(doc, "//div[@id='DownLoadParts']/a") + : ZU.xpath(doc, "//a[@name='cajDown']"); + return caj.length ? caj[0].href : false; +} + +// add pdf or caj to attachments, default is pdf +function getAttachments(doc, item) { + var attachments = []; + var pdfurl = getPDF(doc, item.itemType); + var cajurl = getCAJ(doc, item.itemType); + // Z.debug('pdf' + pdfurl); + // Z.debug('caj' + cajurl); + var loginUser = ZU.xpath(doc, "//input[@id='loginuserid']"); + // Z.debug(doc.body.innerHTML); + // Z.debug(loginUser[0].value); + // Z.debug(loginUser.length); + if (loginUser.length && loginUser[0].value) { + if (pdfurl) { + attachments.push({ + title: "Full Text PDF", + mimeType: "application/pdf", + url: pdfurl + }); + } + else if (cajurl) { + attachments.push({ + title: "Full Text CAJ", + mimeType: "application/caj", + url: cajurl + }); + } + } + + return attachments; +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://kns.cnki.net/KCMS/detail/detail.aspx?dbcode=CJFQ&dbname=CJFDLAST2015&filename=SPZZ201412003&v=MTU2MzMzcVRyV00xRnJDVVJMS2ZidVptRmkva1ZiL09OajNSZExHNEg5WE5yWTlGWjRSOGVYMUx1eFlTN0RoMVQ=", + "defer": true, + "items": [ + { + "itemType": "journalArticle", + "title": "基于部分酸水解-亲水作用色谱-质谱的黄芪多糖结构表征", + "creators": [ + { + "lastName": "梁", + "firstName": "图", + "creatorType": "author" + }, + { + "lastName": "傅", + "firstName": "青", + "creatorType": "author" + }, + { + "lastName": "辛", + "firstName": "华夏", + "creatorType": "author" + }, + { + "lastName": "李", + "firstName": "芳冰", + "creatorType": "author" + }, + { + "lastName": "金", + "firstName": "郁", + "creatorType": "author" + }, + { + "lastName": "梁", + "firstName": "鑫淼", + "creatorType": "author" + } + ], + "date": "2014", + "ISSN": "1000-8713", + "abstractNote": "来自中药的水溶性多糖具有广谱治疗和低毒性特点,是天然药物及保健品研发中的重要组成部分。针对中药多糖结构复杂、难以表征的问题,本文以中药黄芪中的多糖为研究对象,采用\"自下而上\"法完成对黄芪多糖的表征。首先使用部分酸水解方法水解黄芪多糖,分别考察了水解时间、酸浓度和温度的影响。在适宜条件(4 h、1.5mol/L三氟乙酸、80℃)下,黄芪多糖被水解为特征性的寡糖片段。接下来,采用亲水作用色谱与质谱联用对黄芪多糖部分酸水解产物进行分离和结构表征。结果表明,提取得到的黄芪多糖主要为1→4连接线性葡聚糖,水解得到聚合度4~11的葡寡糖。本研究对其他中药多糖的表征具有一定的示范作用。", + "issue": "12", + "language": "zh-CN", + "libraryCatalog": "CNKI", + "pages": "1306-1312", + "publicationTitle": "色谱", + "url": "https://kns.cnki.net/KCMS/detail/detail.aspx?dbcode=CJFQ&dbname=CJFDLAST2015&filename=SPZZ201412003&v=MTU2MzMzcVRyV00xRnJDVVJMS2ZidVptRmkva1ZiL09OajNSZExHNEg5WE5yWTlGWjRSOGVYMUx1eFlTN0RoMVQ=", + "volume": "32", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "亲水作用色谱" + }, + { + "tag": "多糖" + }, + { + "tag": "表征" + }, + { + "tag": "质谱" + }, + { + "tag": "部分酸水解" + }, + { + "tag": "黄芪" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://kns.cnki.net/KCMS/detail/detail.aspx?dbcode=CMFD&dbname=CMFD201701&filename=1017045605.nh&v=MDc3ODZPZVorVnZGQ3ZrV3JyT1ZGMjZHYk84RzlmTXFwRWJQSVI4ZVgxTHV4WVM3RGgxVDNxVHJXTTFGckNVUkw=", + "defer": true, + "items": [ + { + "itemType": "thesis", + "title": "黄瓜共表达基因模块的识别及其特点分析", + "creators": [ + { + "lastName": "林", + "firstName": "行众", + "creatorType": "author" + } + ], + "date": "2017", + "abstractNote": "黄瓜(Cucumis sativus L.)是我国最大的保护地栽培蔬菜作物,也是植物性别发育和维管束运输研究的重要模式植物。黄瓜基因组序列图谱已经构建完成,并且在此基础上又完成了全基因组SSR标记开发和涵盖330万个变异位点变异组图谱,成为黄瓜功能基因研究的重要平台和工具,相关转录组研究也有很多报道,不过共表达网络研究还是空白。本实验以温室型黄瓜9930为研究对象,选取10个不同组织,进行转录组测序,获得10份转录组原始数据。在对原始数据去除接头与低质量读段后,将高质量读段用Tophat2回贴到已经发表的栽培黄瓜基因组序列上。用Cufflinks对回贴后的数据计算FPKM值,获得10份组织的24274基因的表达量数据。计算结果中的回贴率比较理想,不过有些基因的表达量过低。为了防止表达量低的基因对结果的影响,将10份组织中表达量最大小于5的基因去除,得到16924个基因,进行下一步分析。共表达网络的构建过程是将上步获得的表达量数据,利用R语言中WGCNA(weighted gene co-expression network analysis)包构建共表达网络。结果得到的共表达网络包括1134个模块。这些模块中的基因表达模式类似,可以认为是共表达关系。不过结果中一些模块内基因间相关性同其他模块相比比较低,在分析过程中,将模块中基因相关性平均值低于0.9的模块都去除,最终得到839个模块,一共11,844个基因。共表达的基因因其表达模式类似而聚在一起,这些基因可能与10份组织存在特异性关联。为了计算模块与组织间的相关性,首先要对每个模块进行主成分分析(principle component analysis,PCA),获得特征基因(module eigengene,ME),特征基因可以表示这个模块所有基因共有的表达趋势。通过计算特征基因与组织间的相关性,从而挑选出组织特异性模块,这些模块一共有323个。利用topGO功能富集分析的结果表明这些特异性模块所富集的功能与组织相关。共表达基因在染色体上的物理位置经常是成簇分布的。按照基因间隔小于25kb为标准。分别对839个模块进行分析,结果发现在71个模块中共有220个cluster,这些cluster 一般有2~5个基因,cluster中的基因在功能上也表现出一定的联系。共表达基因可能受到相同的转录调控,这些基因在启动子前2kb可能会存在有相同的motif以供反式作用元...", + "language": "zh-CN", + "libraryCatalog": "CNKI", + "thesisType": "硕士", + "university": "南京农业大学", + "url": "https://kns.cnki.net/KCMS/detail/detail.aspx?dbcode=CMFD&dbname=CMFD201701&filename=1017045605.nh&v=MDc3ODZPZVorVnZGQ3ZrV3JyT1ZGMjZHYk84RzlmTXFwRWJQSVI4ZVgxTHV4WVM3RGgxVDNxVHJXTTFGckNVUkw=", + "attachments": [], + "tags": [ + { + "tag": "共表达" + }, + { + "tag": "网络" + }, + { + "tag": "转录组" + }, + { + "tag": "黄瓜" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://kns.cnki.net/kcms/detail/detail.aspx?dbcode=CCJD&dbname=CCJDLAST2&filename=ZKSF202002010&uniplatform=NZKPT&v=RM9dl7WiC7a9v7FVB6ov3OwJSXCWzsWIng_BWXok2rj4YFWz9tZ20FRZxDaeDPCm", + "defer": true, + "items": [ + { + "itemType": "journalArticle", + "title": "欧洲陪审团制度新发展:西班牙与俄罗斯的陪审团", + "creators": [ + { + "lastName": "萨曼", + "firstName": "史蒂芬", + "creatorType": "author" + }, + { + "lastName": "高", + "firstName": "一飞", + "creatorType": "author" + } + ], + "date": "2020", + "abstractNote": "<正>一、简介近来再次对俄罗斯(1993)和西班牙(1995)陪审团审判模式进行介绍的原因有两个方面。第一,在废除传统陪审团审判的情况下,要么采取仅由职业法官组成的法院审理案件,要么由职业法官和审讯顾问合议来判断所有的事实问题、法律问题并作出相应判决,这是一种令人惊闻的倒退。", + "issue": "2", + "language": "zh-CN", + "libraryCatalog": "CNKI", + "pages": "193-212", + "publicationTitle": "司法智库", + "shortTitle": "欧洲陪审团制度新发展", + "url": "https://kns.cnki.net/kcms/detail/detail.aspx?dbcode=CCJD&dbname=CCJDLAST2&filename=ZKSF202002010&uniplatform=NZKPT&v=RM9dl7WiC7a9v7FVB6ov3OwJSXCWzsWIng_BWXok2rj4YFWz9tZ20FRZxDaeDPCm", + "volume": "3", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "俄罗斯" + }, + { + "tag": "刑事诉讼程序" + }, + { + "tag": "判决书" + }, + { + "tag": "巴斯克" + }, + { + "tag": "陪审团" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://kns.cnki.net/kcms2/article/abstract?v=aGn3Ey0ZxcAi0XeGEjt5HeH9QvBBKaMwsES4SuFJjIdiexE2qhU8bX2aGBIHriUe6WrMOFyCz6TIuYJGlA_YQUO9h2FJwGt_gZfkHkLHnqVgNK8uMWo5lKYMqxvBPfO6_0Zy21140lIwEFrUw-cJtw==&uniplatform=NZKPT", + "defer": true, + "items": [ + { + "itemType": "journalArticle", + "title": "我国绿色产品认证标识法律制度的路径探析", + "creators": [ + { + "lastName": "曹", + "firstName": "明德", + "creatorType": "author" + } + ], + "date": "2022", + "ISSN": "1001-2397", + "abstractNote": "我国绿色产品认证标识制度框架已初步形成。作为一项法律制度,绿色产品标识及认证中形成了两组法律关系:一是就产品认可认证,在行政主体、认证机构与申请人之间构成公私混合的规制关系;二是就绿色产品标识授权使用,在上述法律关系主体间构成的商业许可关系。两组法律关系的搭建,形成了我国绿色产品认证标识制度的基本格局。制度的具体完善路径是将现行同类环保产品认证标识纳入绿色产品标识与绿色属性产品标识的二元框架内,或吸收,或拆解,或由市场逐步淘汰,最终形成统一的绿色产品认证标识体系。在制度构建过程中,对第三方认证机构的规制成为制度有效运行的关键。参考域外经验,我国应当通过强化认证机构的独立性,平衡认证机构与申请人之间的制约关系,以及通过加强行政监管与社会监督,防止认证权力寻租,充分发挥绿色产品认证标识制度的实践效果。", + "issue": "6", + "language": "zh-CN", + "libraryCatalog": "CNKI", + "pages": "133-145", + "publicationTitle": "现代法学", + "url": "https://kns.cnki.net/kcms2/article/abstract?v=aGn3Ey0ZxcAi0XeGEjt5HeH9QvBBKaMwsES4SuFJjIdiexE2qhU8bX2aGBIHriUe6WrMOFyCz6TIuYJGlA_YQUO9h2FJwGt_gZfkHkLHnqVgNK8uMWo5lKYMqxvBPfO6_0Zy21140lIwEFrUw-cJtw==&uniplatform=NZKPT", + "volume": "44", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "第三方认证" + }, + { + "tag": "绿色产品" + }, + { + "tag": "绿色产品标识" + }, + { + "tag": "绿色产品认证" + }, + { + "tag": "证明商标" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://kns.cnki.net/kcms2/article/abstract?v=aGn3Ey0ZxcCQMiRSLWzbqHFLmF0YiAvOI33I1RqvSIDdZeLKl7q3QL7ioYjCbxuMHo1CSBSG2LYUjI9r30yPonoox-iGbCfgn-YF7W2h79KqPswOTOxrzPV94p2evWa1-zchF2wLCag2WcjSEGNUdSNYdPlVmcGt&uniplatform=NZKPT", + "defer": true, + "items": [ + { + "itemType": "journalArticle", + "title": "环境法典中新污染物环境风险管控的立法思路", + "creators": [ + { + "lastName": "严", + "firstName": "厚福", + "creatorType": "author" + } + ], + "date": "2022", + "ISSN": "1671-7287", + "abstractNote": "我国对常规污染物的治理取得了显著成效,但以有毒有害化学物质的生产和使用为主要来源的新污染物的环境风险仍然较为严峻。当前我国相关环境法律法规和标准中缺乏对新污染物环境风险管控的要求,对于现有化学物质的环境风险管控还存在较为严重的不足。未来环境法典中新污染物环境风险管控立法应当坚持风险预防原则,但风险预防原则并不以追求“零风险”为目标。新污染物环境风险管控立法总体上应当遵循“风险筛查→风险评估→风险管控”的思路。环境风险评估应当聚焦于从科学角度评估新污染物对公众健康和生态环境带来的“风险”本身,不考虑与环境风险无关的经济、社会等因素。确定什么是“不合理的风险”,除了科学判断之外,也需要“正当程序”的加持。风险无法确定时,比照“存在不合理风险”进行管控。在选择风险管控措施时,应当考虑新污染物对公众健康和生态环境的影响程度以及经济、社会等因素。对于新化学物质,应当秉承“除非能证明无害,否则都应当进行适当风险管控”的理念。", + "issue": "5", + "language": "zh-CN", + "libraryCatalog": "CNKI", + "pages": "18-30+115", + "publicationTitle": "南京工业大学学报(社会科学版)", + "url": "https://kns.cnki.net/kcms2/article/abstract?v=aGn3Ey0ZxcCQMiRSLWzbqHFLmF0YiAvOI33I1RqvSIDdZeLKl7q3QL7ioYjCbxuMHo1CSBSG2LYUjI9r30yPonoox-iGbCfgn-YF7W2h79KqPswOTOxrzPV94p2evWa1-zchF2wLCag2WcjSEGNUdSNYdPlVmcGt&uniplatform=NZKPT", + "volume": "21", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "新污染物风险管控" + }, + { + "tag": "环境治理" + }, + { + "tag": "环境法典" + }, + { + "tag": "环境风险评估" + }, + { + "tag": "风险预防原则" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://kns.cnki.net/kcms2/article/abstract?v=aGn3Ey0ZxcBuyOSvEQLm_QauzuszuNvOETrZkPfTUVjXy6wyG6-n2nHmyA70y6TC3IN6i68HMAN2clvthsV7F1ypcjao4RepuYmOZSEVhLK8lN1UAkOxmQkqtJdHoHI1N1gKQDPjuaEbdR6APIJ1sA==&uniplatform=NZKPT&language=CHS", + "defer": true, + "items": [ + { + "itemType": "journalArticle", + "title": "Box-Behnken Design-响应面法优化碱水解人参茎叶三醇皂苷制备人参皂苷Rg2工艺研究", + "creators": [ + { + "lastName": "史", + "firstName": "大臻", + "creatorType": "author" + }, + { + "lastName": "吴", + "firstName": "福林", + "creatorType": "author" + }, + { + "lastName": "谭", + "firstName": "璐", + "creatorType": "author" + }, + { + "lastName": "周", + "firstName": "柏松", + "creatorType": "author" + }, + { + "lastName": "刘", + "firstName": "金平", + "creatorType": "author" + }, + { + "lastName": "李", + "firstName": "平亚", + "creatorType": "author" + }, + { + "lastName": "赖", + "firstName": "思含", + "creatorType": "author" + } + ], + "date": "2022", + "DOI": "10.13863/j.issn1001-4454.2022.01.030", + "ISSN": "1001-4454", + "abstractNote": "目的:利用Box-Behnken Design-响应面法优选制备人参皂苷Rg2的最佳工艺参数。方法:以碱解反应的碱度、温度、时间作为考察因素,人参茎叶三醇皂苷中人参皂苷Rg2含量作为评价指标,运用Design-Expert 8.0.5b软件对工艺参数进行优化并获得最佳工艺参数。结果:经优化得到碱水解人参茎叶三醇皂苷制备人参皂苷Rg2的最佳工艺参数:反应碱度7.4%、反应温度187℃、反应时间5 h。验证试验表明,在此工艺参数下可将人参皂苷Rg2含量提高至9.84%,且工艺稳定。结论:经过优化的工艺可有效提高人参茎叶三醇皂苷中人参皂苷Rg2含量。", + "issue": "1", + "language": "zh-CN", + "libraryCatalog": "CNKI", + "pages": "173-176", + "publicationTitle": "中药材", + "url": "https://kns.cnki.net/kcms2/article/abstract?v=aGn3Ey0ZxcBuyOSvEQLm_QauzuszuNvOETrZkPfTUVjXy6wyG6-n2nHmyA70y6TC3IN6i68HMAN2clvthsV7F1ypcjao4RepuYmOZSEVhLK8lN1UAkOxmQkqtJdHoHI1N1gKQDPjuaEbdR6APIJ1sA==&uniplatform=NZKPT&language=CHS", + "volume": "45", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Box-Behnken Design-响应面法" + }, + { + "tag": "人参皂苷Rg2" + }, + { + "tag": "人参茎叶三醇皂苷" + }, + { + "tag": "工艺优化" + } + ], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/COBISS.js b/translators/COBISS.js new file mode 100644 index 0000000..f23b5a3 --- /dev/null +++ b/translators/COBISS.js @@ -0,0 +1,1945 @@ +{ + "translatorID": "ceace65b-4daf-4200-a617-a6bf24c75607", + "label": "COBISS", + "creator": "Brendan O'Connell", + "target": "^https?://plus\\.cobiss\\.net/cobiss", + "minVersion": "5.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-08-17 18:57:34" +} + +/* + ***** 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) { + // single items may end in an id number that is 6 digits or more + var itemIDURL = /\d{6,}$/; + // detailed view of single items ends in /#full + var fullRecordURL = /#full$/; + if (url.match(itemIDURL) || url.match(fullRecordURL)) { + // capture type of material directly from the catalog page, e.g. "undergraduate thesis" + var typeOfMaterial = doc.querySelector("button#add-biblioentry-to-shelf").getAttribute("data-mat-type"); + if (typeOfMaterial) { + // use translateItemType function to translate catalog material type into a Zotero + // item type, e.g "thesis" + var detectItemType = translateItemType(typeOfMaterial); + if (detectItemType) { + return detectItemType; + } + // if a catalog item type isn't contained in the hash in translateItemType function, + // return Zotero item type 'book', which is by far the most common item type in this catalog. + else { + return 'book'; + } + } + } + else if (getSearchResults(doc, true)) { + return 'multiple'; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('a.title.value'); + + for (let row of rows) { + let href = row.href; + let title = row.innerText; + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function constructRISURL(url) { + // catalog page URL: https://plus.cobiss.net/cobiss/si/sl/bib/107937536 + // RIS URL: https://plus.cobiss.net/cobiss/si/sl/bib/risCit/107937536 + + // capture first part of URL, e.g. https://plus.cobiss.net/cobiss/si/sl/bib/ + const firstRegex = /^(.*?)\/bib\//; + let firstUrl = url.match(firstRegex)[0]; + + // capture item ID, e.g. /92020483 + const secondRegex = /\/([^/]+)$/; + let secondUrl = url.match(secondRegex)[0]; + + // outputs correct RIS URL structure + let risURL = firstUrl + "risCit" + secondUrl; + return risURL; +} + +function constructEnglishURL(url) { + // default catalog page URL: https://plus.cobiss.net/cobiss/si/sl/bib/107937536 + // page with English metadata: https://plus.cobiss.net/cobiss/si/en/bib/107937536 + // most COBISS catalogs follow the format where the language code is two characters e.g. "sl" + // except ones with three languages, e.g.: https://plus.cobiss.net/cobiss/cg/cnr_cyrl/bib/20926212 + // where there are language codes for english, latin montenegrin, and cyrillic montenegrin + const firstPartRegex = /https:\/\/plus\.cobiss\.net\/cobiss\/[a-z]{2}\//; + const endPartRegex = /\/bib\/\S*/; + + const firstPart = url.match(firstPartRegex)[0]; + const endPart = url.match(endPartRegex)[0]; + var englishURL = firstPart + "en" + endPart; + return englishURL; +} + +// in the catalog, too many items are classified in RIS as either BOOK or ELEC, +// including many reports, ebooks, etc, that thus are incorrectly assigned itemType "book" or "webpage" +// when we rely on Zotero RIS translator. This map assigns more accurate itemTypes +// based on "type of material" classification in English catalog, instead of relying on RIS. +// this function also assigns itemType for catalog items with no RIS. +function translateItemType(englishCatalogItemType) { + var catalogItemTypeHash = new Map([ + ['undergraduate thesis', 'thesis'], + ['proceedings', 'conferencePaper'], + ['novel', 'book'], + ['science fiction (prose)', 'book'], + ['book', 'book'], + ['handbook', 'book'], + ['proceedings of conference contributions', 'conferencePaper'], + ['professional monograph', 'report'], + ['scientific monograph', 'book'], + ['textbook', 'book'], + ['e-book', 'book'], + ['picture book', 'book'], + ['treatise, study', 'report'], + ['catalogue', 'book'], + ['master\u0027s thesis', 'thesis'], + ['picture book', 'book'], + ['short stories', 'book'], + ['research report', 'report'], + ['poetry', 'book'], + ['dissertation', 'thesis'], + ['picture book', 'book'], + ['offprint', 'magazineArticle'], + ['guide-book', 'book'], + ['expertise', 'hearing'], // court testimony, e.g. https://plus.cobiss.net/cobiss/si/en/bib/94791683 + ['profess. monogr', 'report'], + ['project documentation', 'report'], + ['antiquarian material', 'book'], // mostly books, e.g. https://plus.cobiss.net/cobiss/si/en/bib/7543093 + ['other lit.forms', 'book'], + ['drama', 'book'], + ['strip cartoon', 'book'], + ['documentary lit', 'book'], + ['encyclopedia', 'book'], + ['exercise book', 'book'], + ['educational material', 'book'], + ['review', 'report'], + ['statistics', 'report'], + ['legislation', 'statute'], + ['essay', 'book'], + ['final paper', 'thesis'], + ['standard', 'book'], + ['specialist thesis', 'book'], + ['aphorisms, proverbs', 'book'], + ['humour, satire, parody', 'book'], + ['examin. paper', 'report'], + ['annual', 'report'], + ['yearly', 'report'], + ['documentary lit', 'book'], + ['folk literature', 'book'], + ['patent', 'patent'], + ['regulations', 'report'], + ['conf. materials', 'conferencePaper'], + ['radio play', 'book'], + ['letters', 'book'], + ['literature survey/review', 'report'], + ['statute', 'statute'], + ['matura paper', 'thesis'], + ['seminar paper', 'thesis'], + ['habilitation', 'thesis'], + ['dramaturgical paper', 'thesis'], + ['article, component part', 'journalArticle'], + ['e-article', 'journalArticle'], + ['periodical', 'book'], + ['monogr. series', 'book'], + ['audio CD', 'audioRecording'], + ['audio cassette', 'audioRecording'], + ['disc', 'audioRecording'], + ['music, sound recording', 'audioRecording'], + ['audio DVD', 'audioRecording'], + ['printed and manuscript music', 'audioRecording'], + ['graphics', 'artwork'], + ['poster', 'artwork'], + ['photograph', 'artwork'], + ['e-video', 'videoRecording'], + ['video DVD', 'videoRecording'], + ['video cassette', 'videoRecording'], + ['blu-ray', 'videoRecording'], + ['motion picture', 'videoRecording'], + ['map', 'map'], + ['atlas', 'map'], + ['electronic resource', 'webpage'], + ['computer CD, DVD, USB', 'computerProgram'], + ['article, component part ', 'journalArticle'] + // there are likely other catalog item types in COBISS, + // which could be added to this hash later if they're being + // imported with the wrong Zotero item type + + ]); + return (catalogItemTypeHash.get(englishCatalogItemType)); +} + +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) { + var finalItemType = ""; + // if url matches /en/bib/, then skip constructing englishURL + if (url.match("/en/bib")) { + // get catalog item type from page, then translate to Zotero item type using translateItemType() + var nativeEnglishItemType = doc.querySelector("button#add-biblioentry-to-shelf").getAttribute("data-mat-type"); + finalItemType = translateItemType(nativeEnglishItemType); + } + else { + // replace specific language in bib record URL with english to detect item type + var englishURL = constructEnglishURL(url); + var englishDocument = await requestDocument(englishURL); + var englishItemType = englishDocument.querySelector("button#add-biblioentry-to-shelf").getAttribute("data-mat-type"); + finalItemType = translateItemType(englishItemType); + } + if (doc.getElementById("unpaywall-link")) { + var pdfLink = doc.getElementById("unpaywall-link").href; + } + if (doc.getElementById('showUrlHref')) { + var fullTextLink = doc.getElementById('showUrlHref').href; + } + + const risURL = constructRISURL(url); + const risText = await requestText(risURL); + // case for catalog items with RIS (95%+ of items) + if (risText) { + // RIS always has an extraneous OK## at the beginning, remove it + let fixedRisText = risText.replace(/^OK##/, ''); + // PY tag sometimes has 'cop.' at the end - remove it or it makes the date parser return '0000' for some reason + fixedRisText = fixedRisText.replace(/^(PY\s*-\s*.+)cop\.$/m, '$1'); + const translator = Zotero.loadTranslator('import'); + translator.setTranslator('32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7'); // RIS + translator.setString(fixedRisText); + translator.setHandler('itemDone', (_obj, item) => { + if (pdfLink) { + item.attachments.push({ + url: pdfLink, + title: 'Full Text PDF', + mimeType: 'application/pdf' + }); + } + else if (fullTextLink) { + if (fullTextLink.match(/.pdf$/)) { + item.attachments.push({ + url: fullTextLink, + title: 'Full Text PDF', + mimeType: 'application/pdf' + }); + } + else { + item.attachments.push({ + url: fullTextLink, + title: 'Full Text', + mimeType: 'text/html' + }); + } + } + + // if finalItemType is found from the catalog page, override itemType from RIS with it. + // if "Type of material" from catalog page isn't in catalogItemTypeHash, finalItemType will return as undefined. + // in this case, default Type from RIS will remain. + if (finalItemType) { + item.itemType = finalItemType; + } + + // some items have tags in RIS KW field and are captured by + // RIS translator, e.g. https://plus.cobiss.net/cobiss/si/en/bib/78691587. + // don't add dupliicate tags from the page to these items. + if (item.tags.length === 0) { + // other items e.g. https://plus.cobiss.net/cobiss/si/sl/bib/82789891 have tags, + // but they're not in the RIS. In this case, add tags from catalog page. + var pageTags = doc.querySelectorAll('a[href^="bib/search?c=su="]'); + for (let tagElem of pageTags) { + item.tags.push(tagElem.innerText); + } + } + item.url = url; + item.complete(); + }); + await translator.translate(); + } + + // case for catalog items with no RIS (remaining 5% or so of items) where we can't use the RIS import translator + else { + // construct correct fullRecord URL from basic catalog URL or #full URL + // base URL: https://plus.cobiss.net/cobiss/si/sl/bib/93266179 + // JSON URL: https://plus.cobiss.net/cobiss/si/sl/bib/COBIB/93266179/full + var jsonUrl = url.replace(/\/bib\/(\d+)/, "/bib/COBIB/$1/full"); + var fullRecord = await requestJSON(jsonUrl); + var noRISItem = new Zotero.Item(finalItemType); + noRISItem.title = fullRecord.titleCard.value; + var creatorsJson = fullRecord.author700701.value; + var brSlashRegex = //; + var creators = creatorsJson.split(brSlashRegex).map(value => value.trim()); + for (let creator of creators) { + // creator role isn't defined in metadata, so assign everyone "author" role + let role = "author"; + noRISItem.creators.push(ZU.cleanAuthor(creator, role, true)); + } + if (fullRecord.languageCard) noRISItem.language = fullRecord.languageCard.value; + if (fullRecord.publishDate) noRISItem.date = fullRecord.publishDate.value; + if (fullRecord.edition) noRISItem.edition = fullRecord.edition.value; + if (fullRecord.isbnCard) noRISItem.ISBN = fullRecord.isbnCard.value; + + if (fullRecord.publisherCard) { + var placePublisher = fullRecord.publisherCard.value; + // example string for publisherCard.value: "Ljubljana : Intelego, 2022" + const colonIndex = placePublisher.indexOf(":"); + const commaIndex = placePublisher.indexOf(","); + noRISItem.place = placePublisher.slice(0, colonIndex).trim(); + noRISItem.publisher = placePublisher.slice(colonIndex + 2, commaIndex).trim(); + } + + if (fullRecord.notesCard) { + var notesJson = fullRecord.notesCard.value; + var brRegex = /
    /; + var notes = notesJson.split(brRegex).map(value => value.trim()); + for (let note of notes) { + noRISItem.notes.push(note); + } + } + + // add subjects from JSON as tags. There are three fields that contain tags, + // sgcHeadings, otherSubjects and subjectCardUncon with + // different separators. sgcHeadings and otherSubjects use
    , subjectCardUncon uses / + if (fullRecord.sgcHeadings) { + var sgcHeadingsJson = fullRecord.sgcHeadings.value; + var sgcHeadingTags = sgcHeadingsJson.split(brRegex).map(value => value.trim()); + for (let sgcHeadingTag of sgcHeadingTags) { + noRISItem.tags.push(sgcHeadingTag); + } + } + + if (fullRecord.otherSubjects) { + var otherSubjectsJson = fullRecord.otherSubjects.value; + var otherSubjectsTags = otherSubjectsJson.split(brRegex).map(value => value.trim()); + for (let otherSubjectsTag of otherSubjectsTags) { + noRISItem.tags.push(otherSubjectsTag); + } + } + + if (fullRecord.subjectCardUncon) { + var subjectCardUnconJson = fullRecord.subjectCardUncon.value; + const slashRegex = /\//; + var subjectCardUnconTags = subjectCardUnconJson.split(slashRegex).map(value => value.trim()); + for (let subjectCardUnconTag of subjectCardUnconTags) { + noRISItem.tags.push(subjectCardUnconTag); + } + } + // add attachments to RIS items + if (pdfLink) { + noRISItem.attachments.push({ + url: pdfLink, + title: 'Full Text PDF', + mimeType: 'application/pdf' + }); + } + else if (fullTextLink) { + if (fullTextLink.match(/.pdf$/)) { + noRISItem.attachments.push({ + url: fullTextLink, + title: 'Full Text PDF', + mimeType: 'application/pdf' + }); + } + else { + noRISItem.attachments.push({ + url: fullTextLink, + title: 'Full Text', + mimeType: 'text/html' + }); + } + } + noRISItem.complete(); + } +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/92020483", + "items": [ + { + "itemType": "videoRecording", + "title": "Nauk o barvah po Goetheju. DVD 2/3, Poglobitev vsebine nauka o barvah, še posebej poglavja \"Fizične barve\" s prikazom eksperimentov", + "creators": [ + { + "lastName": "Kühl", + "firstName": "Johannes", + "creatorType": "director" + } + ], + "date": "2022", + "ISBN": "9789619527542", + "libraryCatalog": "COBISS", + "place": "Hvaletinci", + "studio": "NID Sapientia", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/92020483", + "attachments": [], + "tags": [ + { + "tag": "Antropozofija" + }, + { + "tag": "Barve" + } + ], + "notes": [ + { + "note": "

    Dialogi v slov. in nem. s konsekutivnim prevodom v slov.

    " + }, + { + "note": "

    Tisk po naročilu

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/search?q=*&db=cobib&mat=allmaterials&cof=0_105b-p&pdfrom=01.01.2023", + "items": "multiple" + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/115256576", + "items": [ + { + "itemType": "book", + "title": "Angel z zahodnega okna", + "creators": [ + { + "lastName": "Meyrink", + "firstName": "Gustav", + "creatorType": "author" + } + ], + "date": "2001", + "ISBN": "9789616400107", + "libraryCatalog": "COBISS", + "numPages": "2 zv. (216; 203 )", + "place": "Ljubljana", + "publisher": "Založniški atelje Blodnjak", + "series": "Zbirka Blodnjak", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/115256576", + "attachments": [], + "tags": [], + "notes": [ + { + "note": "

    Prevod dela: Der Engel vom westlichen Fenster

    " + }, + { + "note": "

    Gustav Meyrink / Herman Hesse: str. 198-200

    " + }, + { + "note": "

    Magični stekleni vrtovi judovske kulture / Jorge Luis Borges: str. 201-203

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/139084803", + "detectedItemType": "book", + "items": [ + { + "itemType": "report", + "title": "Poročilo analiz vzorcev odpadnih vod na vsebnost prepovedanih in dovoljenih drog na področju centralne čistilne naprave Kranj (2022)", + "creators": [ + { + "lastName": "Heath", + "firstName": "Ester", + "creatorType": "author" + }, + { + "lastName": "Verovšek", + "firstName": "Taja", + "creatorType": "author" + } + ], + "date": "2023", + "institution": "Institut Jožef Stefan", + "libraryCatalog": "COBISS", + "pages": "1 USB-ključ", + "place": "Ljubljana", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/139084803", + "attachments": [], + "tags": [ + { + "tag": "dovoljene droge" + }, + { + "tag": "nedovoljene droge" + }, + { + "tag": "odpadne vode" + }, + { + "tag": "čistilna naprava" + } + ], + "notes": [ + { + "note": "

    Nasl. z nasl. zaslona

    " + }, + { + "note": "

    Opis vira z dne 11. 1. 2023

    " + }, + { + "note": "

    Bibliografija: str. 13

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/84534787", + "detectedItemType": "book", + "items": [ + { + "itemType": "journalArticle", + "title": "Flood legislation and land policy framework of EU and non-EU countries in Southern Europe", + "creators": [ + { + "lastName": "Kapović-Solomun", + "firstName": "Marijana", + "creatorType": "author" + }, + { + "lastName": "Ferreira", + "firstName": "Carla S.S.", + "creatorType": "author" + }, + { + "lastName": "Zupanc", + "firstName": "Vesna", + "creatorType": "author" + }, + { + "lastName": "Ristić", + "firstName": "Ratko", + "creatorType": "author" + }, + { + "lastName": "Drobnjak", + "firstName": "Aleksandar", + "creatorType": "author" + }, + { + "lastName": "Kalantari", + "firstName": "Zahra", + "creatorType": "author" + } + ], + "date": "2022", + "ISSN": "2049-1948", + "issue": "1", + "journalAbbreviation": "WIREs", + "libraryCatalog": "COBISS", + "pages": "1-14", + "publicationTitle": "WIREs", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/84534787", + "volume": "9", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "EU legislation" + }, + { + "tag": "Južna Evropa" + }, + { + "tag": "Southern Europe" + }, + { + "tag": "floods" + }, + { + "tag": "land governance" + }, + { + "tag": "policy framework" + }, + { + "tag": "politika" + }, + { + "tag": "poplave" + }, + { + "tag": "upravljanje zemljišč" + }, + { + "tag": "zakonodaja EU" + } + ], + "notes": [ + { + "note": "

    Nasl. z nasl. zaslona

    " + }, + { + "note": "

    Opis vira z dne 11. 11. 2021

    " + }, + { + "note": "

    Bibliografija: str. 12-14

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/5815649", + "detectedItemType": "book", + "items": [ + { + "itemType": "thesis", + "title": "Rangiranje cest po metodologiji EuroRAP ; Elektronski vir: diplomska naloga = Rating roads using EuroRAP procedures", + "creators": [ + { + "lastName": "Pešec", + "firstName": "Katja", + "creatorType": "author" + } + ], + "date": "2012", + "libraryCatalog": "COBISS", + "place": "Ljubljana", + "shortTitle": "Rangiranje cest po metodologiji EuroRAP ; Elektronski vir", + "university": "[K. Pešec]", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/5815649", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "EuroRAP" + }, + { + "tag": "EuroRAP" + }, + { + "tag": "VSŠ" + }, + { + "tag": "cesta in obcestje" + }, + { + "tag": "diplomska dela" + }, + { + "tag": "economic efficiency" + }, + { + "tag": "ekonomska učinkovitost" + }, + { + "tag": "gradbeništvo" + }, + { + "tag": "graduation thesis" + }, + { + "tag": "pilot project" + }, + { + "tag": "pilotski projekt" + }, + { + "tag": "predlagani (proti)ukrepi" + }, + { + "tag": "rangiranje cest" + }, + { + "tag": "road and roadside" + }, + { + "tag": "star rating" + }, + { + "tag": "suggested countermeasure" + } + ], + "notes": [ + { + "note": "

    Diplomsko delo visokošolskega strokovnega študija gradbeništva, Prometna smer

    " + }, + { + "note": "

    Nasl. z nasl. zaslona

    " + }, + { + "note": "

    Publikacija v pdf formatu obsega 103 str.

    " + }, + { + "note": "

    Bibliografija: str. 85-87

    " + }, + { + "note": "

    Izvleček ; Abstract

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/82789891", + "detectedItemType": "book", + "items": [ + { + "itemType": "conferencePaper", + "title": "Posvet Avtomatizacija strege in montaže 2021/2021 - ASM '21/22, Ljubljana, 11. 05. 2022: zbornik povzetkov s posveta", + "creators": [ + { + "lastName": "Posvet Avtomatizacija strege in montaže", + "creatorType": "author", + "fieldMode": 1 + }, + { + "lastName": "Herakovič", + "firstName": "Niko", + "creatorType": "editor" + }, + { + "lastName": "Debevec", + "firstName": "Mihael", + "creatorType": "editor" + }, + { + "lastName": "Pipan", + "firstName": "Miha", + "creatorType": "editor" + }, + { + "lastName": "Adrović", + "firstName": "Edo", + "creatorType": "editor" + } + ], + "date": "2022", + "ISBN": "9789616980821", + "libraryCatalog": "COBISS", + "pages": "141", + "place": "Ljubljana", + "publisher": "Fakulteta za strojništvo", + "shortTitle": "Posvet Avtomatizacija strege in montaže 2021/2021 - ASM '21/22, Ljubljana, 11. 05. 2022", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/82789891", + "attachments": [], + "tags": [ + { + "tag": "Avtomatizacija" + }, + { + "tag": "Posvetovanja" + }, + { + "tag": "Strojništvo" + } + ], + "notes": [ + { + "note": "

    180 izv.

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/78691587", + "items": [ + { + "itemType": "thesis", + "title": "Modeliranje obratovanja transformatorskih postaj z metodami strojnega učenja: diplomsko delo: visokošolski strokovni študijski program prve stopnje Računalništvo in informatika", + "creators": [ + { + "lastName": "Čuš", + "firstName": "Tibor", + "creatorType": "author" + } + ], + "date": "2022", + "libraryCatalog": "COBISS", + "numPages": "55", + "place": "Ljubljana", + "shortTitle": "Modeliranje obratovanja transformatorskih postaj z metodami strojnega učenja", + "university": "[T. Čuš]", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/78691587", + "attachments": [ + { + "title": "Full Text", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "computer science" + }, + { + "tag": "diploma" + }, + { + "tag": "diplomske naloge" + }, + { + "tag": "electrical power system" + }, + { + "tag": "elektroenergetski sistem" + }, + { + "tag": "forecasting models" + }, + { + "tag": "indikatorji preobremenitev" + }, + { + "tag": "machine learning" + }, + { + "tag": "napovedni modeli" + }, + { + "tag": "overload indicators" + }, + { + "tag": "transformer station" + }, + { + "tag": "visokošolski strokovni študij" + } + ], + "notes": [ + { + "note": "

    Bibliografija: str. 53-55

    " + }, + { + "note": "

    Povzetek ; Abstract: Modeling transformer station operation with machine learning methods

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/94705155#full", + "items": [ + { + "itemType": "book", + "title": "Ljubezen v pismih: dopisovanje med Felicito Koglot in Francem Pericem: Aleksandrija-Bilje: 1921-1931", + "creators": [ + { + "lastName": "Koglot", + "firstName": "Felicita", + "creatorType": "author" + }, + { + "lastName": "Peric", + "firstName": "Franc", + "creatorType": "author" + }, + { + "lastName": "Vončina", + "firstName": "Lara", + "creatorType": "editor" + }, + { + "lastName": "Orel", + "firstName": "Maja", + "creatorType": "editor" + }, + { + "lastName": "Koren", + "firstName": "Manca", + "creatorType": "editor" + }, + { + "lastName": "Mihurko Poniž", + "firstName": "Katja", + "creatorType": "editor" + } + ], + "date": "2022", + "ISBN": "9789617025224", + "libraryCatalog": "COBISS", + "numPages": "235", + "place": "V Novi Gorici", + "publisher": "Založba Univerze", + "shortTitle": "Ljubezen v pismih", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/94705155#full", + "attachments": [], + "tags": [ + { + "tag": "Primorska" + }, + { + "tag": "Slovenke" + }, + { + "tag": "emigracija" + }, + { + "tag": "pisma" + }, + { + "tag": "ženske" + } + ], + "notes": [ + { + "note": "

    Potiskane notr. str. ov.

    " + }, + { + "note": "

    250 izv.

    " + }, + { + "note": "

    Kdo sta bila Felicita Koglot in Franc Peric in o knjižni izdaji njunega dopisovanja / Manca Koren, Maja Orel, Lara Vončina: str. 5-6

    " + }, + { + "note": "

    Kratek oris zgodovinskih razmer v Egiptu in na Primorskem v obdobju med obema vojnama / Manca Koren: str. 185-195

    " + }, + { + "note": "

    Franc Peric in Felicita Koglot: večkratne migracije v družinski korespondenci / Mirjam Milharčič Hladnik: str. 197-209

    " + }, + { + "note": "

    Družinsko življenje in doživljanje aleksandrinstva v pismih / Manca Koren: str. 211-228

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/78691587", + "items": [ + { + "itemType": "thesis", + "title": "Modeliranje obratovanja transformatorskih postaj z metodami strojnega učenja: diplomsko delo: visokošolski strokovni študijski program prve stopnje Računalništvo in informatika", + "creators": [ + { + "lastName": "Čuš", + "firstName": "Tibor", + "creatorType": "author" + } + ], + "date": "2022", + "libraryCatalog": "COBISS", + "numPages": "55", + "place": "Ljubljana", + "shortTitle": "Modeliranje obratovanja transformatorskih postaj z metodami strojnega učenja", + "university": "[T. Čuš]", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/78691587", + "attachments": [ + { + "title": "Full Text", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "computer science" + }, + { + "tag": "diploma" + }, + { + "tag": "diplomske naloge" + }, + { + "tag": "electrical power system" + }, + { + "tag": "elektroenergetski sistem" + }, + { + "tag": "forecasting models" + }, + { + "tag": "indikatorji preobremenitev" + }, + { + "tag": "machine learning" + }, + { + "tag": "napovedni modeli" + }, + { + "tag": "overload indicators" + }, + { + "tag": "transformer station" + }, + { + "tag": "visokošolski strokovni študij" + } + ], + "notes": [ + { + "note": "

    Bibliografija: str. 53-55

    " + }, + { + "note": "

    Povzetek ; Abstract: Modeling transformer station operation with machine learning methods

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/search?q=*&db=cobib&mat=allmaterials&cof=0_105b-mb16", + "items": "multiple" + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/101208835", + "items": [ + { + "itemType": "book", + "title": "Fizika. Zbirka maturitetnih nalog z rešitvami 2012-2017 / [avtorji Vitomir Babič ... [et al.] ; urednika Aleš Drolc, Joži Trkov]", + "creators": [ + { + "firstName": "Vito", + "lastName": "Babič", + "creatorType": "author" + }, + { + "firstName": "Ruben", + "lastName": "Belina", + "creatorType": "author" + }, + { + "firstName": "Peter", + "lastName": "Gabrovec", + "creatorType": "author" + }, + { + "firstName": "Marko", + "lastName": "Jagodič", + "creatorType": "author" + }, + { + "firstName": "Aleš", + "lastName": "Mohorič", + "creatorType": "author" + }, + { + "firstName": "Mirijam", + "lastName": "Pirc", + "creatorType": "author" + }, + { + "firstName": "Gorazd", + "lastName": "Planinšič", + "creatorType": "author" + }, + { + "firstName": "Mitja", + "lastName": "Slavinec", + "creatorType": "author" + }, + { + "firstName": "Ivica", + "lastName": "Tomić", + "creatorType": "author" + } + ], + "date": "2022", + "ISBN": "9789616899420", + "edition": "3. ponatis", + "language": "Slovenian", + "libraryCatalog": "COBISS", + "place": "Ljubljana", + "publisher": "Državni izpitni center", + "attachments": [], + "tags": [ + { + "tag": "Fizika -- Matura -- 2012-2017 -- Vaje za srednje šole" + }, + { + "tag": "Fizika -- Vaje za maturo" + }, + { + "tag": "izpitne naloge za srednje šole" + }, + { + "tag": "naloge" + }, + { + "tag": "rešitve" + }, + { + "tag": "testi znanja" + }, + { + "tag": "učbeniki za srednje šole" + } + ], + "notes": [ + "Nasl. na hrbtu: Fizika 2012-2017", + "Avtorji navedeni v kolofonu", + "600 izv." + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/sl/bib/93266179", + "items": [ + { + "itemType": "book", + "title": "Matematika na splošni maturi : 2022 : vprašanja in odgovori za ustni izpit iz matematike na splošni maturi za osnovno raven / Bojana Dvoržak", + "creators": [ + { + "firstName": "Bojana", + "lastName": "Dvoržak", + "creatorType": "author" + } + ], + "date": "2022", + "ISBN": "9789616558624", + "edition": "1. izd.", + "language": "slovenski", + "libraryCatalog": "COBISS", + "place": "Ljubljana", + "publisher": "Intelego", + "shortTitle": "Matematika na splošni maturi", + "attachments": [], + "tags": [ + { + "tag": "Matematika" + }, + { + "tag": "Matematika -- Katalogi znanja za srednje šole" + }, + { + "tag": "Matematika -- Matura -- Vaje za srednje šole" + }, + { + "tag": "Matematika -- Vaje za maturo" + }, + { + "tag": "Matura" + }, + { + "tag": "Naloge, vaje itd." + }, + { + "tag": "izpitne naloge za srednje šole" + }, + { + "tag": "odgovori" + }, + { + "tag": "osnovna raven" + }, + { + "tag": "rešitve" + }, + { + "tag": "testi znanja" + }, + { + "tag": "učbeniki za srednje šole" + }, + { + "tag": "vprašanja" + }, + { + "tag": "zaključni izpiti" + } + ], + "notes": [ + "Dodatek k nasl. v kolofonu in CIP-u: Vprašanja in odgovori za ustni izpit iz matematike na splošni maturi 2022 za osnovno raven", + "1.000 izv." + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/143385859", + "items": [ + { + "itemType": "book", + "title": "Fizika. Zbirka maturitetnih nalog z rešitvami 2012-2017 / [avtorji Vitomir Babič ... [et al.] ; urednika Aleš Drolc, Joži Trkov]", + "creators": [ + { + "firstName": "Vito", + "lastName": "Babič", + "creatorType": "author" + }, + { + "firstName": "Ruben", + "lastName": "Belina", + "creatorType": "author" + }, + { + "firstName": "Peter", + "lastName": "Gabrovec", + "creatorType": "author" + }, + { + "firstName": "Marko", + "lastName": "Jagodič", + "creatorType": "author" + }, + { + "firstName": "Aleš", + "lastName": "Mohorič", + "creatorType": "author" + }, + { + "firstName": "Mirijam", + "lastName": "Pirc", + "creatorType": "author" + }, + { + "firstName": "Gorazd", + "lastName": "Planinšič", + "creatorType": "author" + }, + { + "firstName": "Mitja", + "lastName": "Slavinec", + "creatorType": "author" + }, + { + "firstName": "Ivica", + "lastName": "Tomić", + "creatorType": "author" + } + ], + "date": "2023", + "ISBN": "9789616899420", + "edition": "4. ponatis", + "language": "Slovenian", + "libraryCatalog": "COBISS", + "place": "Ljubljana", + "publisher": "Državni izpitni center", + "attachments": [], + "tags": [ + { + "tag": "Fizika -- Matura -- 2012-2017 -- Priročniki" + }, + { + "tag": "Fizika -- Vaje za maturo" + }, + { + "tag": "izpitne naloge za srednje šole" + }, + { + "tag": "naloge" + }, + { + "tag": "rešitve" + }, + { + "tag": "učbeniki za srednje šole" + }, + { + "tag": "vaje za srednje šole" + } + ], + "notes": [ + "Hrbtni nasl.: Fizika 2012-2017", + "Avtorji navedeni v kolofonu", + "300 izv." + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/70461955", + "items": [ + { + "itemType": "book", + "title": "Napredna znanja za kakovostno mentorstvo v zdravstveni negi: znanstvena monografija", + "creators": [ + { + "lastName": "Filej", + "firstName": "Bojana", + "creatorType": "editor" + }, + { + "lastName": "Kaučič", + "firstName": "Boris Miha", + "creatorType": "editor" + } + ], + "date": "2023", + "ISBN": "9789616889377", + "edition": "1. izd.", + "libraryCatalog": "COBISS", + "place": "Celje", + "publisher": "Fakulteta za zdravstvene vede", + "shortTitle": "Napredna znanja za kakovostno mentorstvo v zdravstveni negi", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/70461955", + "attachments": [ + { + "title": "Full Text", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "Izobrževanje" + }, + { + "tag": "Mentorstvo" + }, + { + "tag": "Mentorstvo" + }, + { + "tag": "Praktična znanja" + }, + { + "tag": "Vzgoja in izobraževanje" + }, + { + "tag": "Zborniki" + }, + { + "tag": "Zdravstvena nega" + }, + { + "tag": "Zdravstvena nega" + } + ], + "notes": [ + { + "note": "

    Nasl. z nasl. zaslona

    " + }, + { + "note": "

    Dokument v pdf formatu obsega 94 str.

    " + }, + { + "note": "

    Opis vira z dne 1. 2. 2023

    " + }, + { + "note": "

    Bibliografija pri posameznih poglavjih

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/105123075", + "items": [ + { + "itemType": "report", + "title": "Storitveni sektor in siva ekonomija v času epidemije COVID-19: raziskovalno delo: področje: ekonomija in turizem", + "creators": [ + { + "lastName": "Hochkraut", + "firstName": "Nataša", + "creatorType": "author" + }, + { + "lastName": "Verbovšek", + "firstName": "Lea", + "creatorType": "author" + } + ], + "date": "2022", + "institution": "Osnovna šola Primoža Trubarja", + "libraryCatalog": "COBISS", + "place": "Laško", + "shortTitle": "Storitveni sektor in siva ekonomija v času epidemije COVID-19", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/105123075", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "COVID 19" + }, + { + "tag": "SARS-Cov-2" + }, + { + "tag": "izvajalci storitev" + }, + { + "tag": "korelacija" + }, + { + "tag": "koronavirus" + }, + { + "tag": "potrošniki" + }, + { + "tag": "raziskovalne naloge" + }, + { + "tag": "siva ekonomija" + }, + { + "tag": "statistika" + }, + { + "tag": "storitveni sektor" + } + ], + "notes": [ + { + "note": "

    Raziskovalna naloga v okviru projekta Mladi za Celje 2022

    " + }, + { + "note": "

    Povzetek v slov in angl.

    " + }, + { + "note": "

    Bibliografija: f. 35-36

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/84576259", + "items": [ + { + "itemType": "audioRecording", + "title": "Reforma: tribute to Laibach", + "creators": [ + { + "lastName": "Noctiferia", + "creatorType": "composer", + "fieldMode": 1 + } + ], + "date": "2021", + "label": "Nika", + "libraryCatalog": "COBISS", + "place": "Ljubljana", + "shortTitle": "Reforma", + "url": "https://plus.cobiss.net/cobiss/si/en/bib/84576259", + "attachments": [ + { + "title": "Full Text", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "avantgardna glasba" + }, + { + "tag": "avantgardni rock" + }, + { + "tag": "black metal" + }, + { + "tag": "death metal" + }, + { + "tag": "extreme metal" + }, + { + "tag": "heavy metal" + }, + { + "tag": "industrial metal" + }, + { + "tag": "metal" + }, + { + "tag": "priredbe" + } + ], + "notes": [ + { + "note": "

    Leto posnetja 2021

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/al/sq/bib/334906368", + "items": [ + { + "itemType": "book", + "title": "Trëndafili i mesnatës", + "creators": [ + { + "lastName": "Riley", + "firstName": "Lucinda", + "creatorType": "author" + } + ], + "date": "[2022]", + "ISBN": "9789928366108", + "libraryCatalog": "COBISS", + "numPages": "603 f.", + "place": "[Tiranë]", + "publisher": "Dituria", + "series": "Letërsi e huaj bashkëkohore", + "url": "https://plus.cobiss.net/cobiss/al/sq/bib/334906368", + "attachments": [], + "tags": [ + { + "tag": "letërsia irlandeze" + }, + { + "tag": "romane" + } + ], + "notes": [ + { + "note": "

    Tit. i origj.: The midnight rose

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/bh/sr/bib/47388678", + "detectedItemType": "book", + "items": [ + { + "itemType": "thesis", + "title": "The influence of negative transfer on the use of collocations in high school student's writing = Utjecaj negativnog transfera na korištenje kolokacija u pismenim zadaćama učenika srednjih škola", + "creators": [ + { + "lastName": "Đapo", + "firstName": "Amra", + "creatorType": "author" + } + ], + "date": "2022", + "libraryCatalog": "COBISS", + "numPages": "76 listova", + "place": "Tuzla", + "university": "[A. Đapo]", + "url": "https://plus.cobiss.net/cobiss/bh/sr/bib/47388678", + "attachments": [], + "tags": [ + { + "tag": "acquisition" + }, + { + "tag": "collocations" + }, + { + "tag": "engleski kao drugi jezik" + }, + { + "tag": "errors" + }, + { + "tag": "greške" + }, + { + "tag": "kolokacije" + }, + { + "tag": "magistarski rad" + }, + { + "tag": "transfer" + }, + { + "tag": "transfer" + }, + { + "tag": "usvajanje" + } + ], + "notes": [ + { + "note": "

    Bibliografija: listovi 73-76

    " + }, + { + "note": "

    Sažetak ; Summary

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/rs/sr/bib/57790729", + "detectedItemType": "book", + "items": [ + { + "itemType": "statute", + "nameOfAct": "Закон о Централном регистру обавезног социјалног осигурања, са подзаконским актима", + "creators": [ + { + "lastName": "Србија", + "creatorType": "author", + "fieldMode": 1 + }, + { + "lastName": "Мартић", + "firstName": "Вера", + "creatorType": "editor" + } + ], + "dateEnacted": "2022", + "pages": "II, 74 стр.", + "url": "https://plus.cobiss.net/cobiss/rs/sr/bib/57790729", + "attachments": [], + "tags": [ + { + "tag": "Београд" + }, + { + "tag": "Законски прописи" + }, + { + "tag": "Централни регистар обавезног социјалног осигурања" + } + ], + "notes": [ + { + "note": "

    Тираж 300

    " + }, + { + "note": "

    Напомене и библиографске референце уз текст.

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/bg/en/bib/51193608", + "items": [ + { + "itemType": "thesis", + "title": "Хирургични аспекти на аноректалните абсцеси при деца и възрастни: дисертационен труд за присъждане на образователна и научна степен \"доктор\", област на висше образование 7. Здравеопазване и спорт, професионално направление 7.1 Медицина, научна специалност: 03.01.37 Обща хирургия", + "creators": [ + { + "lastName": "Хаджиева", + "firstName": "Елена Божидарова", + "creatorType": "author" + }, + { + "lastName": "Hadžieva", + "firstName": "Elena Božidarova", + "creatorType": "author" + } + ], + "date": "2022", + "libraryCatalog": "COBISS", + "numPages": "198 л.", + "place": "Пловдив", + "shortTitle": "Хирургични аспекти на аноректалните абсцеси при деца и възрастни", + "university": "[Е. Хаджиева]", + "url": "https://plus.cobiss.net/cobiss/bg/en/bib/51193608", + "attachments": [], + "tags": [], + "notes": [ + { + "note": "

    Библиогр.: л. 175-190

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/ks/sq/bib/120263427", + "detectedItemType": "book", + "items": [ + { + "itemType": "conferencePaper", + "title": "Kumtesat nga konferenca shkencore ndërkombëtare: (17 dhe 18 nëntor 2021): Ndikimi i COVID-19 në humbjet mësimore - pasojat në rritjen e pabarazive në mësim dhe sfidat e përmbushjes/kompensimit", + "creators": [ + { + "lastName": "Instituti Pedagogjik i Kosovës", + "firstName": "Konferenca shkencore ndërkombëtare", + "creatorType": "author" + }, + { + "lastName": "Koliqi", + "firstName": "Hajrullah", + "creatorType": "editor" + } + ], + "date": "2021", + "ISBN": "9789951591560", + "libraryCatalog": "COBISS", + "pages": "190 f.", + "place": "Prishtinë", + "publisher": "Instituti Pedagogjik i Kosovës", + "shortTitle": "Kumtesat nga konferenca shkencore ndërkombëtare", + "url": "https://plus.cobiss.net/cobiss/ks/sq/bib/120263427", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "covid-19" + }, + { + "tag": "mësimi online" + }, + { + "tag": "përmbledhjet e punimeve" + }, + { + "tag": "sistemet arsimore" + } + ], + "notes": [ + { + "note": "

    Përmbledhjet në gjuhën shqipe dhe angleze

    " + }, + { + "note": "

    Bibliografia në fund të çdo punimi

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/mk/en/bib/search?q=*&db=cobib&mat=allmaterials&tyf=1_gla_cd", + "items": "multiple" + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/mk/mk/bib/57036037", + "detectedItemType": "book", + "items": [ + { + "itemType": "audioRecording", + "title": "Крени ме", + "creators": [ + { + "lastName": "Кајшаров", + "firstName": "Константин", + "creatorType": "composer" + } + ], + "date": "2022", + "label": "К. Кајшаров", + "libraryCatalog": "COBISS", + "place": "Скопје", + "url": "https://plus.cobiss.net/cobiss/mk/mk/bib/57036037", + "attachments": [], + "tags": [ + { + "tag": "CD-a" + }, + { + "tag": "Вокално-инструментални композиции" + }, + { + "tag": "Духовна музика" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/cg/cnr_cyrl/bib/20926212", + "detectedItemType": "book", + "items": [ + { + "itemType": "thesis", + "title": "Menadžment ljudskih resursa: diplomski rad", + "creators": [ + { + "lastName": "Obradović", + "firstName": "Nikoleta", + "creatorType": "author" + } + ], + "date": "2022", + "libraryCatalog": "COBISS", + "place": "Podgorica", + "shortTitle": "Menadžment ljudskih resursa", + "university": "[N. Obradović]", + "url": "https://plus.cobiss.net/cobiss/cg/cnr_cyrl/bib/20926212", + "attachments": [], + "tags": [ + { + "tag": "Diplomski radovi" + }, + { + "tag": "Menadžment ljudskih resursa" + } + ], + "notes": [ + { + "note": "

    Nasl. sa nasl. ekrana

    " + }, + { + "note": "

    Bibliografija

    " + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/sr/sr_latn/bib/search?q=*&db=cobib&mat=allmaterials", + "items": "multiple" + }, + { + "type": "web", + "url": "https://plus.cobiss.net/cobiss/sr/sr_latn/bib/15826441", + "items": [ + { + "itemType": "book", + "title": "Zanosni", + "creators": [ + { + "lastName": "Prince", + "creatorType": "author", + "fieldMode": 1 + }, + { + "lastName": "Принс", + "creatorType": "author", + "fieldMode": 1 + }, + { + "lastName": "Božić", + "firstName": "Aleksandar", + "creatorType": "editor" + }, + { + "lastName": "Божић", + "firstName": "Александар", + "creatorType": "editor" + } + ], + "date": "2022", + "ISBN": "9788664630160", + "libraryCatalog": "COBISS", + "numPages": "281", + "place": "Beograd", + "publisher": "IPC Media", + "series": "Edicija (B)io", + "url": "https://plus.cobiss.net/cobiss/sr/sr_latn/bib/15826441", + "attachments": [], + "tags": [ + { + "tag": "Аутобиографија" + }, + { + "tag": "Принс, 1958-2016" + } + ], + "notes": [ + { + "note": "

    Prevod dela: The beautiful ones / Prince

    " + }, + { + "note": "

    Autorove slike

    " + }, + { + "note": "

    Tiraž 1.000

    " + }, + { + "note": "

    Str. 4-49: Predgovor / Den Pajpenbring

    " + }, + { + "note": "

    O autorima: str. [282].

    " + } + ], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/COinS.js b/translators/COinS.js new file mode 100644 index 0000000..2fee64a --- /dev/null +++ b/translators/COinS.js @@ -0,0 +1,336 @@ +{ + "translatorID": "05d07af9-105a-4572-99f6-a8e231c0daef", + "label": "COinS", + "creator": "Simon Kornblith", + "target": "", + "minVersion": "2.1", + "maxVersion": "", + "priority": 310, + "inRepository": true, + "translatorType": 6, + "browserSupport": "gcsv", + "lastUpdated": "2021-06-01 17:38:46" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Simon Kornblith and Abe Jellinek + + 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) { + var encounteredType = false; + + var spans = doc.querySelectorAll('span.Z3988[title]'); + for (let span of spans) { + // determine if it's a valid type + var item = new Zotero.Item(); + Zotero.Utilities.parseContextObject(span.title, item); + + if (item.itemType) { + if (encounteredType) { + return "multiple"; + } + else { + encounteredType = item.itemType; + } + } + } + + return encounteredType; +} + +// Borrowed from Nature translator +function supplementItem(item, supp, prefer, ignore) { + if (!prefer) prefer = []; + if (!ignore) ignore = []; + + for (var i in supp) { + if (ignore.includes(i)) continue; + if (i == 'creators' || i == 'attachments' || i == 'notes' + || i == 'tags' || i == 'seeAlso' + ) { + if ((item.hasOwnProperty(i) && item[i].length) // Supplement only if completely empty + || (!supp[i].length || typeof supp[i] == 'string') + ) { + continue; + } + } + else if (!supp.hasOwnProperty(i) + || (item.hasOwnProperty(i) && !prefer.includes(i))) { + continue; + } + + Z.debug('Supplementing item.' + i); + item[i] = supp[i]; + } + + return item; +} + +// used to retrieve next COinS object when asynchronously parsing COinS objects +// on a page +function retrieveNextCOinS(needFullItems, newItems, couldUseFullItems, doc) { + if (needFullItems.length) { + var item = needFullItems.shift(); + + Zotero.debug("Looking up contextObject"); + var search = Zotero.loadTranslator("search"); + search.setHandler("itemDone", function (obj, newItem) { + supplementItem(newItem, item, [], ['contextObject', 'repository']); + newItems.push(newItem); + }); + search.setHandler("done", function () { + retrieveNextCOinS(needFullItems, newItems, couldUseFullItems, doc); + }); + // Don't throw on error + search.setHandler("error", function () { + Zotero.debug("Failed to look up item:"); + Zotero.debug(item); + }); + // look for translators + search.setHandler("translators", function (obj, translators) { + if (translators.length) { + search.setTranslator(translators); + search.translate(); + } + else { + retrieveNextCOinS(needFullItems, newItems, couldUseFullItems, doc); + } + }); + + search.setSearch(item); + search.getTranslators(); + } + else { + completeCOinS(newItems, couldUseFullItems, doc); + Zotero.done(); + } +} + +// saves all COinS objects +function completeCOinS(newItems, couldUseFullItems, doc) { + if (newItems.length > 1) { + var selectArray = new Array(newItems.length); + for (var i in newItems) { + selectArray[i] = newItems[i].title; + } + + Zotero.selectItems(selectArray, function (selectArray) { + if (!selectArray) return; + var useIndices = []; + for (var i in selectArray) { + useIndices.push(i); + } + completeItems(newItems, useIndices, couldUseFullItems, doc); + }); + } + else if (newItems.length) { + completeItems(newItems, [0], couldUseFullItems, doc); + } +} + +function completeItems(newItems, useIndices, couldUseFullItems, doc) { + if (!useIndices.length) { + return; + } + var i = useIndices.shift(); + + // grab full item if the COinS was missing an author + if (couldUseFullItems[i]) { + Zotero.debug("Looking up contextObject"); + var search = Zotero.loadTranslator("search"); + + var firstItem = false; + search.setHandler("itemDone", function (obj, newItem) { + supplementItem(newItem, newItems[i], [], ['contextObject', 'repository']); + if (!firstItem) { + // add doc as attachment + newItem.attachments.push({ document: doc }); + newItem.complete(); + firstItem = true; + } + }); + search.setHandler("done", function (_obj) { + // if we didn't find anything, use what we had before (even if it + // lacks the creator) + if (!firstItem) { + newItems[i].complete(); + } + // call next + completeItems(newItems, useIndices, couldUseFullItems); + }); + // Don't throw on error + search.setHandler("error", function () {}); + search.setHandler("translators", function (obj, translators) { + if (translators.length) { + search.setTranslator(translators); + search.translate(); + } + else { + // add doc as attachment + newItems[i].attachments.push({ document: doc }); + newItems[i].complete(); + // call next + completeItems(newItems, useIndices, couldUseFullItems); + } + }); + + search.setSearch(newItems[i]); + search.getTranslators(); + } + else { + // add doc as attachment + newItems[i].attachments.push({ document: doc }); + newItems[i].complete(); + // call next + completeItems(newItems, useIndices, couldUseFullItems); + } +} + +function doWeb(doc, _url) { + var newItems = []; + var needFullItems = []; + var couldUseFullItems = []; + + var spans = doc.querySelectorAll('span.Z3988[title]'); + for (let span of spans) { + var spanTitle = span.title; + var newItem = new Zotero.Item(); + newItem.repository = false; // do not save repository + if (Zotero.Utilities.parseContextObject(spanTitle, newItem)) { + if (newItem.title) { + if (!newItem.creators.length) { + // if we have a title but little other identifying + // information, say we'll get full item later + newItem.contextObject = spanTitle; + couldUseFullItems[newItems.length] = true; + } + + // title and creators are minimum data to avoid looking up + newItems.push(newItem); + } + else { + // retrieve full item + newItem.contextObject = spanTitle; + needFullItems.push(newItem); + } + } + } + + Zotero.debug(needFullItems); + if (needFullItems.length) { + // retrieve full items asynchronously + Zotero.wait(); + retrieveNextCOinS(needFullItems, newItems, couldUseFullItems, doc); + } + else { + completeCOinS(newItems, couldUseFullItems, doc); + } +} + +function doExport() { + var item; + var co; + + while ((item = Zotero.nextItem())) { + co = Zotero.Utilities.createContextObject(item, "1.0"); + if (co) { + Zotero.write("\n"); + } + } +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://husdal.com/2011/06/19/disruptions-in-supply-networks/", + "items": [ + { + "itemType": "journalArticle", + "title": "Disruptions and supply networks: a multi-level, multi-theoretical relational perspective", + "creators": [ + { + "firstName": "Phil", + "lastName": "Greening", + "creatorType": "author" + }, + { + "firstName": "Christine", + "lastName": "Rutherford", + "creatorType": "author" + } + ], + "date": "2011", + "issue": "1", + "pages": "104-126", + "publicationTitle": "International Journal of Logistics Management", + "shortTitle": "Disruptions and supply networks", + "volume": "22", + "attachments": [ + { + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://gamblershouse.wordpress.com/2011/06/19/the-view-from-dolores/", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.worldcat.org/title/genealogy-of-the-royal-family-of-great-britain-shewing-the-descent-of-queen-victoria-through-five-of-the-saxon-kings-who-were-crowned-at-kingston-upon-thames/oclc/559794003&referer=brief_results", + "items": [ + { + "itemType": "book", + "title": "The Genealogy of the Royal Family of Great Britain, shewing the descent of ... Queen Victoria, through five of the Saxon Kings who were crowned ... at Kingston-upon-Thames.", + "creators": [ + { + "lastName": "Royal Families (England)", + "isInstitution": true + }, + { + "lastName": "GENEALOGY", + "creatorType": "author" + } + ], + "date": "1850", + "place": "London", + "publisher": "C. & E. Layton", + "attachments": [ + { + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/CQ Press.js b/translators/CQ Press.js new file mode 100644 index 0000000..2d48949 --- /dev/null +++ b/translators/CQ Press.js @@ -0,0 +1,418 @@ +{ + "translatorID": "0de4cddf-be9d-4e1e-9b51-891b7a4bb136", + "label": "CQ Press", + "creator": "Abe Jellinek", + "target": "^https?://library\\.cqpress\\.com/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-09-01 21:06:24" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (url.includes('/document.php?')) { + if (url.includes('/cqresearcher/')) { + // yes, these are "reports," but they have volume/issue numbers and + // are published like journal articles + return "journalArticle"; + } + else if (url.includes('/congress/') + || url.includes('/cqalmanac/') + || url.includes('/pia/') + || url.includes('/scyb/')) { + return "bookSection"; + } + else if (url.includes('/cqmagazine/')) { + return "magazineArticle"; + } + } + else if (getSearchResults(doc, url, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, url, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('a[href*="document.php?"]'); + if (!rows.length) { + rows = doc.querySelectorAll('a[onclick*="popupDoc("]'); + } + + for (let row of rows) { + let href = row.getAttribute('href'); // prevent automatic relative -> absolute + let title = ZU.trimInternal(row.textContent); + if (/^\d+$/.test(title)) { + // sometimes the link is only on one part of the title: + // Brown, Scott P., [[466]] + title = ZU.trimInternal(row.parentNode.textContent); + } + + if (href == '#') href = ''; + if (!href && row.hasAttribute('onclick')) { + // pull out the query parameters and append them to + // `//document.php?` + href = url.replace(/\/[^/]*$/, '/document.php?') + + (row.getAttribute('onclick').match(/'(.+)'/) || [])[1]; + } + + if (!href || !title || title.includes('Read the Full Report')) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, url, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + let id = url.match(/[?&]id=([^&#]+)/)[1]; + var risURL = url.replace(/document\.php.*$/, `/citenow.php?id=${id}&action=endnote`); + + ZU.doGet(risURL, function (risText) { + risText = risText + .replace(/^JO/m, 'T2') + .replace(/^UR/gm, 'L1') // demote all existing URLs + .replace(/^L2/m, 'UR'); // ...and replace them with L2, the correct one + + var translator = Zotero.loadTranslator("import"); + translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); // RIS + translator.setString(risText); + translator.setHandler("itemDone", function (obj, item) { + if (url.includes('/cqmagazine/')) { + item.itemType = 'magazineArticle'; + } + + // innerText to capture line breaks + let date = innerText(doc, '#main .date, .time-info, .topheader'); + if (!item.date) item.date = ZU.strToISO(date); + + let volume = date.match(/Volume (\w+)/); + if (volume) { + item.volume = volume[1]; + } + + let issue = date.match(/Issue (\w+)/); + if (issue) { + item.issue = issue[1]; + } + + item.abstractNote = text(doc, '#abstract'); + + item.attachments = []; + + let pdfURL = attr(doc, 'iframe[src*=".pdf"]', 'src'); + if (!pdfURL && url.includes('/cqresearcher/')) { + pdfURL = `/cqresearcher/getpdf.php?id=${id}`; + } + + if (pdfURL) { + item.attachments.push({ + title: 'Full Text PDF', + mimeType: 'application/pdf', + url: pdfURL + }); + } + else { + item.attachments.push({ + title: 'Snapshot', + document: doc + }); + } + + item.notes = []; + + item.complete(); + }); + translator.translate(); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://library.cqpress.com/cqresearcher/document.php?id=cqresrre2021081300", + "items": [ + { + "itemType": "journalArticle", + "title": "Hate Crimes", + "creators": [ + { + "lastName": "Ladika", + "firstName": "Susan", + "creatorType": "author" + } + ], + "date": "2021-08-13", + "ISSN": "1942-5635", + "abstractNote": "Hate crimes against Asian Americans have increased in the past year, a development that experts say is tied to the COVID-19 pandemic. From 2019 to 2020, bias-based crimes against Asians rose nearly 150 percent in major U.S. cities, and the trend has continued this year. Many blame the increase on the rhetoric of former President Donald Trump, who called COVID-19 the “China virus” and “kung flu.” While the pandemic has highlighted anti-Asian animus, hate crimes generally are on the rise against other racial, ethnic and religious groups and among people targeted due to their sexual orientation or gender identity. Researchers say these crimes are often significantly underreported and underprosecuted, and lawmakers hope new federal statutes designed to improve state and local hate crime reporting will better define the scope of the problem. Others say that merely gathering better statistics will not solve the problem and want more prosecutions of bias-based crimes. Critics of hate crime laws say they violate free speech rights and create special protections for certain groups based on political considerations.", + "issue": "29", + "libraryCatalog": "CQ Press", + "pages": "1-29", + "publicationTitle": "CQ Researcher", + "url": "http://library.cqpress.com/cqresearcher/cqresrre2021081300", + "volume": "31", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://library.cqpress.com/congress/document.php?id=pia115-Barton-Joe-L#", + "items": [ + { + "itemType": "bookSection", + "title": "Barton, Joe L.", + "creators": [ + { + "lastName": "CQ-Roll Call", + "creatorType": "editor", + "fieldMode": 1 + } + ], + "date": "2017", + "bookTitle": "Politics in America 2018. The 115th Congress", + "libraryCatalog": "CQ Press", + "place": "Washington, D.C., United States", + "publisher": "CQ-Roll Call, Inc.", + "series": "CQ Congress Collection", + "url": "http://library.cqpress.com/congress/pia115-Barton-Joe-L", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://library.cqpress.com/congress/document.php?id=rc1989-201-9316-574703&type=hitlist&num=0", + "items": [ + { + "itemType": "bookSection", + "title": "Minimum-Wage Increase/Social Security Earnings Test (in Sen.) S 4", + "creators": [], + "date": "1990", + "ISBN": "9780871875488", + "bookTitle": "Congressional Roll Call 1989", + "libraryCatalog": "CQ Press", + "place": "Washington, D.C., United States", + "publisher": "CQ Press", + "series": "CQ Congress Collection", + "url": "http://library.cqpress.com/congress/rc1989-201-9316-574703", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://library.cqpress.com/cqalmanac/document.php?id=cqal12-1531-87293-2553227&type=toc&num=1", + "items": [ + { + "itemType": "bookSection", + "title": "Bill Normalizes Trade with Russia", + "creators": [], + "date": "2013", + "ISBN": "9781452292601", + "bookTitle": "CQ Almanac 2012", + "libraryCatalog": "CQ Press", + "place": "Washington, D.C., United States", + "publisher": "CQ-Roll Call Group", + "series": "CQ Almanac Online Edition", + "url": "http://library.cqpress.com/cqalmanac/cqal12-1531-87293-2553227", + "volume": "68", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://library.cqpress.com/cqmagazine/document.php?id=weeklyreport117-000006302112", + "items": [ + { + "itemType": "magazineArticle", + "title": "With border adjustment plan, trade could be new carbon battleground", + "creators": [], + "date": "2021-08-02", + "libraryCatalog": "CQ Press", + "publicationTitle": "CQ Magazine", + "url": "http://library.cqpress.com/cqmagazine/weeklyreport117-000006302112", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://library.cqpress.com/pia/document.php?id=OEpia112_1067", + "items": [ + { + "itemType": "bookSection", + "title": "Baldwin, Tammy, D-Wis.", + "creators": [ + { + "lastName": "Bicknell John", + "creatorType": "editor", + "fieldMode": 1 + }, + { + "lastName": "Meyers David", + "creatorType": "editor", + "fieldMode": 1 + } + ], + "date": "2011", + "ISBN": "9781608717996", + "bookTitle": "Politics in America 2012 (the 112th Congress)", + "libraryCatalog": "CQ Press", + "place": "Washington, D.C., United States", + "publisher": "CQ-Roll Call, Inc.", + "series": "Politics in America Online Edition", + "url": "http://library.cqpress.com/pia/OEpia112_1067", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://library.cqpress.com/scyb/document.php?id=scyb10-1270-70980-2380010&type=toc&num=1", + "items": [ + { + "itemType": "bookSection", + "title": "American Electric Power Company, Inc. v. Connecticut", + "creators": [ + { + "lastName": "Jost", + "firstName": "Kenneth", + "creatorType": "author" + } + ], + "date": "2011", + "bookTitle": "Supreme Court Yearbook, 2010-2011", + "libraryCatalog": "CQ Press", + "place": "Washington, D.C., United States", + "publisher": "CQ Press", + "series": "Supreme Court Yearbook Online Edition", + "url": "http://library.cqpress.com/scyb/scyb10-1270-70980-2380010", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://library.cqpress.com/cqresearcher/search.php?fulltext=test&action=newsearch&sort=custom%3Asorthitsrank%2Cd&x=0&y=0", + "items": "multiple" + }, + { + "type": "web", + "url": "https://library.cqpress.com/cqresearcher/index.php", + "items": "multiple" + }, + { + "type": "web", + "url": "https://library.cqpress.com/scyb/toc.php?mode=scyb-topics&level=3&values=Environmental+Law%7EAir+Pollution", + "items": "multiple" + }, + { + "type": "web", + "url": "https://library.cqpress.com/pia/static.php?id=oepia112_index#b", + "items": "multiple" + }, + { + "type": "web", + "url": "https://library.cqpress.com/cqmagazine/", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/CROSBI.js b/translators/CROSBI.js new file mode 100644 index 0000000..22bb2b1 --- /dev/null +++ b/translators/CROSBI.js @@ -0,0 +1,227 @@ +{ + "translatorID": "fcabdbd7-e3e8-4f4a-9d78-25296417bdc5", + "label": "CROSBI", + "creator": "Abe Jellinek", + "target": "^https?://www\\.bib\\.irb\\.hr/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-07-09 22:29:09" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (doc.querySelector('meta[name="citation_title"]')) { + return "journalArticle"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('.search-results .citation-title'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', function (obj, item) { + item.attachments = []; + if (doc.querySelector('a.link-pdf')) { + item.attachments.push({ + title: 'Full Text PDF', + mimeType: 'application/pdf', + url: attr(doc, 'a.link-pdf', 'href') + }); + } + + item.complete(); + }); + + translator.getTranslatorObject(function (trans) { + trans.itemType = "journalArticle"; + trans.doWeb(doc, url); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.bib.irb.hr/1130838", + "items": [ + { + "itemType": "journalArticle", + "title": "Resorpcija korijena nakon luksacijske ozljede zuba - prikaz slučaja", + "creators": [ + { + "firstName": "Sarah", + "lastName": "Turjanski", + "creatorType": "author" + }, + { + "firstName": "Larisa", + "lastName": "Musić", + "creatorType": "author" + }, + { + "firstName": "Ivan", + "lastName": "Zajc", + "creatorType": "author" + }, + { + "firstName": "Mihovil", + "lastName": "Turčinović", + "creatorType": "author" + }, + { + "firstName": "Hrvoje", + "lastName": "Jurić", + "creatorType": "author" + } + ], + "date": "2021", + "abstractNote": "Ciljevi:Resorpcija korijena jest proces kojeg karakterizira gubitak tvrdog zubnog tkiva zbog klastične aktivnosti unutar ili izvan korijena zuba. Resorpcija trajnih zubi uvijek na staje kao posljedica određenih stanja ili događaja (npr. novotvorina, trauma, impaktirani zub). Cilj ovog prikaza slučaja jest predstaviti kasnu komplikaciju traume zuba nakon 8 godina od ozljede. Materijali i metode:Pacijentica, djevojčica u dobi od 8 godina u velja-či 2013. godine, dolazi na naš Zavod zbog traume zubi 11 i 12, 3 mjeseca nakon ozljede. Kroz anamnezu, klinički pregled i radiografsku analizu dijagnosticirana je intruzijska luk-sacija zuba 11 te ekstruzijska luksacija zuba 12 s nezavršenim rastom i razvojem. Učinio se test vitaliteta ozlijeđenih zubi te se kroz sljedećih nekoliko kontrola pratio njihov vitalitet. Nakon 7 mjeseci započet je postupak apeksifikacije na zubu 11. U rujnu 2014. napravilo se konačno punjenje zuba 11 gutaperka štapićima i pastom te se zub konačno restaurirao kompozitnom krunicom. Rezultati: Zbog izostanka simptoma pacijentica dolazi na kon-trolu tek u rujnu 2020., u dobi od 15 godina, kada joj je napravljena dekoronizacija zuba zbog napredovanja nadomjesne resorpcije apikalno, prisutne cervikalne upalne resorpcije te ankiloze zuba koja je dovela do infraokluzije i pomicanja marginalnog ruba gingive zu-ba 11 za 1.5mm u apikalnom smjeru. Kruna zuba je imobilizirana kompozitnim splintom ojačanim staklenim vlaknima. Zaključak:Kod traume zuba od izrazite je važnosti vrijeme koje prođe od nezgode do kliničkog pregleda i hitnog liječenja. Neke od nepoželjnih po-sljedica traume zuba za pacijenta su neizbježne, no njihova klinička slika i opseg se sigurno mogu ublažiti, pa čak i potpuno eliminirati uz pravovremeno liječenje. Cilj i glavna zada-ća specijalista dječje i preventivne dentalne medicine vrlo često jest ‘’kupovanje vreme-na’’ do završetka koštanog rasta i razvoja cjelokupnog stomatognatog sustava, što će u ko-načnici osigurati najbolje preduvjete za liječenje pacijenta, uzimajući u obzir sve biološke uvjete za dugoročna terapijska rješenja nakon komplikacija uzrokovanih traumom zuba.", + "language": "hr", + "libraryCatalog": "www.bib.irb.hr", + "pages": "112", + "publicationTitle": "Međunarodni kongres „Hrvatski dani dječje stomatologije 2020“ Online kongres Zagreb, 04. - 05. prosinca 2020.", + "url": "https://www.bib.irb.hr/1130838", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.bib.irb.hr/1113993", + "items": [ + { + "itemType": "journalArticle", + "title": "Assessment of Health-Promoting Lifestyle among Dental Students in Zagreb, Croatia", + "creators": [ + { + "firstName": "Larisa", + "lastName": "Musić", + "creatorType": "author" + }, + { + "firstName": "Tonći", + "lastName": "Mašina", + "creatorType": "author" + }, + { + "firstName": "Ivan", + "lastName": "Puhar", + "creatorType": "author" + }, + { + "firstName": "Laura", + "lastName": "Plančak", + "creatorType": "author" + }, + { + "firstName": "Valentina", + "lastName": "Kostrić", + "creatorType": "author" + }, + { + "firstName": "Mihaela", + "lastName": "Kobale", + "creatorType": "author" + }, + { + "firstName": "Ana", + "lastName": "Badovinac", + "creatorType": "author" + } + ], + "date": "2021", + "DOI": "10.3390/dj9030028", + "abstractNote": "As future healthcare professionals, dental medicine students are expected to exhibit healthy lifestyle behaviors. This study aims to assess the health-promoting behaviors among undergraduate dental medicine students of all six academic study years at the University of Zagreb, and determine their predictors. Students were invited to complete a two-part survey, consisting of a self-reported sociodemographic questionnaire and the Health-Promoting Lifestyle Profile II (HPLP II). Three hundred and forty-nine students completed the survey ; the response rate was 60.3%. The total mean HPLP II score was 2.64 ± 0.34. Students in the second academic study year scored the lowest (2.50 ± 0.33), and students in the sixth academic study year scored the highest (2.77 ± 0.32). Health responsibility was the overall lowest scored subcategory, while interpersonal relations was scored the highest. Female students reported lower spiritual growth and stress management than male students. Higher body mass index (BMI) was related to lower health responsibility. Smoking, place of residence and the age of participants did not seem to have an impact on health-promoting behaviors. Dental students at our faculty exhibit moderate health-promoting behaviors, even in the absence of a formal health-promoting course in the existing curriculum.", + "issue": "3", + "language": "en", + "libraryCatalog": "www.bib.irb.hr", + "pages": "1-10", + "publicationTitle": "Dentistry journal", + "url": "https://www.bib.irb.hr/1113993", + "volume": "9", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.bib.irb.hr/pretraga?operators=and|molekula|text|meta", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/CSIRO Publishing.js b/translators/CSIRO Publishing.js new file mode 100644 index 0000000..bc5833f --- /dev/null +++ b/translators/CSIRO Publishing.js @@ -0,0 +1,139 @@ +{ + "translatorID": "303c2744-ea37-4806-853d-e1ca67be6818", + "label": "CSIRO Publishing", + "creator": "Michael Berkowitz", + "target": "^https?://(www\\.)?publish\\.csiro\\.au/", + "minVersion": "1.0.0b4.r5", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-06-07 16:46:32" +} + +function detectWeb(doc, url) { + if (doc.evaluate('//a[@class="searchBoldBlue"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext() || doc.evaluate('//a[@class="linkjournal"]|//a[@class="journal_title"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { + return "multiple"; + } else if (url.indexOf("/view/journals/") != -1 || url.indexOf("paper") != -1) { + return "journalArticle"; + } +} + +function doWeb(doc, url) { + var articles = new Array(); + if (detectWeb(doc, url) == "multiple") { + var items = new Object(); + if (doc.evaluate('//a[@class="searchBoldBlue"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { + var arts = doc.evaluate('//a[@class="searchBoldBlue"]', doc, null, XPathResult.ANY_TYPE, null); + var art = arts.iterateNext(); + while (art) { + items[art.href] = art.textContent; + art = arts.iterateNext(); + } + } else if (doc.evaluate('//a[@class="linkjournal"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { + var arts = doc.evaluate('//a[@class="linkjournal"]', doc, null, XPathResult.ANY_TYPE, null); + var titles = doc.evaluate('//td[3]//td[1]/table/tbody/tr/td/b', doc, null, XPathResult.ANY_TYPE, null); + var art; + var title; + while ((art = arts.iterateNext()) && (title = titles.iterateNext())) { + items[art.href] = title.textContent; + } + } else if (doc.evaluate('//a[@class="journal_title"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { + var arts = doc.evaluate('//a[@class="journal_title"]', doc, null, XPathResult.ANY_TYPE, null); + while (art = arts.iterateNext()){ + items[art.href] = art.textContent; + } + + } + Zotero.selectItems(items, function (items) { + if (!items) { + return true; + } + for (var i in items) { + articles.push(i.match(/([^/=.htm]*)(.htm)?$/)[1]); + } + scrape(articles, function () { + Zotero.done(); + }); + }); + } else { + articles.push(url.match(/([^/=.htm]*)(.htm)?$/)[1]); + scrape(articles); + } +} + + +function scrape (link) { + for (i in link){ + var newURL = 'http://www.publish.csiro.au/view/journals/dsp_journal_retrieve_citation.cfm?ct=' + link[i] + '.ris'; + var pdfURL = 'http://www.publish.csiro.au/?act=view_file&file_id=' + link[i] + '.pdf'; + Zotero.Utilities.HTTP.doGet(newURL, function(text) { + var translator = Zotero.loadTranslator("import"); + translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); + translator.setString(text); + translator.setHandler("itemDone", function(obj, item) { + item.itemType = "journalArticle"; + if (item.notes[0]) { + item.abstractNote = item.notes[0].note; + } + if (item.abstractNote) item.abstractNote = item.abstractNote.replace(/[\n\t]/g, " ") + item.attachments = [ + {url:pdfURL, title:"CSIRO Publishing PDF", mimeType:"application/pdf"}, + {url:newURL, title:"CSIRO Publishing Snaphost", mimeType:"text/html"} + ]; + item.complete(); + }); + translator.translate(); + }); + } +}/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://www.publish.csiro.au/paper/BT04151.htm", + "items": [ + { + "itemType": "journalArticle", + "creators": [ + { + "lastName": "Humphreys", + "firstName": "W.F.", + "creatorType": "author" + } + ], + "notes": [], + "tags": [], + "seeAlso": [], + "attachments": [ + { + "title": "CSIRO Publishing PDF", + "mimeType": "application/pdf" + }, + { + "title": "CSIRO Publishing Snaphost", + "mimeType": "text/html" + } + ], + "title": "Aquifers: the ultimate groundwater-dependent ecosystems", + "publicationTitle": "Australian Journal of Botany", + "journalAbbreviation": "Aust. J. Bot.", + "date": "2006", + "volume": "54", + "issue": "2", + "pages": "115-132", + "url": "http://dx.doi.org/10.1071/BT04151", + "abstractNote": "Australian aquifers support diverse metazoan faunas comprising obligate groundwater inhabitants, largely crustaceans but also including insects, worms, gastropods, mites and fish. They typically comprise short-range endemics, often of relictual lineages and sometimes widely vicariant from their closest relatives. They have been confined to subterranean environments from a range of geological eras and may contain information on the deep history of aquifers. Obligate groundwater fauna (stygobites) occurs in the void spaces in karst, alluvial and fractured rock aquifers. They have convergent morphologies (reduction or loss of eyes, pigment, enhanced non-optic senses, vermiform body form) and depend on energy imported from the surface except in special cases of in situ chemoautotrophic energy fixation. In Australia, many stygofaunas in arid areas occur in brackish to saline waters, although they contain taxa from lineages generally restricted to freshwater systems. They may occur alongside species belonging to taxa considered typical of the marine littoral although far removed in space and time from marine influence. The ecological attributes of stygofauna makes them vulnerable to changes in habitat, which, combined with their taxonomic affinities, makes them a significant issue to biodiversity conservation. The interaction of vegetation and groundwater ecosystems is discussed and, in places, there are conservation issues common to both.", + "libraryCatalog": "CSIRO Publishing", + "accessDate": "CURRENT_TIMESTAMP", + "shortTitle": "Aquifers" + } + ] + }, + { + "type": "web", + "url": "http://www.publish.csiro.au/nid/65/issue/2496.htm", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/CSL JSON.js b/translators/CSL JSON.js new file mode 100644 index 0000000..38e71be --- /dev/null +++ b/translators/CSL JSON.js @@ -0,0 +1,203 @@ +{ + "translatorID": "bc03b4fe-436d-4a1f-ba59-de4d2d7a63f7", + "label": "CSL JSON", + "creator": "Simon Kornblith", + "target": "json", + "minVersion": "4.0.27", + "maxVersion": "", + "priority": 100, + "configOptions": { + "async": true + }, + "inRepository": true, + "translatorType": 3, + "lastUpdated": "2022-09-20 13:32:25" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2022 Simon Kornblith and Sebastian Karcher + + 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 parseInput() { + var str, json = ""; + + // Read in the whole file at once, since we can't easily parse a JSON stream. The + // chunk size here is pretty arbitrary, although larger chunk sizes may be marginally + // faster. We set it to 1MB. + while ((str = Z.read(1048576)) !== false) json += str; + + try { + return JSON.parse(json); + } + catch (e) { + Zotero.debug(e); + } + return false; +} + +function detectImport() { + /* eslint-disable camelcase */ + const CSL_TYPES = { article: true, "article-journal": true, "article-magazine": true, + "article-newspaper": true, bill: true, book: true, broadcast: true, + chapter: true, classic: true, collection: true, dataset: true, document: true, + entry: true, "entry-dictionary": true, "entry-encyclopedia": true, event: true, + figure: true, graphic: true, hearing: true, interview: true, legal_case: true, + legislation: true, manuscript: true, map: true, motion_picture: true, + musical_score: true, pamphlet: true, "paper-conference": true, patent: true, + performance: true, personal_communication: true, periodical: true, post: true, + "post-weblog": true, regulation: true, report: true, review: true, "review-book": true, + song: true, speech: true, standard: true, thesis: true, treaty: true, webpage: true }; + /* eslint-enable camelcase*/ + + + var parsedData = parseInput(); + if (!parsedData) return false; + + if (typeof parsedData !== "object") return false; + if (!(parsedData instanceof Array)) parsedData = [parsedData]; + + for (var i = 0; i < parsedData.length; i++) { + var item = parsedData[i]; + if (typeof item !== "object" || !item.type || !(item.type in CSL_TYPES)) { + return false; + } + } + return true; +} + +function doImport() { + if (typeof Promise == 'undefined') { + startImport( + function () {}, + function (e) { + throw e; + } + ); + } + else { + return new Promise(function (resolve, reject) { + startImport(resolve, reject); + }); + } + return false; +} + +function startImport(resolve, reject) { + try { + var parsedData = parseInput(); + if (!parsedData) resolve(); + if (!Array.isArray(parsedData)) parsedData = [parsedData]; + importNext(parsedData, resolve, reject); + } + catch (e) { + reject(e); + } +} + +function importNext(data, resolve, reject) { + try { + var d; + while (d = data.shift()) { // eslint-disable-line no-cond-assign + var item = new Z.Item(); + + // Default to 'article' (Document) if no type given. 'type' is required in CSL-JSON, + // but some DOI registration agencies provide bad data, and this is better than failing. + // (itemFromCSLJSON() will already default to 'article' for unknown 'type' values.) + // + // Technically this should go in the DOI Content Negotation translator, but it's easier + // to do this here after the JSON has been parsed, and it might benefit other translators. + // + // This is just for imports from other translators. File/clipboard imports without + // 'type' still won't work, because a valid 'type' is required in detectImport(). + // + // https://forums.zotero.org/discussion/85273/error-importing-dois-via-add-item-by-identifier + if (!d.type) { + d.type = 'article'; + } + + ZU.itemFromCSLJSON(item, d); + var maybePromise = item.complete(); + if (maybePromise) { + maybePromise.then(function () { + importNext(data, resolve, reject); + }); + return; + } + } + } + catch (e) { + reject(e); + } + + resolve(); +} + +function doExport() { + var item, data = []; + while (item = Z.nextItem()) { // eslint-disable-line no-cond-assign + if (item.extra) { + item.extra = item.extra.replace(/(?:^|\n)citation key\s*:\s*([^\s]+)(?:\n|$)/i, (m, citationKey) => { // eslint-disable-line no-loop-func + item.citationKey = citationKey; + return '\n'; + }).trim(); + } + var cslItem = ZU.itemToCSLJSON(item); + if (item.citationKey) cslItem.id = item.citationKey; + data.push(cslItem); + } + Z.write(JSON.stringify(data, null, "\t")); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "import", + "input": "[\n\t{\n\t\t\"id\": \"http://zotero.org/users/96641/items/BDQRTS3T\",\n\t\t\"type\": \"book\",\n\t\t\"title\": \"Stochastic biomathematical models: With applications to neuronal modeling\",\n\t\t\"collection-title\": \"Lecture notes in mathematics\",\n\t\t\"publisher\": \"Springer\",\n\t\t\"publisher-place\": \"Heidelberg\",\n\t\t\"volume\": \"2058\",\n\t\t\"number-of-pages\": \"206\",\n\t\t\"event-place\": \"Heidelberg\",\n\t\t\"ISBN\": \"978-3-642-32156-6\",\n\t\t\"language\": \"en\",\n\t\t\"author\": [\n\t\t\t{\n\t\t\t\t\"family\": \"Bachar\",\n\t\t\t\t\"given\": \"Mostafa\"\n\t\t\t}\n\t\t],\n\t\t\"issued\": {\n\t\t\t\"date-parts\": [\n\t\t\t\t[\n\t\t\t\t\t\"2013\",\n\t\t\t\t\t1,\n\t\t\t\t\t1\n\t\t\t\t]\n\t\t\t]\n\t\t}\n\t}\n]", + "items": [ + { + "itemType": "book", + "title": "Stochastic biomathematical models: With applications to neuronal modeling", + "creators": [ + { + "lastName": "Bachar", + "firstName": "Mostafa", + "creatorType": "author" + } + ], + "date": "January 1, 2013", + "ISBN": "978-3-642-32156-6", + "itemID": "http://zotero.org/users/96641/items/BDQRTS3T", + "language": "en", + "numPages": "206", + "place": "Heidelberg", + "publisher": "Springer", + "series": "Lecture notes in mathematics", + "volume": "2058", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/CSV.js b/translators/CSV.js new file mode 100644 index 0000000..0d24e02 --- /dev/null +++ b/translators/CSV.js @@ -0,0 +1,294 @@ +{ + "translatorID": "25f4c5e2-d790-4daa-a667-797619c7e2f2", + "label": "CSV", + "creator": "Philipp Zumstein and Aurimas Vinckevicius", + "target": "csv", + "minVersion": "4.0.26", + "maxVersion": "", + "priority": 100, + "displayOptions": { + "exportCharset": "UTF-8xBOM", + "exportNotes": false + }, + "inRepository": true, + "translatorType": 2, + "lastUpdated": "2022-06-28 19:45:59" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2014 Philipp Zumstein, Aurimas Vinckevicius + + 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 ***** +*/ + +// The export will be stuck if you try to export to a csv-file +// which is already opend with Excel. Thus, close it before or rename +// the new csv-file. + +var recordDelimiter = "\n", + fieldDelimiter = ",", + fieldWrapperCharacter = '"', + replaceNewlinesWith = " ", // Set to `false` for no replacement + valueSeparator = "; "; // For multi-value fields, like creators, tags, etc. +var normalizeDate = true; // Set to `false` if the date should be written as it is + +// Exported columns in order of export +var exportedFields = [ + // "Important" metadata + "key", + "itemType", + "publicationYear", + "creators/author", + "title", + "publicationTitle", + "ISBN", + "ISSN", + "DOI", + "url", + "abstractNote", + "date", + "dateAdded", + "dateModified", + // Other common fields + "accessDate", + "pages", + "numPages", + "issue", + "volume", + "numberOfVolumes", + "journalAbbreviation", + "shortTitle", + "series", + "seriesNumber", + "seriesText", + "seriesTitle", + "publisher", + "place", + "language", + "rights", + "type", + "archive", + "archiveLocation", + "libraryCatalog", + "callNumber", + "extra", + "notes", + "attachments/path", + "attachments/url", + "tags/own", + "tags/automatic", + // Creators + "creators/editor", + "creators/seriesEditor", + "creators/translator", + "creators/contributor", + "creators/attorneyAgent", + "creators/bookAuthor", + "creators/castMember", + "creators/commenter", + "creators/composer", + "creators/cosponsor", + "creators/counsel", + "creators/interviewer", + "creators/producer", + "creators/recipient", + "creators/reviewedAuthor", + "creators/scriptwriter", + "creators/wordsBy", + "creators/guest", + // Other fields + "number", + "edition", + "runningTime", + "scale", + "medium", + "artworkSize", + "filingDate", + "applicationNumber", + "assignee", + "issuingAuthority", + "country", + "meetingName", + "conferenceName", + "court", + "references", + "reporter", + "legalStatus", + "priorityNumbers", + "programmingLanguage", + "version", + "system", + "code", + "codeNumber", + "section", + "session", + "committee", + "history", + "legislativeBody" +]; + +// Creators that should map to base type +var creatorBaseTypes = { + interviewee: 'author', + director: 'author', + artist: 'author', + sponsor: 'author', + contributor: 'author', + inventor: 'author', + cartographer: 'author', + performer: 'author', + presenter: 'author', + podcaster: 'author', + programmer: 'author' +}; + +var exportNotes; +function doExport() { + exportNotes = Zotero.getOption("exportNotes"); + // Until we fix UTF-8xBOM export, we'll write the BOM manually + Zotero.write("\uFEFF"); + writeColumnHeaders(); + var item; + while ((item = Zotero.nextItem())) { + if (item.itemType == "note" || item.itemType == "attachment") continue; + let line = ''; + for (let i = 0; i < exportedFields.length; i++) { + line += (i ? fieldDelimiter : recordDelimiter) + + getValue(item, exportedFields[i]); + } + Zotero.write(line); + } +} + +var escapeRE = new RegExp(fieldWrapperCharacter, 'g'); +function escapeValue(str) { + if (typeof replaceNewlinesWith == 'string') { + str = str.replace(/[\r\n]+/g, replaceNewlinesWith); + } + + return str.replace(escapeRE, fieldWrapperCharacter + '$&'); +} + +function writeColumnHeaders() { + var line = ''; + for (let i = 0; i < exportedFields.length; i++) { + line += (i ? fieldDelimiter : '') + fieldWrapperCharacter; + var label = exportedFields[i].split('/'); + switch (label[0]) { + case 'creators': + label = label[1]; + break; + case 'tags': + label = (label[1] == 'own' ? 'Manual Tags' : 'Automatic Tags'); + break; + case 'attachments': + label = (label[1] == 'url' ? 'Link Attachments' : 'File Attachments'); + break; + default: + label = label[0]; + } + // Split individual words in labels and capitalize property + label = label[0].toUpperCase() + label.substr(1); + label = label.replace(/([a-z])([A-Z])/g, '$1 $2'); + + line += escapeValue(label) + fieldWrapperCharacter; + } + Zotero.write(line); +} + +function getValue(item, field) { + var split = field.split('/'), value = fieldWrapperCharacter; + switch (split[0]) { + // Get key from URI (which on translation-server might just be the key) + case 'key': + value += item.uri.match(/([A-Z0-9]+)$/)[1]; + break; + case 'publicationYear': + if (item.date) { + var date = ZU.strToDate(item.date); + if (date.year) value += escapeValue(date.year); + } + break; + case 'creators': + var creators = []; + for (let i = 0; i < item.creators.length; i++) { + var creator = item.creators[i]; + var baseCreator = creatorBaseTypes[creator.creatorType]; + if (creator.creatorType != split[1] && baseCreator !== split[1]) { + continue; + } + creators.push(creator.lastName + + (creator.firstName ? ', ' + creator.firstName : '')); + } + value += escapeValue(creators.join(valueSeparator)); + break; + case 'tags': + var tags = []; + var tagType = split[1] == 'automatic' ? 1 : 0; + for (let i = 0; i < item.tags.length; i++) { + if ((item.tags[i].type || 0) === tagType) { + tags.push(item.tags[i].tag); + } + } + value += escapeValue(tags.join(valueSeparator)); + break; + case 'attachments': + var paths = []; + for (let i = 0; i < item.attachments.length; i++) { + if (split[1] == 'path') { + paths.push(item.attachments[i].localPath); + } + else if (split[1] == 'url' && !item.attachments[i].localPath) { + paths.push(item.attachments[i].url); + } + } + value += escapeValue(paths.join(valueSeparator)); + break; + case 'notes': + if (!exportNotes) break; + var notes = []; + for (let i = 0; i < item.notes.length; i++) { + notes.push(item.notes[i].note); + } + value += escapeValue(notes.join(valueSeparator)); + break; + case 'date': + if (item.date) { + var dateISO = ZU.strToISO(item.date); + if (normalizeDate && dateISO) { + value += dateISO; + } + else { + value += item.date; + } + } + break; + default: + if (item[field] || (item.uniqueFields && item.uniqueFields[field])) { + value += escapeValue('' + (item[field] || (item.uniqueFields && item.uniqueFields[field]))); + } + } + return value + fieldWrapperCharacter; +} + +/** BEGIN TEST CASES **/ +var testCases = [ +] +/** END TEST CASES **/ diff --git a/translators/Cairn.info.js b/translators/Cairn.info.js new file mode 100644 index 0000000..411382c --- /dev/null +++ b/translators/Cairn.info.js @@ -0,0 +1,368 @@ +{ + "translatorID": "f46cc903-c447-47d6-a2cf-c75ed22dc96b", + "label": "Cairn.info", + "creator": "Sebastian Karcher, Sylvain Machefert and Nicolas Chachereau", + "target": "^https?://www\\.cairn\\.info/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-10-23 08:08:57" +} + +/* + CAIRN.info Translator + Copyright (C) 2013-2022 Sebastian Karcher + + This program 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. + + This program 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 this program. If not, see . +*/ + +function detectWeb(doc, _url) { + let breadcrumbPage = text(doc, '#tab-article, #tab-resume'); + // Z.debug(breadcrumbPage) + if (breadcrumbPage == "Ouvrage collectif") { + return "book"; + } + else if (breadcrumbPage == "Article") { + return "journalArticle"; + } + else if (breadcrumbPage == "Chapitre") { + return "bookSection"; + } + else if (breadcrumbPage == "Résumé") { + let typeDocument = ZU.xpathText(doc, '//ol[@class="breadcrumb"]/li[2]/a'); + // Z.debug(typeDocument) + if (typeDocument == "Revues") { + return "journalArticle"; + } + else if (typeDocument == "Ouvrages") { + return "bookSection"; + } + } + + if (doc.querySelectorAll('.article-list-item .titre-article')) { + return "multiple"; + } + + return false; +} + + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + + var rows = doc.querySelectorAll('.article-list-item .titre-article'); + for (let row of rows) { + let href = attr(row, 'a', 'href'); + 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 (await 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); + } +} + +async function scrape(doc) { + let risURL = attr(doc, '#export-citation [data-webtrends-action="clickOnExportZotero"]', 'href'); + // Z.debug(risURL) + + let pdfLink = attr('[name="citation_pdf_url"]', 'content'); + let keywords = attr('[name="article-mot_cle"]', 'content'); + let issn = attr('[name="citation_issn"]', 'content'); + let risText = await requestText(risURL); + // Z.debug(risText); + let translator = Zotero.loadTranslator('import'); + translator.setTranslator('32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7'); // RIS + translator.setString(risText); + translator.setHandler('itemDone', (_obj, item) => { + if (item.ISSN) { + item.ISSN = ZU.cleanISSN(item.ISSN); + } + if (!item.ISSN && issn) { + item.ISSN = issn; + } + if (keywords) { + let keywordArray = keywords.split(/\s*;\s*/); + item.tags = keywordArray; + } + if (item.language) { + item.language = item.language.toLowerCase(); + } + + item.archive = ""; + // There's some attachement information in the RIS that we discard + item.attachments = []; + + if (pdfLink) { + item.attachments.push({ + url: pdfLink, + title: 'Full Text PDF', + mimeType: 'application/pdf' + }); + } + + item.attachments.push({ + title: 'Snapshot', + document: doc + }); + + item.complete(); + }); + await translator.translate(); +} + + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.cairn.info/revue-d-economie-du-developpement-2012-4.htm", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.cairn.info/resultats_recherche.php?searchTerm=artiste", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.cairn.info/publications-de-Topalov-Christian--1020.htm", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.cairn.info/resume.php?ID_ARTICLE=RESS_521_0065", + "items": [ + { + "itemType": "journalArticle", + "title": "Les enjeux normatifs et politiques de la diffusion de la recherche. Bénéfices sociaux et libre accès", + "creators": [ + { + "lastName": "Landes", + "firstName": "Xavier", + "creatorType": "author" + } + ], + "date": "2014", + "DOI": "10.4000/ress.2663", + "ISSN": "0048-8046", + "abstractNote": "Le savoir est une activité coopérative essentielle pour les sociétés industrielles. Base de leur modèle économique, il produit par ailleurs de nombreux bénéfices matériels, socio-politiques et distants, en particulier au travers de sa diffusion. Dans ce contexte, il devient important de déterminer les principes qui devraient orienter la répartition des coûts qu’une telle diffusion implique. La Recommandation de la Commission européenne du 17 juillet 2012 va dans ce sens en proposant de rendre gratuit l’accès aux résultats des recherches financées par des fonds publics. Elle offre ainsi un cadre idéal pour discuter de la juste répartition des coûts de diffusion du savoir.", + "issue": "1", + "journalAbbreviation": "Revue européenne des sciences sociales", + "language": "fr", + "libraryCatalog": "Cairn.info", + "pages": "65-92", + "publicationTitle": "Revue européenne des sciences sociales", + "shortTitle": "Les enjeux normatifs et politiques de la diffusion de la recherche", + "url": "https://www.cairn.info/revue-europeenne-des-sciences-sociales-2014-1-page-65.htm", + "volume": "52-1", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "bénéfices sociaux" + }, + { + "tag": "libre accès" + }, + { + "tag": "publications académiques" + }, + { + "tag": "recherche" + }, + { + "tag": "État" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cairn.info/resume.php?ID_ARTICLE=RHIS_121_0049", + "items": [ + { + "itemType": "journalArticle", + "title": "Le mouvement pétitionnaire pour la restauration d'Henri V (automne 1873-hiver 1874). Tactique politique et expression d'un légitimisme populaire", + "creators": [ + { + "lastName": "Derennes", + "firstName": "Éric", + "creatorType": "author" + } + ], + "date": "2012", + "DOI": "10.3917/rhis.121.0049", + "ISSN": "0035-3264", + "abstractNote": "Résumé1873 marque le dernier temps du possible pour une éventuelle restauration monarchique dans la personne du comte de Chambord. Le mouvement pétitionnaire populaire qui naît à l’automne 1873 permet à un peuple royaliste de faire irruption sur la scène politique, en s’appropriant un des outils codifiés sous la Révolution : le droit de pétition. Au-delà du refus du prince exprimé dans sa lettre de Salzbourg (27 octobre 1873) d’abandonner son drapeau blanc et qui empêche la restauration monarchique, les milliers de pétitions royalistes tentèrent de faire entendre les voix habituellement muettes d’artisans et d’agriculteurs, de citadins et de ruraux, d’intellectuels et d’illettrés, d’hommes et de femmes du peuple de la diversité française. L’Ouest bocager et le Midi, le Nord et les pays riverains de la Garonne affirment leur foi « inséparatiste » suivant en cela celle du prince en exil : à la fois royaliste en politique et catholique en religion. Malgré son importance, ce mouvement pétitionnaire apparaît comme le dernier sursaut d’une époque révolue ; quelques pétitions seulement ont un écho à la Chambre des députés. Cela explique en partie son échec à faire pression sur des parlementaires qui sont davantage attentifs à tracer une voie médiane entre monarchie et république dans le dessein de préserver l’avenir du pays.", + "issue": "1", + "journalAbbreviation": "Revue historique", + "language": "fr", + "libraryCatalog": "Cairn.info", + "pages": "49-99", + "publicationTitle": "Revue historique", + "url": "https://www.cairn.info/revue-historique-2012-1-page-49.htm", + "volume": "661", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "assemblée nationale" + }, + { + "tag": "député" + }, + { + "tag": "légitimisme" + }, + { + "tag": "pétition" + }, + { + "tag": "restauration" + }, + { + "tag": "royaliste" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cairn.info/resume.php?ID_ARTICLE=RFS_523_0537", + "items": [ + { + "itemType": "journalArticle", + "title": "Transformation de l'État ou changement de régime ? De quelques confusions en théorie et sociologie de l'État", + "creators": [ + { + "lastName": "Du Gay", + "firstName": "Paul", + "creatorType": "author" + }, + { + "lastName": "Scott", + "firstName": "Alan", + "creatorType": "author" + } + ], + "date": "2011", + "DOI": "10.3917/rfs.523.0537", + "ISSN": "0035-2969", + "abstractNote": "Cet article a pour objet la question de la définition de l’État afin de rendre compte de ses transformations contemporaines. Fermement inscrits dans la tradition wébérienne, les auteurs développent une critique des travaux, qu’ils soient néomarxistes ou néowébériens, mesurant le changement de l’État contemporain par rapport à l’État tel qu’il a été défini pendant les Trente Glorieuses. La critique porte à la fois sur la périodisation et sur la conceptualisation. Partant d’une conception minimaliste de l’État défini en termes de fonctions (sécurité) et de ses moyens, de ses institutions, ils mettent en évidence la confusion d’une partie de la littérature et suggèrent de bien différencier la question de l’État de celle du gouvernement. Soucieux de réhabiliter la longue durée de l’État, ils s’appuient tout d’abord sur les travaux de l’École de Cambridge d’histoire de la pensée politique et leur méthode dite « Ideas in context », afin de montrer la lente émergence de l’État et de l’idée de l’État, invalidant ainsi toute perspective de transformation radicale de période courte. Prenant des points de comparaison plus espacés dans le passé, ils suggèrent au contraire la remarquable permanence de l’État. Ils s’appuient ensuite sur la théorie de l’État constitutionnel de Gianfranco Poggi pour affiner leur conception minimaliste de l’État. Enfin, ils mobilisent la notion de régime développée par Raymond Aron pour caractériser une partie des transformations observées, labellisées transformations de l’État de manière erronée puisqu’elles concernent le gouvernement et la politique. Cette proposition est testée à partir des travaux de Colin Crouch sur le keynésianisme privé.", + "issue": "3", + "journalAbbreviation": "Revue française de sociologie", + "language": "fr", + "libraryCatalog": "Cairn.info", + "pages": "537-557", + "publicationTitle": "Revue française de sociologie", + "shortTitle": "Transformation de l'État ou changement de régime ?", + "url": "https://www.cairn.info/revue-francaise-de-sociologie-1-2011-3-page-537.htm", + "volume": "52", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cairn.info/jeu-d-echecs-comme-representation--9782728835904-page-111.htm?contenu=resume", + "items": [ + { + "itemType": "bookSection", + "title": "Des figurines de chair et de sang (sur l'échiquier de la passion), d'après une mise en scène de Daniel Mesguich : La Seconde Surprise de l'amour de Marivaux", + "creators": [ + { + "lastName": "Lenglet", + "firstName": "Sébastien", + "creatorType": "author" + } + ], + "date": "2009", + "ISBN": "9782728835904", + "abstractNote": "Sous le titre Le Jeu d’échecs comme représentation : univers clos ou reflet du monde ?, une publication en ligne dans la collection « Actes de la recherche à l’ENS » vient saluer le travail accompli par une équipe de jeunes chercheurs sous la direction d’Amandine Mussou (2002) et Sarah Troche.\nCapables d’absorber le joueur au point de l’abstraire du monde dans lequel il évolue, les échecs reposent d’une part sur le spectacle captivant de figurines en mouvement, d’autre part sur une structure géométrique renvoyant à un nombre infini de combinaisons. Entre incarnation et abstraction, les échecs fascinent : la richesse de leurs représentations dans la littérature et les arts en est le témoin. La dimension spéculaire des échecs est souvent admise comme une évidence. Bien plus qu’un pur divertissement de la pensée, les échecs sont là pour désigner autre chose, un ailleurs, un au-delà qui reflèterait, fidèlement ou en le déformant, le monde réel. Cette puissance allégorique des échecs a été perçue dès leur implantation en Occident. Le Moyen Âge exploite en effet les possibilités du jeu en proposant plusieurs types d’interprétations symboliques, que l’on trouve notamment décrites au début du Livre des eschez amoureux moralisés, dans les premières années du XVe siècle : les pièces de l’échiquier peuvent reproduire la société civile, être à l’image de la stratégie militaire, représenter les combinaisons infinies du ciel et des planètes, ou servir d’allégorie aux batailles amoureuses. La lecture allégorique du jeu a perduré, il suffit de se rappeler la partie que le Chevalier Block joue contre la Mort dans Le Septième Sceau d’Ingmar Bergman pour s’en convaincre. L’origine des échecs remonte au début de notre ère, en Inde, où le jeu s’appelait Tchaturanga, « le jeu des quatre rois ». Il passe ensuite en Perse et se transforme au cours de ses pérégrinations, s’adaptant aux nouvelles sociétés dans lesquelles il s’implante. Les échecs n’ont plus grand-chose à voir avec le jeu indien lorsqu’ils arrivent en Occident autour du Xe siècle.", + "bookTitle": "Le jeu d'échecs comme représentation", + "extra": "DOI: 10.3917/ulm.musso.2009.01.0111", + "language": "fr", + "libraryCatalog": "Cairn.info", + "pages": "111-119", + "place": "Paris", + "publisher": "Éditions Rue d'Ulm", + "series": "Actes de la recherche à l’Ens", + "shortTitle": "Des figurines de chair et de sang (sur l'échiquier de la passion), d'après une mise en scène de Daniel Mesguich", + "url": "https://www.cairn.info/jeu-d-echecs-comme-representation--9782728835904-p-111.htm", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/CalMatters.js b/translators/CalMatters.js new file mode 100644 index 0000000..f94406f --- /dev/null +++ b/translators/CalMatters.js @@ -0,0 +1,228 @@ +{ + "translatorID": "64b634ce-3957-4c89-bcce-7603fe552780", + "label": "CalMatters", + "creator": "Abe Jellinek", + "target": "^https?://calmatters\\.org/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-07-07 18:07:46" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (doc.querySelector('meta[property="article:publisher"]')) { + return "newspaperArticle"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('h2.entry-title > a'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', function (obj, item) { + item.section = text(doc, '.cat-links a'); + + if (!item.creators.length) { + // grab just the first .byline + let byline = doc.querySelector('.byline'); + for (let author of byline.querySelectorAll('.author a')) { + item.creators.push(ZU.cleanAuthor(author.textContent, 'author')); + } + } + + item.complete(); + }); + + translator.getTranslatorObject(function (trans) { + trans.itemType = "newspaperArticle"; + trans.doWeb(doc, url); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://calmatters.org/california-divide/2021/07/california-mothers-return-work/", + "items": [ + { + "itemType": "newspaperArticle", + "title": "Mothers struggle to return to work as California reopens", + "creators": [ + { + "firstName": "Jesse", + "lastName": "Bedayn", + "creatorType": "author" + } + ], + "date": "2021-07-07T12:30:00+00:00", + "abstractNote": "As California opens back up, people are rejoining the workforce. But for mothers, economic recovery may not kick in until school returns.", + "language": "en-US", + "libraryCatalog": "calmatters.org", + "publicationTitle": "CalMatters", + "section": "California Divide", + "url": "https://calmatters.org/california-divide/2021/07/california-mothers-return-work/", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://calmatters.org/california-divide/2021/07/look-up-california-stimulus-golden-state/", + "items": [ + { + "itemType": "newspaperArticle", + "title": "Look up your Golden State Stimulus amount", + "creators": [ + { + "firstName": "Erica", + "lastName": "Yee", + "creatorType": "author" + }, + { + "firstName": "Frida", + "lastName": "Qi", + "creatorType": "author" + }, + { + "firstName": "Jackie", + "lastName": "Botts", + "creatorType": "author" + } + ], + "date": "2021-07-01T12:30:00+00:00", + "abstractNote": "Check this calculator to see if you're eligible for the Golden State Stimulus — and how much you'll get from California.", + "language": "en-US", + "libraryCatalog": "calmatters.org", + "publicationTitle": "CalMatters", + "section": "California Divide", + "url": "https://calmatters.org/california-divide/2021/07/look-up-california-stimulus-golden-state/", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://calmatters.org/housing/2021/07/california-eviction-moratorium-tenants/", + "items": [ + { + "itemType": "newspaperArticle", + "title": "Where are tenants falling through the cracks of California eviction ban?", + "creators": [ + { + "firstName": "Manuela", + "lastName": "Tobias", + "creatorType": "author" + }, + { + "firstName": "Nigel", + "lastName": "Duara", + "creatorType": "author" + }, + { + "firstName": "John Osborn", + "lastName": "D'Agostino", + "creatorType": "author" + } + ], + "date": "2021-07-01T12:30:00+00:00", + "abstractNote": "Landlords and sheriffs are evicting renters at higher rates in the Central Valley, while Bay Area counties have added protections for tenants.", + "language": "en-US", + "libraryCatalog": "calmatters.org", + "publicationTitle": "CalMatters", + "section": "Housing", + "url": "https://calmatters.org/housing/2021/07/california-eviction-moratorium-tenants/", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://calmatters.org/?s=gavin", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/Calisphere.js b/translators/Calisphere.js new file mode 100644 index 0000000..bb2776e --- /dev/null +++ b/translators/Calisphere.js @@ -0,0 +1,355 @@ +{ + "translatorID": "80505478-d42e-4920-8c33-4f863d4ce513", + "label": "Calisphere", + "creator": "Abe Jellinek", + "target": "^https://calisphere\\.org/(item/|search/)", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-07-07 21:01:11" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (doc.querySelector('.meta-block__list')) { + for (let type of doc.querySelectorAll('.meta-block__list > .meta-block__type')) { + if (type.textContent.trim() == 'Type') { + switch (type.nextElementSibling.innerText.trim().toLowerCase()) { + case 'text': + return 'document'; + case 'image': + return 'artwork'; + case 'moving image': + return 'videoRecording'; + case 'sound': + return 'audioRecording'; + case 'dataset': + return 'document'; + case 'physical object': + return 'artwork'; + } + break; + } + } + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('.thumbnail__link'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + let item = new Zotero.Item(detectWeb(doc, url)); + + item.title = text(doc, '[itemprop="name"]'); + item.abstractNote = text(doc, '[itemprop="description"]'); + item.date = ZU.strToISO(text(doc, '[itemprop="dateCreated"]')); + + // sometimes the last language line will be the ISO code! + let languages = text(doc, '[itemprop="inLanguage"]').split(/\s/); + item.language = languages[languages.length - 1]; + + item.url = attr(doc, 'link[rel="canonical"]', 'href') || url; + item.archive = text(doc, '[itemprop="isPartOf"]'); + item.libraryCatalog = 'Calisphere'; + + let authors = innerText(doc, '[itemprop="creator"]'); + if (authors) { + for (let author of authors.split('\n')) { + let type = 'author'; + if (item.itemType == 'artwork') { + type = 'artist'; + } + else if (item.itemType == 'videoRecording' + || item.itemType == 'audioRecording') { + type = 'contributor'; // hard to tell from the page + } + + item.creators.push(ZU.cleanAuthor( + author, + type, + true + )); + } + } + + item.tags = innerText(doc, '[itemprop="about"]') + .split('\n') + .map(tag => ({ tag })); + + if (doc.querySelector('a.obj__link')) { + item.attachments.push({ + title: 'Source', + mimeType: 'text/html', + url: attr(doc, 'a.obj__link', 'href') + }); + } + + item.complete(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://calisphere.org/item/829e5da7-6ff0-4a60-82d3-b3246d00d9ca/", + "items": [ + { + "itemType": "document", + "title": "Field crops newsletter: allelopathic effect of alfalfa on sugarbeets; safflower for 1989?; U.C. regional wheat tests; U.C. regional barley tests; U.C. regional alfalfa variety yield trials; early beet planting; sustainable agriculture--program announcement; ecological farm conference; corn test plot results", + "creators": [ + { + "firstName": "Franz R.", + "lastName": "Kegel", + "creatorType": "author" + } + ], + "date": "1988-11", + "abstractNote": "Funding: Digitization funded in part by a National Historical Publications and Records Commission (NHPRC) Major Initiatives Grant (RM-100281) awarded to the University of California, Merced Library.", + "archive": "Fresno County, UC Cooperative Extension Records", + "language": "eng", + "libraryCatalog": "Calisphere", + "shortTitle": "Field crops newsletter", + "url": "https://calisphere.org/item/829e5da7-6ff0-4a60-82d3-b3246d00d9ca/", + "attachments": [ + { + "title": "Source", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "alfalfa" + }, + { + "tag": "allelopathy" + }, + { + "tag": "sugar beet" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://calisphere.org/item/a63418fba6033a5c00ae1c0230e4375b/", + "items": [ + { + "itemType": "artwork", + "title": "Son! Do you know that your seed corn will grow? Get your seed corn now. The seed corn situation is the worst in the history of the state. If wheat or oats fail, we can plant corn and grow a paying crop ... Corn is Illinois' greatest crop", + "creators": [ + { + "firstName": "John T.", + "lastName": "McCutcheon", + "creatorType": "artist" + } + ], + "date": "1917", + "archive": "Hoover Institution Digital Collections", + "libraryCatalog": "Calisphere", + "shortTitle": "Son! Do you know that your seed corn will grow?", + "url": "https://calisphere.org/item/a63418fba6033a5c00ae1c0230e4375b/", + "attachments": [ + { + "title": "Source", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://calisphere.org/item/fd3fad62ed17fab44be94069beadbdde/", + "items": [ + { + "itemType": "videoRecording", + "title": "Atlas I Serparation Test, Atlas IIAS SRB Test, Atlas IIA Test, Fairing Test HACL Video 00008", + "creators": [], + "abstractNote": "Film from the Atlas Centaur Heritage Film Collection which was donated to the San Diego Air and Space Museum by Lockheed Martin and United Launch Alliance. The Collection contains 3,000 reels of 16-millimeter film. From the archives of the San Diego Air and Space Museum http://www.sandiegoairandspace.org/research/ Please do not use for commercial purposes without permission.", + "archive": "Moving Image Collection", + "libraryCatalog": "Calisphere", + "url": "https://calisphere.org/item/fd3fad62ed17fab44be94069beadbdde/", + "attachments": [ + { + "title": "Source", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "Atlas" + }, + { + "tag": "Atlas Centaur" + }, + { + "tag": "Atlas IIA" + }, + { + "tag": "Atlas Missile" + }, + { + "tag": "Atlas Rocket" + }, + { + "tag": "Lockheed Martin Missile Atlas Centaur Heritage Film Collection Convair General Dynamics" + }, + { + "tag": "UAL" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://calisphere.org/item/977c7c5e19b2e32fea03596d91975c2d/", + "items": [ + { + "itemType": "videoRecording", + "title": "Interview with Cornelis de Kluyver", + "creators": [ + { + "firstName": "Cornelis A.", + "lastName": "De Kluyver", + "creatorType": "contributor" + } + ], + "date": "2001-12-03", + "abstractNote": "Cornelis de Kluyver was dean of the Drucker School from 1999 to 2006. Here he talks about some of his humorous encounters with Peter Drucker and what it was like to be his \"boss\" as dean, referring to Drucker as a \"benevolent mentor\". He also discusses Drucker's European education and background as well as his experience as a journalist.", + "archive": "Drucker Archives", + "language": "English", + "libraryCatalog": "Calisphere", + "url": "https://calisphere.org/item/977c7c5e19b2e32fea03596d91975c2d/", + "attachments": [ + { + "title": "Source", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "De Kluyver, Cornelis A" + }, + { + "tag": "Drucker, Peter F. (Peter Ferdinand), 1909-2005" + }, + { + "tag": "Interviews" + }, + { + "tag": "Universities and colleges - Faculty" + }, + { + "tag": "Universities and colleges - United States - Administration" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://calisphere.org/item/dcfef906d97891a33d602e75fc6c9524/", + "items": [ + { + "itemType": "audioRecording", + "title": "H.E. Barney Jewett oral history interview", + "creators": [ + { + "lastName": "Ontario City Library", + "creatorType": "contributor" + }, + { + "firstName": "Robert H.", + "lastName": "Collins", + "creatorType": "contributor" + } + ], + "date": "1977", + "abstractNote": "H.E. Jewett: Came from Iowa in 1935; house-1889 moved to present site in 1912;off Hwy 66 orange trees everywhere;came out to Ontario in 1950;main crop in Chino was potatoes and corn;Main crop is green feed, corn, alfalfa; Pacific electric, electric buses,quiet, smog free-Big red car to San Bernardino,system sold to Mexico City;Mass transportation;Earthquakes-1889,​1​9​2​0​'​s​, 1950's, and 1971. California Preservation Service", + "archive": "California Revealed from Ontario City Library, Robert E. Ellingwood Model Colony History Room", + "language": "English", + "libraryCatalog": "Calisphere", + "url": "https://calisphere.org/item/dcfef906d97891a33d602e75fc6c9524/", + "attachments": [ + { + "title": "Source", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://calisphere.org/search/?q=corn", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/Camara Brasileira do Livro ISBN.js b/translators/Camara Brasileira do Livro ISBN.js new file mode 100644 index 0000000..be20df3 --- /dev/null +++ b/translators/Camara Brasileira do Livro ISBN.js @@ -0,0 +1,842 @@ +{ + "translatorID": "cdb5c893-ab69-4e96-9b5c-f4456d49ddd8", + "label": "Câmara Brasileira do Livro ISBN", + "creator": "Abe Jellinek", + "target": "", + "minVersion": "5.0", + "maxVersion": "", + "priority": 98, + "inRepository": true, + "translatorType": 8, + "lastUpdated": "2023-09-26 16:11:18" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2023 Abe Jellinek + + 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 detectSearch(items) { + items = cleanData(items); + return !!items.length; +} + +async function doSearch(items) { + items = cleanData(items); + for (let { ISBN } of items) { + let search = ISBN; + if (ISBN.length == 10) { + search += ' OR ' + ZU.toISBN13(ISBN); + } + let body = { + count: true, + facets: [], + filter: '', + orderby: null, + queryType: 'full', + search, + searchFields: 'FormattedKey,RowKey', + searchMode: 'any', + select: '*', + skip: 0, + top: 1 + }; + let response = await requestJSON('https://isbn-search-br.search.windows.net/indexes/isbn-index/docs/search?api-version=2016-09-01', { + method: 'POST', + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + 'api-key': '100216A23C5AEE390338BBD19EA86D29', + Origin: 'https://www.cblservicos.org.br', + Referer: 'https://www.cblservicos.org.br/' + }, + body: JSON.stringify(body) + }); + let results = response.value; + for (let result of results) { + translateResult(result); + } + } +} + +function translateResult(result) { + Z.debug(result) + let item = new Zotero.Item('book'); + item.title = result.Title; + if (result.Subtitle && !item.title.includes(':') && !result.Subtitle.includes(':')) { + item.title += ': ' + result.Subtitle; + } + item.title = fixCase(item.title); + item.abstractNote = result.Sinopse; + item.series = fixCase(result.Colection); + // TODO: Need example data for: + // item.seriesNumber + // item.volume + // item.numberOfVolumes + item.edition = result.Edicao; + if (item.edition == '1') { + item.edition = ''; + } + item.place = (result.Cidade || '') + (result.UF ? ', ' + result.UF : ''); + item.publisher = fixCase(result.Imprint); + item.date = ZU.strToISO(result.Date); + item.numPages = result.Paginas; + if (item.numPages == '0') { + item.numPages = ''; + } + item.language = (result.IdiomasObra && result.IdiomasObra[0]) || 'pt-BR'; + if (item.language == 'português (Brasil)') { + item.language = 'pt-BR'; + } + item.ISBN = ZU.cleanISBN(result.FormattedKey); + for (let [i, author] of result.Authors.entries()) { + if (author == author.toUpperCase()) { + author = ZU.capitalizeName(author); + } + let creatorType; + if (result.Profissoes && result.Profissoes.length === result.Authors.length) { + switch (result.Profissoes[i]) { + case 'Coordenador': + case 'Autor': + case 'Roteirista': + creatorType = 'author'; + break; + case 'Revisor': + case 'Organizador': + case 'Editor': + creatorType = 'editor'; + break; + case 'Tradutor': + creatorType = 'translator'; + break; + case 'Ilustrador': // TODO: Used? + case 'Projeto Gráfico': + creatorType = 'illustrator'; + break; + default: + // First creator is probably an author, + // even if the Profissoes string is something weird + creatorType = i == 0 ? 'author' : 'contributor'; + break; + } + } + // No/mismatched-length Profissoes array, so we have to guess that this non-primary creator + // is a contributor + else if (i > 0) { + creatorType = 'contributor'; + } + // No/mismatched-length Profissoes array, so we have to guess that this primary creator + // is an author + else { + creatorType = 'author'; + } + // Brazilian names often contain many surnames, but determining which names are surnames + // and which are given names is outside the scope of this translator. + // Chicago indexes by the final element of the name alone, and so will we: + // https://en.wikipedia.org/wiki/Portuguese_name#Indexing + let creator = ZU.cleanAuthor(author, creatorType, author.includes(',')); + if (!creator.firstName) creator.fieldMode = 1; + + // That said, we will handle name suffixes, which should be combined with the last "middle" + // name particle in the last name + if (creator.firstName && creator.lastName + && ['filho', 'junior', 'neto', 'sobrinho', 'segundo', 'terceiro'] + .includes(ZU.removeDiacritics(creator.lastName.toLowerCase()))) { + let firstNameSplit = creator.firstName.split(/\s+/); + if (firstNameSplit.length) { + let lastParticleFirstName = firstNameSplit[firstNameSplit.length - 1]; + creator.lastName = lastParticleFirstName + ' ' + creator.lastName; + creator.firstName = firstNameSplit.slice(0, firstNameSplit.length - 1).join(' '); + } + } + item.creators.push(creator); + } + if (result.Subject) { + item.tags.push({ tag: result.Subject }); + } + for (let tag of result.PalavrasChave) { + item.tags.push({ tag }); + } + item.complete(); +} + +function fixCase(s) { + if (s && s == s.toUpperCase()) { + s = ZU.capitalizeTitle(s, true); + } + return s; +} + +function cleanData(items) { + if (!Array.isArray(items)) { + items = [items]; + } + return items + .map((item) => { + if (typeof item === 'string') { + item = { ISBN: item }; + } + if (item.ISBN) { + item.ISBN = ZU.cleanISBN(item.ISBN); + } + return item; + }) + .filter(item => item.ISBN && ( + item.ISBN.startsWith('97865') + || item.ISBN.startsWith('65') + || item.ISBN.startsWith('97885') + || item.ISBN.startsWith('85'))); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "search", + "input": { + "ISBN": "9786599594755" + }, + "items": [ + { + "itemType": "book", + "title": "Mercadores da Insegurança: conjuntura e riscos do hacking governamental no Brasil", + "creators": [ + { + "firstName": "André", + "lastName": "Ramiro", + "creatorType": "author" + }, + { + "firstName": "Pedro", + "lastName": "Amaral", + "creatorType": "contributor" + }, + { + "firstName": "Mariana", + "lastName": "Canto", + "creatorType": "contributor" + }, + { + "firstName": "Marcos César M.", + "lastName": "Pereira", + "creatorType": "contributor" + }, + { + "firstName": "Raquel", + "lastName": "Saraiva", + "creatorType": "contributor" + }, + { + "firstName": "Clara", + "lastName": "Guimarães", + "creatorType": "contributor" + } + ], + "date": "2022-10-11", + "ISBN": "9786599594755", + "abstractNote": "Em políticas públicas, o debate sobre como as técnicas de investigações criminais devem responder à digitalização das dinâmicas sociais tem se sobressaído e caminha em uma linha tênue entre otimização dos processos administrativos e possíveis transgressões em relação aos direitos fundamentais. Nesse sentido, técnicas de hacking governamental, ou seja, de superação de recursos de segurança em dispositivos pessoais, vem ganhando uma escalabilidade crescente e envolve a ampliação de fabricantes, revendedores e contratos com a administração pública, ao passo em que seus efeitos colaterais aos direitos fundamentais, sobretudo em relação à sociedade civil, vêm sendo denunciados internacionalmente.", + "language": "pt-BR", + "libraryCatalog": "Câmara Brasileira do Livro ISBN", + "place": "Recife, PE", + "publisher": "IP.rec", + "shortTitle": "Mercadores da Insegurança", + "attachments": [], + "tags": [ + { + "tag": "Digital" + }, + { + "tag": "Direito" + }, + { + "tag": "Governamental" + }, + { + "tag": "Insegurança" + }, + { + "tag": "dados" + }, + { + "tag": "hacking" + }, + { + "tag": "vazamento" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "ISBN": "8532511015" + }, + "items": [ + { + "itemType": "book", + "title": "Harry Potter E a Pedra Filosofal", + "creators": [ + { + "firstName": "J. K.", + "lastName": "Rowling", + "creatorType": "author" + } + ], + "date": "2000-05-29", + "ISBN": "9788532511010", + "language": "pt-BR", + "libraryCatalog": "Câmara Brasileira do Livro ISBN", + "publisher": "Rocco", + "attachments": [], + "tags": [ + { + "tag": "Biblioteconomia e ciência da informação" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "ISBN": "9786555320275" + }, + "items": [ + { + "itemType": "book", + "title": "Harry Potter e o Prisioneiro de Azkaban", + "creators": [ + { + "firstName": "J. K.", + "lastName": "Rowling", + "creatorType": "author" + }, + { + "firstName": "Lia", + "lastName": "Wyler", + "creatorType": "contributor" + }, + { + "firstName": "Arch", + "lastName": "Apolar", + "creatorType": "contributor" + } + ], + "date": "2020-03-04", + "ISBN": "9786555320275", + "language": "pt-BR", + "libraryCatalog": "Câmara Brasileira do Livro ISBN", + "publisher": "Rocco", + "series": "Harry Potter", + "attachments": [], + "tags": [ + { + "tag": "Harry-Potter" + }, + { + "tag": "Literatura infanto-juvenil" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "ISBN": "9786587233956" + }, + "items": [ + { + "itemType": "book", + "title": "Einstein Socialista: Entrevistas, manifestos e artigos do maior cientista do século XX", + "creators": [ + { + "firstName": "Albert", + "lastName": "Einstein", + "creatorType": "author" + }, + { + "firstName": "Hugo", + "lastName": "Albuquerque", + "creatorType": "editor" + }, + { + "firstName": "Lígia Magalhães", + "lastName": "Marinho", + "creatorType": "translator" + } + ], + "date": "2023-04-12", + "ISBN": "9786587233956", + "abstractNote": "Por serem supostamente purgadas da “ideologia”, as ciências exatas alcançaram entre nós um status de demasiada confiabilidade, objetividade e verdade, Entretanto, Albert Einstein, o maior físico do século XX, não compactuava com essa crença e defendia abertamente os valores socialistas, colocando a própria narrativa cientificista, quase sempre favorável à ordem capitalista, em curto-circuito.\n\nEinstein era um militante e não se calou diante das falaciosas equiparações entre a Alemanha Nazista e a União Soviética. Nem se calou, como judeu, diante das violências cometidas contra os palestinos, pouco depois do Holocausto, pelos colonos judeus no nascente Estado de Israel. Tampouco poupou críticas à segregação racial nos Estados Unidos, onde foi lecionar em seus últimos anos.\n\nQuando a Guerra Fria estava a todo vapor, Einstein escreveu “Por que o Socialismo?” –, um de seus artigos mais conhecidos sobre política e frequentemente esquecido e dissociado de sua imagem. Não à toa, este texto, vez ou outra, é apresentado como “novidade” e não cansa de surpreender geração após geração. E que não se diga que era uma forma atenuada de socialismo que Einstein estava falando:\n\n“Numa economia planificada, em que a produção é ajustada às necessidades da comunidade, o trabalho a ser feito seria distribuído entre todas as pessoas aptas ao trabalho e garantiria condições de vida a todo homem, mulher e criança.”\n\nOu mesmo que, especificamente sobre a Revolução Russa, ele tenha confessado a Viereck que: \n\n“O bolchevismo é uma experiência extraordinária. Não é impossível que a deriva da evolução social daqui para a frente seja em direção ao comunismo. O experimento bolchevista talvez valha a pena.”\n\nCom uma certa dose de utopismo e um enorme enigma de como o socialismo pode ser alcançado e mantido, Einstein Socialista nos apresenta uma série de artigos, entrevistas e manifestos que revelam um lado muitas vezes negligenciado e “esquecido” de um dos maiores cientistas do mundo.", + "language": "pt-BR", + "libraryCatalog": "Câmara Brasileira do Livro ISBN", + "numPages": "96", + "place": "São Paulo, SP", + "publisher": "Autonomia Literaria", + "shortTitle": "Einstein Socialista", + "attachments": [], + "tags": [ + { + "tag": "Ciências sociais" + }, + { + "tag": "einstein" + }, + { + "tag": "nazismo" + }, + { + "tag": "relatividade" + }, + { + "tag": "socialismo" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "ISBN": "9788565053082" + }, + "items": [ + { + "itemType": "book", + "title": "State of the Art in Health and Knowledge", + "creators": [ + { + "firstName": "Sociedade Beneficente Israelita Brasileira Albert", + "lastName": "Einstein", + "creatorType": "author" + }, + { + "firstName": "Juliana", + "lastName": "Samel", + "creatorType": "translator" + } + ], + "date": "2023-02-02", + "ISBN": "9788565053082", + "abstractNote": "The book presents the Albert Einstein Teaching and Research Center - Campus Cecilia and Abram Szajman, an architectural work in the city of São Paulo, created to be one of the most advanced teaching and research centers in the world. Students and researchers interact in this building to generate knowledge, with the aim of boosting Brazilian research and all this in an environment integrated with greenery, with the use of natural light and renewable energy technology.", + "language": "Inglês (EUA)", + "libraryCatalog": "Câmara Brasileira do Livro ISBN", + "numPages": "58", + "place": "São Paulo, SP", + "publisher": "Sociedade Beneficente Israelita Brasileira Albert Einstein", + "attachments": [], + "tags": [ + { + "tag": "Arquitetura" + }, + { + "tag": "Landscaping" + }, + { + "tag": "architecture" + }, + { + "tag": "health" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "ISBN": "9786580341221" + }, + "items": [ + { + "itemType": "book", + "title": "Filipson: Memórias de uma menina na primeira colônia judaica no Rio Grande do Sul (1904-1920)", + "creators": [ + { + "firstName": "Frida", + "lastName": "Alexandr", + "creatorType": "author" + }, + { + "firstName": "Regina", + "lastName": "Zilberman", + "creatorType": "contributor" + } + ], + "date": "2023-05-11", + "ISBN": "9786580341221", + "abstractNote": "“Já ouviram falar de Filipson? Um nome esquisito. Nem parece brasileiro. Mas, dentro do Brasil imenso, constituía um pontinho minúsculo que ficava lá nas bandas do Sul, perdido no meio de diversas colônias prósperas compostas em sua maioria de imigrantes espanhóis, italianos e alemães e uma ou outra fazenda de brasileiros.”\n\nDesde a primeira linha, Frida Alexandr surpreende o leitor, interpelando-o com uma pergunta. Mesmo em 1967, quando suas memórias foram publicadas em edição restrita, provavelmente poucos responderiam afirmativamente à sua questão.\n\nFilipson foi a primeira colônia judaica oficial do Brasil, formada por imigrantes judeus provenientes da Bessarábia (na região onde atualmente se localiza a Moldávia). Os pais e irmãos mais velhos de Frida chegaram ao Brasil com o grupo pioneiro, em 1904, e em \"Filipson: memórias de uma menina na primeira colônia judaica no Rio Grande do Sul (1904-1920)\". Frida deixa um registro que vai dos primeiros dias da colônia à melancólica despedida, em 1920, quando sua família decide partir novamente.\n\nEntre os dois pontos, desliza a memória de Frida, que organiza os fatos sem a preocupação de ordená-los no tempo. O importante é como essas cenas — que envolvem seus familiares, sua passagem pela escola, as dificuldades financeiras da família, as ameaças representadas por uma natureza nem sempre hospitaleira — repercutem em sua sensibilidade. Frida se vale da linguagem para transmitir a emoção na forma como a vivenciou.\n\n\"Filipson\", com posfácio da pesquisadora e escritora Regina Zilberman, é um testemunho de uma etapa do processo de adaptação e preservação dos judeus do leste da Europa no Brasil. Mas esse caráter documental é acompanhado pela recuperação sensível daqueles momentos fundadores, como se a autora, à maneira de Proust, fosse em busca das vivências daquele tempo, para transmiti-lo a um leitor que pouco conhece sobre o período.", + "language": "pt-BR", + "libraryCatalog": "Câmara Brasileira do Livro ISBN", + "numPages": "360", + "place": "SÃO PAULO, SP", + "publisher": "Chão Editora", + "shortTitle": "Filipson", + "attachments": [], + "tags": [ + { + "tag": "Biografias" + }, + { + "tag": "judeus" + }, + { + "tag": "memórias" + }, + { + "tag": "mulheres" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "ISBN": "9786555250053" + }, + "items": [ + { + "itemType": "book", + "title": "Ilíada = Ἰλιάς", + "creators": [ + { + "firstName": "", + "lastName": "Homero", + "creatorType": "author", + "fieldMode": 1 + }, + { + "firstName": "Trajano", + "lastName": "Vieira", + "creatorType": "translator" + } + ], + "date": "2020-03-23", + "ISBN": "9786555250053", + "abstractNote": "Composta no século VIII a.C., a Ilíada é considerada o marco inaugural da literatura ocidental. Tradicionalmente atribuída a Homero, a obra aborda o período de algumas semanas no último ano da Guerra de Troia, durante o cerco final dos contingentes gregos à cidadela do rei Príamo, na Ásia Menor. Com seus mais de 15 mil versos, a Ilíada ganha agora uma nova tradução — das mãos de Trajano Vieira, professor livre-docente da Unicamp e premiado tradutor da Odisseia —, rigorosamente metrificada, que busca recriar em nossa língua a excelência do original, com seus símiles e invenções vocabulares. A presente edição, bilíngue, traz ainda uma série de aparatos, como um índice onomástico completo, um posfácio do tradutor, excertos da crítica, e o célebre ensaio de Simone Weil, “A Ilíada ou o poema da força”.", + "language": "pt-BR", + "libraryCatalog": "Câmara Brasileira do Livro ISBN", + "numPages": "1048", + "place": "São Paulo, SP", + "publisher": "Editora 34", + "attachments": [], + "tags": [ + { + "tag": "Literatura grega" + }, + { + "tag": "Literatura." + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "ISBN": "9786556752631" + }, + "items": [ + { + "itemType": "book", + "title": "Manual de Sentença Trabalhista: Compreendendo a técnica da setença trabalhista para concurso", + "creators": [ + { + "firstName": "Aline", + "lastName": "Leporaci", + "creatorType": "author" + }, + { + "firstName": "Adriana Leandro de Sousa", + "lastName": "Freitas", + "creatorType": "contributor" + } + ], + "date": "2023-03-02", + "ISBN": "9786556752631", + "abstractNote": "Nesse livro sobre sentença trabalhista, fase tão concorrida do concurso para a Magistratura do Trabalho, procuramos trazer os aspectos mais importantes a serem observados pelo candidato. O leitor poderá verificar a ordem de julgamento a seguir e a importância da fixação da prejudicialidade entre as matérias a serem analisadas. Além disso, também aprenderá as técnicas de distribuição do ônus da prova, e suas diversas teorias, sempre ressaltando qual deva ser de aplicação preferencial pelo candidato. O livro traz diversos aspectos teóricos, que são essenciais para a preparação de todos os interessados em efetivamente aprender a técnica da elaboração da sentença trabalhista, sempre com leitura fácil e direta. E não nos esquecemos dos aspectos práticos, pois o leitor terá exercícios de fixação de jornada de trabalho, e sentenças inéditas elaboradas pelas Autoras, com os respectivos gabaritos e sugestão de redação.", + "edition": "2", + "language": "pt-BR", + "libraryCatalog": "Câmara Brasileira do Livro ISBN", + "numPages": "232", + "place": "Rio de Janeiro, RJ", + "publisher": "Freitas Bastos Editora", + "shortTitle": "Manual de Sentença Trabalhista", + "attachments": [], + "tags": [ + { + "tag": "Direito" + }, + { + "tag": "Elaboração" + }, + { + "tag": "Jornada" + }, + { + "tag": "Magistratura" + }, + { + "tag": "Trabalhista" + }, + { + "tag": "Trabalho" + }, + { + "tag": "Técnica" + }, + { + "tag": "concurso" + }, + { + "tag": "juiz" + }, + { + "tag": "modelos" + }, + { + "tag": "sentença" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "ISBN": "9786559602513" + }, + "items": [ + { + "itemType": "book", + "title": "Batman", + "creators": [ + { + "firstName": "John", + "lastName": "Ridley", + "creatorType": "author" + }, + { + "firstName": "James Tynion", + "lastName": "IV", + "creatorType": "contributor" + }, + { + "firstName": "Dandara", + "lastName": "Palankof", + "creatorType": "contributor" + }, + { + "firstName": "Pedro", + "lastName": "Catarino", + "creatorType": "contributor" + }, + { + "firstName": "Travel", + "lastName": "Foreman", + "creatorType": "contributor" + }, + { + "firstName": "Riccardo", + "lastName": "Federici", + "creatorType": "contributor" + }, + { + "firstName": "Jorge", + "lastName": "Jimenez", + "creatorType": "contributor" + } + ], + "date": "2022-03-11", + "ISBN": "9786559602513", + "abstractNote": "Aventuras do Batman", + "language": "pt-BR", + "libraryCatalog": "Câmara Brasileira do Livro ISBN", + "numPages": "100", + "place": "Barueri, SP", + "publisher": "Panini Comics", + "attachments": [], + "tags": [ + { + "tag": "Cartoons; caricaturas e quadrinhos" + }, + { + "tag": "quadrinhos" + }, + { + "tag": "super-herois" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "ISBN": "9786559605101" + }, + "items": [ + { + "itemType": "book", + "title": "Superman", + "creators": [ + { + "firstName": "Sean", + "lastName": "Lewis", + "creatorType": "author" + }, + { + "firstName": "Phillip Kennedy", + "lastName": "Johnson", + "creatorType": "contributor" + }, + { + "firstName": "Gabriel", + "lastName": "Faria", + "creatorType": "contributor" + }, + { + "firstName": "Rodrigo", + "lastName": "Barros", + "creatorType": "contributor" + }, + { + "firstName": "Sami", + "lastName": "Basri", + "creatorType": "contributor" + }, + { + "firstName": "Phil", + "lastName": "Hester", + "creatorType": "contributor" + }, + { + "firstName": "Daniel", + "lastName": "Sampere", + "creatorType": "contributor" + } + ], + "date": "2022-03-10", + "ISBN": "9786559605101", + "abstractNote": "Aventuras do Superman", + "language": "pt-BR", + "libraryCatalog": "Câmara Brasileira do Livro ISBN", + "numPages": "100", + "place": "Barueri, SP", + "publisher": "Panini Comics", + "attachments": [], + "tags": [ + { + "tag": "Cartoons; caricaturas e quadrinhos" + }, + { + "tag": "quadrinhos" + }, + { + "tag": "super-herois" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "ISBN": "8576664984" + }, + "items": [ + { + "itemType": "book", + "title": "A Religião Nos Limites Da Simples Razão", + "creators": [], + "date": "2006-01-02", + "ISBN": "9788576664987", + "language": "pt-BR", + "libraryCatalog": "Câmara Brasileira do Livro ISBN", + "publisher": "Escala Educacional", + "series": "Série Filosofar", + "attachments": [], + "tags": [ + { + "tag": "Literatura" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "ISBN": "9788591597512" + }, + "items": [ + { + "itemType": "book", + "title": "Visões da áfrica: angola e moçambiqueJorge Alves de Lima Filho", + "creators": [ + { + "firstName": "Jorge Alves de", + "lastName": "Lima Filho", + "creatorType": "author" + } + ], + "date": "2015-09-29", + "ISBN": "9788591597512", + "language": "pt-BR", + "libraryCatalog": "Câmara Brasileira do Livro ISBN", + "publisher": "Jorge Alves de Lima Filho", + "shortTitle": "Visões da áfrica", + "attachments": [], + "tags": [ + { + "tag": "Coleções de obras diversas sem assunto específico" + } + ], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Cambridge Core.js b/translators/Cambridge Core.js new file mode 100644 index 0000000..20814ec --- /dev/null +++ b/translators/Cambridge Core.js @@ -0,0 +1,580 @@ +{ + "translatorID": "850f4c5f-71fb-4669-b7da-7fb7a95500ef", + "label": "Cambridge Core", + "creator": "Sebastian Karcher", + "target": "^https?://www\\.cambridge\\.org/core/(search\\?|journals/|books/|.+/listing?)", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2024-11-20 15:43:05" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2016-2024 Sebastian Karcher + + 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) { + // if one of these strings is in the URL, we're almost definitely on a listing + // page and should immediately return "multiple" if the page contains any + // results. the checks below (particularly url.includes('/books/')) might + // falsely return true and lead to an incorrect detection if we continue. + let multiples = /\/search\?|\/listing\?|\/issue\//; + if (multiples.test(url) && getSearchResults(doc, true)) { + return "multiple"; + } + if (url.includes('/article/')) { + return "journalArticle"; + } + if (url.includes('/books/')) { + if (doc.getElementsByClassName('chapter-wrapper').length > 0) { + return "bookSection"; + } + else return "book"; + } + + // now let's check for multiples again, just to be sure. this handles some + // rare listing page URLs that might not be included in the multiples + // regex above. + if (getSearchResults(doc, true)) { + return "multiple"; + } + + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll( + 'li.title a[href*="/article/"], li.title a[href*="/product/"], li.title a[href*="/books/"], div.results .product-listing-with-inputs-content a[href*="/books/"]' + ); + for (let row of rows) { + var href = row.href; + var 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) { + // Book metadata is much better using RIS + if (detectWeb(doc, url) == "book" || detectWeb(doc, url) == "bookSection") { + let productID = url.replace(/[#?].*/, "").match(/\/([^/]+)$/)[1]; + let risURL + = "/core/services/aop-easybib/export?exportType=ris&productIds=" + + productID + "&citationStyle=apa"; + // Z.debug(risURL); + // the attribute sometimes has a space in it, so testing for contains + var pdfURL = ZU.xpathText(doc, + '//meta[contains(@name, "citation_pdf_url")]/@content' + ); + if (!pdfURL) { + pdfURL = attr(doc, '.actions a[target="_blank"][href*=".pdf"]', 'href'); + } + // Z.debug("pdfURL: " + pdfURL); + var text = await requestText(risURL); + var translator = Zotero.loadTranslator( + "import"); + translator.setTranslator( + "32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); + translator.setString(text); + translator.setHandler("itemDone", function (obj, + item) { + if (pdfURL) { + item.attachments.push({ + url: pdfURL, + title: "Full Text PDF", + mimeType: "application/pdf" + }); + } + item.attachments.push({ + title: "Snapshot", + document: doc + }); + // don't save Cambridge Core to archive + item.archive = ""; + item.complete(); + }); + await translator.translate(); + } + // Some elements of journal citations look better with EM + else { + let translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', (_obj, item) => { + item.url = url; + var abstract = ZU.xpathText(doc, + '//div[@class="abstract"]'); + if (abstract) { + item.abstractNote = abstract; + } + item.title = ZU.unescapeHTML(item.title); + item.publisher = ""; // don't grab the publisher + item.libraryCatalog = "Cambridge University Press"; + if (item.date.includes("undefined")) { + item.date = attr('meta[name="citation_online_date"]', "content"); + } + // remove asterisk or 1 at end of title, e.g. https://www.cambridge.org/core/journals/american-political-science-review/article/abs/violence-in-premodern-societies-rural-colombia/A14B0BB4130A2BA6BE79E2853597526E + const titleElem = doc.querySelector("#maincontent h1"); + if (titleElem.querySelector('a:last-child')) { + item.title = titleElem.firstChild.textContent; + } + + item.complete(); + }); + let em = await translator.getTranslatorObject(); + // TODO map additional meta tags here, or delete completely + if (url.includes("/books")) { + em.itemType = "book"; + } + else { + em.itemType = "journalArticle"; + } + await em.doWeb(doc, url); + } +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.cambridge.org/core/journals/journal-of-american-studies/article/abs/samo-as-an-escape-clause-jean-michel-basquiats-engagement-with-a-commodified-american-africanism/1E4368D610A957B84F6DA3A58B8BF164", + "items": [ + { + "itemType": "journalArticle", + "title": "“SAMO© as an Escape Clause”: Jean-Michel Basquiat's Engagement with a Commodified American Africanism", + "creators": [ + { + "firstName": "Laurie A.", + "lastName": "Rodrigues", + "creatorType": "author" + } + ], + "date": "2011/05", + "DOI": "10.1017/S0021875810001738", + "ISSN": "1469-5154, 0021-8758", + "abstractNote": "Heir to the racist configuration of the American art exchange and the delimiting appraisals of blackness in the American mainstream media, Jean-Michel Basquiat appeared on the late 1970s New York City street art scene – then he called himself “SAMO.” Not long thereafter, Basquiat grew into one of the most influential artists of an international movement that began around 1980, marked by a return to figurative painting. Given its rough, seemingly untrained and extreme, conceptual nature, Basquiat's high-art oeuvre might not look so sophisticated to the uninformed viewer. However, Basquiat's work reveals a powerful poetic and visual gift, “heady enough to confound academics and hip enough to capture the attention span of the hip hop nation,” as Greg Tate has remarked. As noted by Richard Marshall, Basquiat's aesthetic strength actually comes from his striving “to achieve a balance between the visual and intellectual attributes” of his artwork. Like Marshall, Tate, and others, I will connect with Basquiat's unique, self-reflexively experimental visual practices of signifying and examine anew Basquiat's active contribution to his self-alienation, as Hebdige has called it. Basquiat's aesthetic makes of his paintings economies of accumulation, building a productive play of contingency from the mainstream's constructions of race. This aesthetic move speaks to a need for escape from the perceived epistemic necessities of blackness. Through these economies of accumulation we see, as Tate has pointed out, Basquiat's “intellectual obsession” with issues such as ancestry/modernity, personhood/property and originality/origins of knowledge, driven by his tireless need to problematize mainstream media's discourses surrounding race – in other words, a commodified American Africanism.", + "issue": "2", + "language": "en", + "libraryCatalog": "Cambridge University Press", + "pages": "227-243", + "publicationTitle": "Journal of American Studies", + "shortTitle": "“SAMO© as an Escape Clause”", + "url": "https://www.cambridge.org/core/journals/journal-of-american-studies/article/abs/samo-as-an-escape-clause-jean-michel-basquiats-engagement-with-a-commodified-american-africanism/1E4368D610A957B84F6DA3A58B8BF164", + "volume": "45", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cambridge.org/core/journals/journal-of-fluid-mechanics/article/abs/high-resolution-simulations-of-cylindrical-density-currents/30D62864BDED84A6CC81F5823950767B", + "items": [ + { + "itemType": "journalArticle", + "title": "High-resolution simulations of cylindrical density currents", + "creators": [ + { + "firstName": "Mariano I.", + "lastName": "Cantero", + "creatorType": "author" + }, + { + "firstName": "S.", + "lastName": "Balachandar", + "creatorType": "author" + }, + { + "firstName": "Marcelo H.", + "lastName": "Garcia", + "creatorType": "author" + } + ], + "date": "2007/11", + "DOI": "10.1017/S0022112007008166", + "ISSN": "1469-7645, 0022-1120", + "abstractNote": "Three-dimensional highly resolved simulations are presented for cylindrical density currents using the Boussinesq approximation for small density difference. Three Reynolds numbers (Re) are investigated (895, 3450 and 8950, which correspond to values of the Grashof number of 105, 1.5 × 106 and 107, respectively) in order to identify differences in the flow structure and dynamics. The simulations are performed using a fully de-aliased pseudospectral code that captures the complete range of time and length scales of the flow. The simulated flows present the main features observed in experiments at large Re. As the current develops, it transitions through different phases of spreading, namely acceleration, slumping, inertial and viscous Soon after release the interface between light and heavy fluids rolls up forming Kelvin–Helmholtz vortices. The formation of the first vortex sets the transition between acceleration and slumping phases. Vortex formation continues only during the slumping phase and the formation of the last Kelvin–Helmholtz vortex signals the departure from the slumping phase. The coherent Kelvin–Helmholtz vortices undergo azimuthal instabilities and eventually break up into small-scale turbulence. In the case of planar currents this turbulent region extends over the entire body of the current, while in the cylindrical case it only extends to the regions of Kelvin–Helmholtz vortex breakup. The flow develops three-dimensionality right from the beginning with incipient lobes and clefts forming at the lower frontal region. These instabilities grow in size and extend to the upper part of the front. Lobes and clefts continuously merge and split and result in a complex pattern that evolves very dynamically. The wavelength of the lobes grows as the flow spreads, while the local Re of the flow decreases. However, the number of lobes is maintained over time. Owing to the high resolution of the simulations, we have been able to link the lobe and cleft structure to local flow patterns and vortical structures. In the near-front region and body of the current several hairpin vortices populate the flow. Laboratory experiments have been performed at the higher Re and compared to the simulation results showing good agreement. Movies are available with the online version of the paper.", + "language": "en", + "libraryCatalog": "Cambridge University Press", + "pages": "437-469", + "publicationTitle": "Journal of Fluid Mechanics", + "url": "https://www.cambridge.org/core/journals/journal-of-fluid-mechanics/article/abs/high-resolution-simulations-of-cylindrical-density-currents/30D62864BDED84A6CC81F5823950767B", + "volume": "590", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Gravity currents" + }, + { + "tag": "Vortex breakdown" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cambridge.org/core/journals/american-political-science-review/issue/F6F2E8238A6D139A91D343A62AB2CECC", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.cambridge.org/core/search?q=labor&sort=&aggs%5BonlyShowAvailable%5D%5Bfilters%5D=&aggs%5BopenAccess%5D%5Bfilters%5D=&aggs%5BproductTypes%5D%5Bfilters%5D=JOURNAL_ARTICLE&aggs%5BproductDate%5D%5Bfilters%5D=&aggs%5BproductSubject%5D%5Bfilters%5D=&aggs%5BproductJournal%5D%5Bfilters%5D=&aggs%5BproductPublisher%5D%5Bfilters%5D=&aggs%5BproductSociety%5D%5Bfilters%5D=&aggs%5BproductPublisherSeries%5D%5Bfilters%5D=&aggs%5BproductCollection%5D%5Bfilters%5D=&showJackets=&filters%5BauthorTerms%5D=&filters%5BdateYearRange%5D%5Bfrom%5D=&filters%5BdateYearRange%5D%5Bto%5D=&hideArticleGraphicalAbstracts=true", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.cambridge.org/core/books/conservation-research-policy-and-practice/making-a-difference-in-conservation-linking-science-and-policy/C8B7353BFDD77E0C1A16A61C07E44977", + "items": [ + { + "itemType": "bookSection", + "title": "Making a difference in conservation: linking science and policy", + "creators": [ + { + "lastName": "Vickery", + "firstName": "Juliet A.", + "creatorType": "editor" + }, + { + "lastName": "Ockendon", + "firstName": "Nancy", + "creatorType": "editor" + }, + { + "lastName": "Pettorelli", + "firstName": "Nathalie", + "creatorType": "editor" + }, + { + "lastName": "Brotherton", + "firstName": "Peter N. M.", + "creatorType": "editor" + }, + { + "lastName": "Sutherland", + "firstName": "William J.", + "creatorType": "editor" + }, + { + "lastName": "Davies", + "firstName": "Zoe G.", + "creatorType": "editor" + }, + { + "lastName": "Sutherland", + "firstName": "William J.", + "creatorType": "author" + }, + { + "lastName": "Brotherton", + "firstName": "Peter N. M.", + "creatorType": "author" + }, + { + "lastName": "Ockendon", + "firstName": "Nancy", + "creatorType": "author" + }, + { + "lastName": "Pettorelli", + "firstName": "Nathalie", + "creatorType": "author" + }, + { + "lastName": "Vickery", + "firstName": "Juliet A.", + "creatorType": "author" + }, + { + "lastName": "Davies", + "firstName": "Zoe G.", + "creatorType": "author" + } + ], + "date": "2020", + "ISBN": "9781108714587", + "abstractNote": "Jamie Gundry’s dramatic image of a white-tailed eagle (Haliaeetus albicilla) on the cover of this book reflects the twisting changes in fortune experienced by this species, with a revival that can be attributed to a successful interplay of science, policy and practice. White-tailed eagles were historically much more widely distributed than they are today (Yalden, 2007), once breeding across much of Europe, but by the early twentieth century the species was extinct across much of western and southern Europe. The main cause of its decline was persecution by farmers and shepherds, who considered the eagles a threat to their livestock, but, along with other raptors, white-tailed eagles were also seriously affected by DDT in the 1960s and 1970s, which had disastrous effects on the breeding success of remaining populations.", + "bookTitle": "Conservation Research, Policy and Practice", + "extra": "DOI: 10.1017/9781108638210.001", + "libraryCatalog": "Cambridge University Press", + "pages": "3-8", + "place": "Cambridge", + "publisher": "Cambridge University Press", + "series": "Ecological Reviews", + "shortTitle": "Making a difference in conservation", + "url": "https://www.cambridge.org/core/books/conservation-research-policy-and-practice/making-a-difference-in-conservation-linking-science-and-policy/C8B7353BFDD77E0C1A16A61C07E44977", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cambridge.org/core/books/conservation-research-policy-and-practice/22AB241C45F182E40FC7F13637485D7E", + "items": [ + { + "itemType": "book", + "title": "Conservation Research, Policy and Practice", + "creators": [ + { + "lastName": "Sutherland", + "firstName": "William J.", + "creatorType": "editor" + }, + { + "lastName": "Brotherton", + "firstName": "Peter N. M.", + "creatorType": "editor" + }, + { + "lastName": "Davies", + "firstName": "Zoe G.", + "creatorType": "editor" + }, + { + "lastName": "Ockendon", + "firstName": "Nancy", + "creatorType": "editor" + }, + { + "lastName": "Pettorelli", + "firstName": "Nathalie", + "creatorType": "editor" + }, + { + "lastName": "Vickery", + "firstName": "Juliet A.", + "creatorType": "editor" + } + ], + "date": "2020", + "ISBN": "9781108714587", + "abstractNote": "Conservation research is essential for advancing knowledge but to make an impact scientific evidence must influence conservation policies, decision making and practice. This raises a multitude of challenges. How should evidence be collated and presented to policymakers to maximise its impact? How can effective collaboration between conservation scientists and decision-makers be established? How can the resulting messages be communicated to bring about change? Emerging from a successful international symposium organised by the British Ecological Society and the Cambridge Conservation Initiative, this is the first book to practically address these questions across a wide range of conservation topics. Well-renowned experts guide readers through global case studies and their own experiences. A must-read for practitioners, researchers, graduate students and policymakers wishing to enhance the prospect of their work 'making a difference'. This title is also available as Open Access on Cambridge Core.", + "extra": "DOI: 10.1017/9781108638210", + "libraryCatalog": "Cambridge University Press", + "place": "Cambridge", + "publisher": "Cambridge University Press", + "series": "Ecological Reviews", + "url": "https://www.cambridge.org/core/books/conservation-research-policy-and-practice/22AB241C45F182E40FC7F13637485D7E", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cambridge.org/core/what-we-publish/books/listing?sort=canonical.date%3Adesc&aggs%5BonlyShowAvailable%5D%5Bfilters%5D=true&aggs%5BproductTypes%5D%5Bfilters%5D=BOOK%2CELEMENT&searchWithinIds=0C5182F27A492FDC81EDF8D3C53266B5", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.cambridge.org/core/journals/ajs-review/latest-issue", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.cambridge.org/core/journals/american-political-science-review/article/abs/violence-in-premodern-societies-rural-colombia/A14B0BB4130A2BA6BE79E2853597526E", + "items": [ + { + "itemType": "journalArticle", + "title": "Violence in Pre-Modern Societies: Rural Colombia", + "creators": [ + { + "firstName": "Richard S.", + "lastName": "Weinert", + "creatorType": "author" + } + ], + "date": "1966/06", + "DOI": "10.2307/1953360", + "ISSN": "0003-0554, 1537-5943", + "abstractNote": "Violence is a common phenomenon in developing polities which has received little attention. Clearly a Peronist riot in Buenos Aires, a land invasion in Lima, and a massacre in rural Colombia are all different. Yet we have no typology which relates types of violence to stages or patterns of economic or social development. We know little of the causes, incidence or functions of different forms of violence. This article is an effort to understand one type of violence which can occur in societies in transition.Violence in Colombia has traditionally accompanied transfers of power at the national level. This can account for its outbreak in 1946, when the Conservative Party replaced the Liberals. It cannot account for the intensity or duration of rural violence for two decades. This article focuses primarily on the violence from 1946 to 1953, and explains its intensification and duration as the defense of a traditional sacred order against secular modernizing tendencies undermining that order. We shall discuss violence since 1953 in the concluding section.", + "issue": "2", + "language": "en", + "libraryCatalog": "Cambridge University Press", + "pages": "340-347", + "publicationTitle": "American Political Science Review", + "shortTitle": "Violence in Pre-Modern Societies", + "url": "https://www.cambridge.org/core/journals/american-political-science-review/article/abs/violence-in-premodern-societies-rural-colombia/A14B0BB4130A2BA6BE79E2853597526E", + "volume": "60", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cambridge.org/core/journals/journal-of-public-policy/article/abs/when-consumers-oppose-consumer-protection-the-politics-of-regulatory-backlash/2C8E6B9BB6881A233B8936D9AD2C6305", + "items": [ + { + "itemType": "journalArticle", + "title": "When Consumers Oppose Consumer Protection: The Politics of Regulatory Backlash", + "creators": [ + { + "firstName": "David", + "lastName": "Vogel", + "creatorType": "author" + } + ], + "date": "1990/10", + "DOI": "10.1017/S0143814X00006085", + "ISSN": "1469-7815, 0143-814X", + "abstractNote": "This article examines a neglected phenomenon in the existing literature on social regulation, namely political opposition to regulation that comes not from business but from consumers. It examines four cases of successful grass-roots consumer opposition to government health and safety regulations in the United States. Two involve rules issued by the National Highway Traffic Safety Administration, a 1974 requirement that all new automobiles be equipped with an engine-interlock system, and a 1967 rule that denied federal highway funds to states that did not require motorcyclists to wear a helmet. In 1977, Congress overturned the Food and Drug Administration's ban on the artificial sweetener, saccharin. Beginning in 1987, the FDA began to yield to pressures from the gay community by agreeing to streamline its procedures for the testing and approval of new drugs designed to fight AIDS and other fatal diseases. The article identifies what these regulations have in common and examines their significance for our understanding the politics of social regulation in the United States and other industrial nations.", + "issue": "4", + "language": "en", + "libraryCatalog": "Cambridge University Press", + "pages": "449-470", + "publicationTitle": "Journal of Public Policy", + "shortTitle": "When Consumers Oppose Consumer Protection", + "url": "https://www.cambridge.org/core/journals/journal-of-public-policy/article/abs/when-consumers-oppose-consumer-protection-the-politics-of-regulatory-backlash/2C8E6B9BB6881A233B8936D9AD2C6305", + "volume": "10", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cambridge.org/core/journals/american-political-science-review/firstview", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.cambridge.org/core/books/foundations-of-probabilistic-programming/819623B1B5B33836476618AC0621F0EE", + "items": [ + { + "itemType": "book", + "title": "Foundations of Probabilistic Programming", + "creators": [ + { + "lastName": "Barthe", + "firstName": "Gilles", + "creatorType": "editor" + }, + { + "lastName": "Katoen", + "firstName": "Joost-Pieter", + "creatorType": "editor" + }, + { + "lastName": "Silva", + "firstName": "Alexandra", + "creatorType": "editor" + } + ], + "date": "2020", + "ISBN": "9781108488518", + "abstractNote": "What does a probabilistic program actually compute? How can one formally reason about such probabilistic programs? This valuable guide covers such elementary questions and more. It provides a state-of-the-art overview of the theoretical underpinnings of modern probabilistic programming and their applications in machine learning, security, and other domains, at a level suitable for graduate students and non-experts in the field. In addition, the book treats the connection between probabilistic programs and mathematical logic, security (what is the probability that software leaks confidential information?), and presents three programming languages for different applications: Excel tables, program testing, and approximate computing. This title is also available as Open Access on Cambridge Core.", + "extra": "DOI: 10.1017/9781108770750", + "libraryCatalog": "Cambridge University Press", + "place": "Cambridge", + "publisher": "Cambridge University Press", + "url": "https://www.cambridge.org/core/books/foundations-of-probabilistic-programming/819623B1B5B33836476618AC0621F0EE", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Cambridge Engage Preprints.js b/translators/Cambridge Engage Preprints.js new file mode 100644 index 0000000..f2127e9 --- /dev/null +++ b/translators/Cambridge Engage Preprints.js @@ -0,0 +1,276 @@ +{ + "translatorID": "4338eead-a8b7-431f-8533-ea53062c9f89", + "label": "Cambridge Engage Preprints", + "creator": "Sebastian Karcher", + "target": "/engage/[^/]+/(article-details/|search-dashboard\\?)", + "minVersion": "5.0", + "maxVersion": "", + "priority": 200, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-10-23 08:35:07" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2022 Sebastian Karcher + + 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 ***** +*/ + +const preprintType = ZU.fieldIsValidForType('title', 'preprint') + ? 'preprint' + : 'report'; + +function detectWeb(doc, url) { + if (url.includes('/article-details/')) { + return preprintType; + } + else if (getSearchResults(doc, true)) { + return 'multiple'; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('.MatchResult article a'); + for (let row of rows) { + let href = row.href; + + let title = ZU.trimInternal(text(row, 'h3')); + 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.publisher = attr(doc, 'meta[property="og:site_name"]', 'content'); + item.libraryCatalog = "Cambridge Engage Preprints"; + if (item.date) { + item.date = ZU.strToISO(item.date); + } + item.complete(); + }); + + let em = await translator.getTranslatorObject(); + em.itemType = preprintType; + await em.doWeb(doc, url); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://chemrxiv.org/engage/chemrxiv/search-dashboard?text=acid", + "defer": true, + "items": "multiple" + }, + { + "type": "web", + "url": "https://chemrxiv.org/engage/chemrxiv/article-details/615ee2142aca5367575b8e49", + "items": [ + { + "itemType": "preprint", + "title": "Manganese Catalyzed Reformation of Ethylene Glycol to Glycolic acid and Lactic Acid", + "creators": [ + { + "firstName": "Satyadeep", + "lastName": "Waiba", + "creatorType": "author" + }, + { + "firstName": "BIplab", + "lastName": "Maji", + "creatorType": "author" + } + ], + "date": "2021-10-08", + "DOI": "10.26434/chemrxiv-2021-mjpkz", + "abstractNote": "Conversion of readily available feedstocks to valuable platform chemicals via a sustainable catalytic pathway has always been one of the key focuses of synthetic chemists. Cheaper, less toxic, and more abundant base metals as a catalyst for performing such transformations provide an additional boost. In this context, herein, we report a reformation of readily available feedstock, ethylene glycol, to value-added platform molecules, glycolic acid, and lactic acid. A bench stable base metal complex {[HN(C2H4PPh2)2]Mn(CO)2Br}, Mn-I, known as Mn-PhMACHO, catalyzed the reformation of ethylene glycol to glycolic acid at 140 oC in high selectivity with a turnover number TON = 2400, surpassing previously used homogeneous catalysts for such a reaction. Pure hydrogen gas is evolved without the need for an acceptor. On the other hand, a bench stable Mn(I)-complex, {(iPrPN5P)Mn(CO)2Br}, Mn-III, with a triazine backbone, efficiently catalyzed the acceptorless dehydrogenative coupling of ethylene glycol and methanol for the synthesis of lactic acid, even at a ppm level of catalyst loading, reaching the TON of 11,500. Detailed mechanistic studies were performed to elucidate the involvements of different manganese(I)-species during the catalysis.", + "language": "en", + "libraryCatalog": "Cambridge Engage Preprints", + "repository": "ChemRxiv", + "url": "https://chemrxiv.org/engage/chemrxiv/article-details/615ee2142aca5367575b8e49", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Dehydrogenative coupling" + }, + { + "tag": "Glycolic acid" + }, + { + "tag": "Hydrogen" + }, + { + "tag": "Lactic Acid" + }, + { + "tag": "Manganese catalysis" + }, + { + "tag": "Sustainable synthesis" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://preprints.apsanet.org/engage/apsa/article-details/5d94c7762f41c7001256af6d", + "items": [ + { + "itemType": "preprint", + "title": "Transparency in Practice in Qualitative Research", + "creators": [ + { + "firstName": "Diana", + "lastName": "Kapiszewski", + "creatorType": "author" + }, + { + "firstName": "Sebastian", + "lastName": "Karcher", + "creatorType": "author" + } + ], + "date": "2019-10-03", + "DOI": "10.33774/apsa-2019-if2he-v2", + "abstractNote": "The discipline of political science has been engaged in discussion about when, why, and how to make scholarship more transparent for at least three decades. This piece argues that qualitative researchers can achieve transparency in diverse ways, using techniques and strategies that allow them to balance and optimize among competing considerations that affect the pursuit of transparency.. We begin by considering the “state of the debate,” briefly outlining the contours of the scholarship on transparency in political and other social sciences, which so far has focussed mostly on questions of “whether” and “what” to share. We investigate competing considerations that researchers have to consider when working towards transparent research. The heart of the piece considers various strategies, illustrated by exemplary applications, for making qualitative research more transparent.", + "language": "en", + "libraryCatalog": "Cambridge Engage Preprints", + "repository": "APSA Preprints", + "url": "https://preprints.apsanet.org/engage/apsa/article-details/5d94c7762f41c7001256af6d", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "open science" + }, + { + "tag": "qualitative data" + }, + { + "tag": "research transparency" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.cambridge.org/engage/miir/article-details/60d6688fafe54f7050a526e4", + "items": [ + { + "itemType": "preprint", + "title": "New Techiques for Composite Wing Manufacture", + "creators": [ + { + "firstName": "David", + "lastName": "Barton", + "creatorType": "author" + }, + { + "firstName": "Hilary", + "lastName": "Ockendon", + "creatorType": "author" + }, + { + "firstName": "Bernard", + "lastName": "Piette", + "creatorType": "author" + }, + { + "firstName": "Robert", + "lastName": "Whittaker", + "creatorType": "author" + } + ], + "date": "2021-07-20", + "DOI": "10.33774/miir-2021-7cdx1", + "abstractNote": "This report addresses the construction of carbon fibre wing boxes and the problems associated with using carbon fibre sheets rather than individual carbon fibre tapes. In the case that the wing boxes are developable surfaces the lay up of carbon fibre sheets is straightforward, since the fibres can follow the contours of the surface without any need for shearing or extension of the fibres. To further expand the potential design space for the wing boxes, this report investigates the lay up of sheets over non-developable surfaces where some shearing of the sheet is required to achieve the desired results. In this report, three analytical approaches are considered, driven by the results from numerical studies on different surface geometries. Each of the approaches offers insights as to the type of geometric perturbations achievable when constrained by a maximum shear angle.", + "language": "en", + "libraryCatalog": "Cambridge Engage Preprints", + "repository": "Mathematics in Industry Reports", + "url": "https://www.cambridge.org/engage/miir/article-details/60d6688fafe54f7050a526e4", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Chebychev nets" + }, + { + "tag": "carbon fibre" + }, + { + "tag": "deformation of woven materials" + }, + { + "tag": "differential geometry" + } + ], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/CanLII.js b/translators/CanLII.js new file mode 100644 index 0000000..3e4c26b --- /dev/null +++ b/translators/CanLII.js @@ -0,0 +1,284 @@ +{ + "translatorID": "84799379-7bc5-4e55-9817-baf297d129fe", + "label": "CanLII", + "creator": "Sebastian Karcher", + "target": "^https?://(www\\.)?canlii\\.org/(en|fr)/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-03-15 05:20:22" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2012 Sebastian Karcher + + 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 ***** +*/ + + +var canLiiRegexp = /https?:\/\/(?:www\.)?canlii\.org[^/]*\/(?:en|fr)\/[^/]+\/[^/]+\/doc\/.+/; + +function detectWeb(doc, url) { + if (canLiiRegexp.test(url)) { + return "case"; + } + else { + var aTags = doc.getElementsByTagName("a"); + for (var i = 0; i < aTags.length; i++) { + if (canLiiRegexp.test(aTags[i].href)) { + return "multiple"; + } + } + } + return false; +} + + +function scrape(doc, url) { + var newItem = new Zotero.Item("case"); + var voliss = ZU.trimInternal(text('.documentMeta-citation + div')); + + // e.g. Reference re Secession of Quebec, 1998 CanLII 793 (SCC), [1998] 2 SCR 217, , retrieved on 2019-11-25 + var citationParts = voliss.split(','); + newItem.caseName = citationParts[0]; + var reporterRegex = /\[\d\d\d\d\]\s+(\d+)\s+([A-Z]+)\s+(\d+)/; + var reporterDetails = voliss.match(reporterRegex); + if (reporterDetails) { + newItem.reporterVolume = reporterDetails[1]; + newItem.reporter = reporterDetails[2]; + newItem.firstPage = reporterDetails[3]; + } + + newItem.court = text('#breadcrumbs *[itemprop="name"]', 2); + newItem.dateDecided = ZU.xpathText(doc, '//div[@id="documentMeta"]//div[contains(text(), "Date")]/following-sibling::div'); + newItem.docketNumber = ZU.xpathText(doc, '//div[@id="documentMeta"]//div[contains(text(), "File number") or contains(text(), "Numéro de dossier")]/following-sibling::div'); + var otherCitations = ZU.xpathText(doc, '//div[@id="documentMeta"]//div[contains(text(), "Other citations") or contains(text(), "Autres citations")]/following-sibling::div'); + if (otherCitations) { + newItem.notes.push({ note: "Other Citations: " + ZU.trimInternal(otherCitations) }); + } + + var shortUrl = text('.documentStaticUrl'); + if (shortUrl) { + newItem.url = shortUrl.trim(); + } + + // attach link to pdf version + // Z.debug(url) + var pdfurl = url.replace(/\.html(?:[?#].*)?/, ".pdf"); + newItem.attachments.push({ + url: pdfurl, + title: "CanLII Full Text PDF", + mimeType: "application/pdf" + }); + newItem.attachments.push({ + document: doc, + title: "CanLII Snapshot" + }); + newItem.complete(); +} + +function doWeb(doc, url) { + if (canLiiRegexp.test(url)) { + scrape(doc, url); + } + else { + var items = ZU.getItemArray(doc, doc, canLiiRegexp); + Zotero.selectItems(items, function (items) { + if (!items) { + return; + } + var articles = []; + for (var i in items) { + articles.push(i); + } + ZU.processDocuments(articles, scrape); + }); + } +} + + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.canlii.org/en/ca/scc/doc/2010/2010scc2/2010scc2.html", + "items": [ + { + "itemType": "case", + "caseName": "MiningWatch Canada v. Canada (Fisheries and Oceans)", + "creators": [], + "dateDecided": "2010-01-21", + "court": "Supreme Court of Canada", + "docketNumber": "32797", + "firstPage": "6", + "reporter": "SCR", + "reporterVolume": "1", + "url": "https://canlii.ca/t/27jmr", + "attachments": [ + { + "title": "CanLII Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "CanLII Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [ + { + "note": "Other Citations: [2010] ACS no 2 — [2010] SCJ No 2 (QL) — 99 Admin LR (4th) 1 — 315 DLR (4th) 434 — 397 NR 232" + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.canlii.org/en/ca/fct/doc/2011/2011fc119/2011fc119.html?searchUrlHash=AAAAAQAjU3V0dGllIHYuIENhbmFkYSAoQXR0b3JuZXkgR2VuZXJhbCkAAAAAAQ", + "items": [ + { + "itemType": "case", + "caseName": "Suttie v. Canada (Attorney General)", + "creators": [], + "dateDecided": "2011-02-02", + "court": "Federal Court", + "docketNumber": "T-1089-10", + "url": "https://canlii.ca/t/2flrk", + "attachments": [ + { + "title": "CanLII Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "CanLII Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.canlii.org/fr/ca/csc/doc/2010/2010csc2/2010csc2.html", + "items": [ + { + "itemType": "case", + "caseName": "Mines Alerte Canada c. Canada (Pêches et Océans)", + "creators": [], + "dateDecided": "2010-01-21", + "court": "Cour suprême du Canada", + "docketNumber": "32797", + "firstPage": "6", + "reporter": "RCS", + "reporterVolume": "1", + "url": "https://canlii.ca/t/27jms", + "attachments": [ + { + "title": "CanLII Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "CanLII Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [ + { + "note": "Other Citations: [2010] ACS no 2 — [2010] SCJ No 2 (QL) — 99 Admin LR (4th) 1 — 315 DLR (4th) 434 — 397 NR 232" + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.canlii.org/fr/ca/cfpi/doc/2011/2011cf119/2011cf119.html?searchUrlHash=AAAAAQAjU3V0dGllIHYuIENhbmFkYSAoQXR0b3JuZXkgR2VuZXJhbCkAAAAAAQ", + "items": [ + { + "itemType": "case", + "caseName": "Suttie c. Canada (Procureur Général)", + "creators": [], + "dateDecided": "2011-02-02", + "court": "Cour fédérale", + "docketNumber": "T-1089-10", + "url": "https://canlii.ca/t/fks9z", + "attachments": [ + { + "title": "CanLII Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "CanLII Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.canlii.org/en/ca/scc/doc/2010/2010scc2/2010scc2.html", + "items": [ + { + "itemType": "case", + "caseName": "MiningWatch Canada v. Canada (Fisheries and Oceans)", + "creators": [], + "dateDecided": "2010-01-21", + "court": "Supreme Court of Canada", + "docketNumber": "32797", + "firstPage": "6", + "reporter": "SCR", + "reporterVolume": "1", + "url": "https://canlii.ca/t/27jmr", + "attachments": [ + { + "title": "CanLII Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "CanLII Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [ + { + "note": "Other Citations: [2010] ACS no 2 — [2010] SCJ No 2 (QL) — 99 Admin LR (4th) 1 — 315 DLR (4th) 434 — 397 NR 232" + } + ], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Canada.com.js b/translators/Canada.com.js new file mode 100644 index 0000000..04a651d --- /dev/null +++ b/translators/Canada.com.js @@ -0,0 +1,171 @@ +{ + "translatorID": "4da40f07-904b-4472-93b6-9bea1fe7d4df", + "label": "Canada.com", + "creator": "Adam Crymble", + "target": "^https?://www\\.canada\\.com", + "minVersion": "1.0.0b4.r5", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-12-28 04:34:11" +} + +function detectWeb(doc, url) { + if (doc.location.href.match("story")) { + return "newspaperArticle"; + } else if (doc.location.href.match("search")) { + return "multiple"; + } +} + + +function scrape(doc, url) { + + var namespace = doc.documentElement.namespaceURI; + var nsResolver = namespace ? function(prefix) { + if (prefix == 'x') return namespace; else return null; + } : null; + + var dataTags = new Object(); + var tagsContent = new Array(); + var fieldTitle; + + var newItem = new Zotero.Item("newspaperArticle"); + + newItem.title = doc.title; + + if (doc.evaluate('//div[@class="storyheader"]/h4', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { + newItem.abstractNote = doc.evaluate('//div[@class="storyheader"]/h4', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; + } else if (doc.evaluate('//div[@class="storyheader"]/h2', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { + newItem.abstracteNote = doc.evaluate('//div[@class="storyheader"]/h2', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; + } + + if (doc.evaluate('//meta[@name="Author"]/@content', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { + var author = doc.evaluate('//meta[@name="Author"]/@content', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; + + if (author.match(/\n/)) { + author1 = author.split(/\n/); + if (author1[0].match(/ and /)) { + author2 = author1[0].split(/ and /); + for (var i in author2) { + newItem.creators.push(Zotero.Utilities.cleanAuthor(author2[i], "author")); + } + } else { + newItem.creators.push(Zotero.Utilities.cleanAuthor(author1[0], "author")); + } + } else { + newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author")); + } + } + + if (doc.evaluate('//meta[@name="PubDate"]/@content', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { + var date1 = doc.evaluate('//meta[@name="PubDate"]/@content', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent.replace(/^\s*|\s*$/g, ''); + if (date1) { + newItem.date = date1; + } + } + + if (doc.evaluate('//ul[@class="home"]/li/a/span', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { + var pubTitle = doc.evaluate('//ul[@class="home"]/li/a/span', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; + if (pubTitle.match("Home")) { + newItem.publicationTitle = pubTitle.substr(0, pubTitle.length-5); + } else { + newItem.publicationTitle = pubTitle; + } + } else { + newItem.publicationTitle = "Canada.com"; + } + + newItem.url = doc.location.href; + + newItem.complete(); +} + +function doWeb(doc, url) { + var namespace = doc.documentElement.namespaceURI; + var nsResolver = namespace ? function(prefix) { + if (prefix == 'x') return namespace; else return null; + } : null; + + var articles = new Array(); + + if (detectWeb(doc, url) == "multiple") { + var items = new Object(); + var next_title; + + if (doc.evaluate('//div[@class="even"]/p/a', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { + Zotero.debug("AAAAAA"); + var titles0 = doc.evaluate('//div[@class="even"]/p/a', doc, nsResolver, XPathResult.ANY_TYPE, null); + + while (next_title = titles0.iterateNext()) { + if (next_title.href.match("story") && next_title.href.match("canada.com")) { + items[next_title.href] = next_title.textContent; + } + } + } + + if (doc.evaluate('//h1/a', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { + Zotero.debug("new site?"); + var titles0 = doc.evaluate('//h1/a', doc, nsResolver, XPathResult.ANY_TYPE, null); + + while (next_title = titles0.iterateNext()) { + if (next_title.href.match("story") && next_title.href.match("canada.com")) { + items[next_title.href] = next_title.textContent; + } + } + } + + if (doc.evaluate('//div[@class="odd"]/p/a', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { + Zotero.debug("BBBBB"); + var titles1 = doc.evaluate('//div[@class="odd"]/p/a', doc, nsResolver, XPathResult.ANY_TYPE, null); + + while (next_title = titles1.iterateNext()) { + if (next_title.href.match("story") && next_title.href.match("canada.com")) { + items[next_title.href] = next_title.textContent; + } + } + } + + if (doc.evaluate('//p/b/a', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { + Zotero.debug("CCCCC"); + var titles2 = doc.evaluate('//p/b/a', doc, nsResolver, XPathResult.ANY_TYPE, null); + while (next_title = titles2.iterateNext()) { + if (next_title.href.match("story") && next_title.href.match("canada.com")) { + items[next_title.href] = next_title.textContent; + } + } + } + + if (doc.evaluate('//div[@class="name"]/a', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { + + Zotero.debug("DDDD"); + var titles3 = doc.evaluate('//div[@class="name"]/a', doc, nsResolver, XPathResult.ANY_TYPE, null); + while (next_title = titles3.iterateNext()) { + if (next_title.href.match("story") && next_title.href.match("canada.com")) { + items[next_title.href] = next_title.textContent; + } + } + } + + + + + Zotero.selectItems(items, function (items) { + ZU.processDocuments(Object.keys(items), scrape); + }); + } else { + scrape(doc, url); + } +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://www.canada.com/search/search.html?stype=si&q=argentina&x=0&y=0&radio_btns=canada.com", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/Canadian Letters and Images.js b/translators/Canadian Letters and Images.js new file mode 100644 index 0000000..9118341 --- /dev/null +++ b/translators/Canadian Letters and Images.js @@ -0,0 +1,148 @@ +{ + "translatorID": "a7c8b759-6f8a-4875-9d6e-cc0a99fe8f43", + "label": "Canadian Letters and Images", + "creator": "Philipp Zumstein", + "target": "^https?://(www\\.)?canadianletters\\.ca/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2016-09-09 19:45:42" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2016 Philipp Zumstein + + 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) { + if (url.indexOf("/content/document")>-1) { + var type = ZU.xpathText(doc, '//span[contains(@class, "lineage-item")]'); + switch (type) { + case "Letter": + case "Postcard": + return "letter"; + case "Photo": + case "Personal Item": + return "artwork"; + } + } else if (getSearchResults(doc, true)) { + return "multiple"; + } +} + + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = ZU.xpath(doc, '//h3[contains(@class, "title")]//a'); + for (var i=0; i. + + ***** END LICENSE BLOCK ***** +*/ + + +function detectWeb(doc, _url) { + if (doc.querySelector('.bookinfo')) { + return "conferencePaper"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('.pagecontent > .contentpadding > a[href*="abstract"][href$=".html"]'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(nearestPreviousSibling(row, 'b')); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function nearestPreviousSibling(el, selector) { + while ((el = el.previousElementSibling)) { + if (el.matches(selector)) { + return el.textContent.trim(); + } + } + return ''; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', function (obj, item) { + fillBookInfo(doc, url, item); + item.complete(); + }); + + translator.getTranslatorObject(function (trans) { + trans.itemType = 'conferencePaper'; + trans.doWeb(doc, url); + }); +} + +function fillBookInfo(doc, url, item) { + let bookInfo = doc.querySelector('.bookinfo > .contentpadding') + || doc.querySelector('.pagecontent > .contentpadding'); + item.proceedingsTitle = text(bookInfo, '.largerfont'); + item.abstractNote = text(doc, '.abstract div'); + + if (item.publisher && item.publisher.startsWith('Cascadilla')) { + item.place = 'Somerville, MA'; + } + + item.url = url; + + for (let child of bookInfo.childNodes) { + if (child.textContent.trim().startsWith('edited by')) { + for (let name of child.textContent.trim() + .replace(/^edited by\s*/, '').split(/, (?:and )?| and /)) { + item.creators.push(ZU.cleanAuthor(name, 'editor')); + } + break; + } + } + + for (let attachment of item.attachments) { + if (attachment.url && attachment.url.startsWith('www.')) { + attachment.url = 'https://' + attachment.url; + } + } +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://www.lingref.com/cpp/wccfl/25/abstract1429.html", + "items": [ + { + "itemType": "conferencePaper", + "title": "Subject Preference in Korean", + "creators": [ + { + "firstName": "Nayoung", + "lastName": "Kwon", + "creatorType": "author" + }, + { + "firstName": "Maria", + "lastName": "Polinsky", + "creatorType": "author" + }, + { + "firstName": "Robert", + "lastName": "Kluender", + "creatorType": "author" + }, + { + "firstName": "Donald", + "lastName": "Baumer", + "creatorType": "editor" + }, + { + "firstName": "David", + "lastName": "Montero", + "creatorType": "editor" + }, + { + "firstName": "Michael", + "lastName": "Scanlon", + "creatorType": "editor" + } + ], + "date": "2006", + "ISBN": "9781574734157", + "abstractNote": "This paper presents experimental data on the processing of relative and adjunct clauses in Korean. Both types of clause contain null elements (gaps), although these gaps may possibly represent different types of empty categories (deletion under movement in relative clauses, null pronominals in adjunct clauses). The experimental evidence shows that even in head-final languages like Korean, subject gaps of all types enjoy a processing advantage over object gaps, thus adding support to the idea that the subject advantage is a universal principle of grammar. Different explanatory mechanisms have been proposed to account for this subject advantage. The Korean data support structurally-based accounts rather than accounts that rely on the linear distance between the filler and the gap in a long-distance dependency. Theoretically, these new data shed additional light on—but do not entirely resolve—long-standing controversies over whether Korean relative clauses represent English-like operator-movement structures or structures with an unselectively bound null pronominal.", + "conferenceName": "25th West Coast Conference on Formal Linguistics", + "libraryCatalog": "www.lingref.com", + "pages": "1-14", + "place": "Somerville, MA", + "proceedingsTitle": "Proceedings of the 25th West Coast Conference on Formal Linguistics", + "publisher": "Cascadilla Proceedings Project", + "url": "http://www.lingref.com/cpp/wccfl/25/abstract1429.html", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.lingref.com/cpp/wccfl/25/index.html", + "items": "multiple" + }, + { + "type": "web", + "url": "http://www.lingref.com/cpp/acal/42/abstract2769.html", + "items": [ + { + "itemType": "conferencePaper", + "title": "A Comparative Study of Topological Relation Markers in Two Gur Languages: Gurenɛ and Chakali", + "creators": [ + { + "firstName": "Jonathan Allen", + "lastName": "Brindle", + "creatorType": "author" + }, + { + "firstName": "Samuel Awinkene", + "lastName": "Atintono", + "creatorType": "author" + }, + { + "firstName": "Michael R.", + "lastName": "Marlo", + "creatorType": "editor" + }, + { + "firstName": "Nikki B.", + "lastName": "Adams", + "creatorType": "editor" + }, + { + "firstName": "Christopher R.", + "lastName": "Green", + "creatorType": "editor" + }, + { + "firstName": "Michelle", + "lastName": "Morrison", + "creatorType": "editor" + }, + { + "firstName": "Tristan M.", + "lastName": "Purvis", + "creatorType": "editor" + } + ], + "date": "2012", + "ISBN": "9781574734539", + "abstractNote": "This paper explores from a comparative perspective the strategies employed for the coding of topological relations in two Gur languages, Gurenε and Chakali. It identifies the similarities and differences in the coding of semantic concepts that describe topological relations and examines the lexical semantics of locative predicate relations. The results of the study show that both languages use existential, postural or positional verbs to express topological relations, and that these verbs often combine with nominal postpositions. The paper is a contribution to the typological classification of locative predication proposed by Ameka and Levinson (2007), and to areal typology, as it concludes by comparing some of the findings with an analysis of Likpe (Ghana-Togo Mountain, Kwa (Ameka, 2007a)).", + "conferenceName": "42nd Annual Conference on African Linguistics", + "libraryCatalog": "www.lingref.com", + "pages": "195-207", + "place": "Somerville, MA", + "proceedingsTitle": "Selected Proceedings of the 42nd Annual Conference on African Linguistics: African Languages in Context", + "publisher": "Cascadilla Proceedings Project", + "shortTitle": "A Comparative Study of Topological Relation Markers in Two Gur Languages", + "url": "http://www.lingref.com/cpp/acal/42/abstract2769.html", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.lingref.com/cpp/slrf/2011/abstract2914.html", + "items": [ + { + "itemType": "conferencePaper", + "title": "Does Partial Radical Information Help in the Learning of Chinese Characters?", + "creators": [ + { + "firstName": "Jing", + "lastName": "Wang", + "creatorType": "author" + }, + { + "firstName": "Keiko", + "lastName": "Koda", + "creatorType": "author" + }, + { + "firstName": "Erik", + "lastName": "Voss", + "creatorType": "editor" + }, + { + "firstName": "Shu-Ju Diana", + "lastName": "Tai", + "creatorType": "editor" + }, + { + "firstName": "Zhi", + "lastName": "Li", + "creatorType": "editor" + } + ], + "date": "2013", + "ISBN": "9781574734584", + "abstractNote": "Whether and how partial radical information in different transparency levels helps in the acquisition of Chinese characters, as well as how contextual information interacts with semantic transparency in character meaning inference, are open questions and are explored in the present study. A character meaning inference task in isolation and a character meaning inference task in context were completed by 37 first-year students\nin the University of Pittsburgh Chinese program. Three kinds of characters (transparent, semitransparent, and single-unit characters without radicals) were chosen based on Shu et al.'s (2003) study, and two conditions (isolation and context) were designed. The results showed that in both conditions, learners achieved higher scores on transparent characters than on semi-transparent characters, and their performance was significantly better on compound characters (both transparent and semitransparent) than single-unit characters without radicals. Also, context impeded with learning semitransparent characters, but did not affect transparent and single-unit characters. The results suggest that partial radical information helps Chinese character learning, and that teaching compound characters componentially may be more effective than teaching them holistically.", + "conferenceName": "2011 Second Language Research Forum", + "libraryCatalog": "www.lingref.com", + "pages": "162-172", + "place": "Somerville, MA", + "proceedingsTitle": "Selected Proceedings of the 2011 Second Language Research Forum: Converging Theory and Practice", + "publisher": "Cascadilla Proceedings Project", + "url": "http://www.lingref.com/cpp/slrf/2011/abstract2914.html", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.lingref.com/cpp/slrf/2011/abstract2913.html", + "items": [ + { + "itemType": "conferencePaper", + "title": "A Reexamination of Ultimate Attainment in L2 Phonology: Length of Immersion, Motivation, and Phonological Short-Term Memory", + "creators": [ + { + "firstName": "Charles", + "lastName": "Nagle", + "creatorType": "author" + }, + { + "firstName": "Erik", + "lastName": "Voss", + "creatorType": "editor" + }, + { + "firstName": "Shu-Ju Diana", + "lastName": "Tai", + "creatorType": "editor" + }, + { + "firstName": "Zhi", + "lastName": "Li", + "creatorType": "editor" + } + ], + "date": "2013", + "ISBN": "9781574734584", + "abstractNote": "The current study investigated phonological attainment among a sample of 34 English-speaking late-learners of L2 Spanish. Participants completed a language background questionnaire, motivation assessment, operation span task, and phonological short-term memory task, and recorded three speaking tasks. As a point of comparison, three native Spanish-speaking participants also recorded the speaking tasks. Four naïve L1 Spanish raters subsequently evaluated the speech clips. Regression analyses on the raters' scores revealed that length of immersion, motivation, and phonological short-term memory accounted for 70% of the variance in the sample. Furthermore, three learners received ratings that fell within the native range. Taken together, these findings suggest that immersion, motivation, and PSTM are critical factors that determine end-state phonological attainment for the learners in this study, as well as that late-learners appear to be capable of achieving near-native pronunciation in a foreign language.", + "conferenceName": "2011 Second Language Research Forum", + "libraryCatalog": "www.lingref.com", + "pages": "148-161", + "place": "Somerville, MA", + "proceedingsTitle": "Selected Proceedings of the 2011 Second Language Research Forum: Converging Theory and Practice", + "publisher": "Cascadilla Proceedings Project", + "shortTitle": "A Reexamination of Ultimate Attainment in L2 Phonology", + "url": "http://www.lingref.com/cpp/slrf/2011/abstract2913.html", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Cell Press.js b/translators/Cell Press.js new file mode 100644 index 0000000..1aefeb4 --- /dev/null +++ b/translators/Cell Press.js @@ -0,0 +1,516 @@ +{ + "translatorID": "f26cfb71-efd7-47ae-a28c-d4d8852096bd", + "label": "Cell Press", + "creator": "Michael Berkowitz, Sebastian Karcher, Aurimas Vinckevicius", + "target": "^https?://([^/]*\\.)?cell\\.com", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2017-06-06 22:03:36" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Cell Journals Translator + Copyright © 2011 Sebastian Karcher and Aurimas Vinckevicius + + 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) { + if (ZU.xpathText(doc, '//meta[@name="citation_journal_title"]/@content')) { + return 'journalArticle'; + } else if (url.indexOf('doSearch?') != -1 && + ZU.xpath(doc, '//form[contains(@id, "Search")]\ + //a[contains(@href, "abstract") or contains(@href, "fulltext")]') ) { + return 'multiple'; + } +} + +function scrape(doc, url) { + //use Embedded Metadata + var translator = Zotero.loadTranslator('web'); + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', function(obj, item) { + //occasionally creators are not supplied, + //but we can get them from the page + if (!item.creators.length) { + var creators = ZU.xpath(doc, '//div[@id="article_meta"]\ + //p[./a[starts-with(@href,"mailto:")]]/strong'); + for (var i=0, n=creators.length; i. + + ***** END LICENSE BLOCK ***** +*/ + +function detectWeb(doc, url) { + if (url.includes('/article-detail?')) return "journalArticle"; + else if (getSearchResults(doc, true)) return "multiple"; + else return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('.description a, .article-details > h3 > a'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), invokeEMTranslator); + }); + } + else { + invokeEMTranslator(doc, url); + } +} + +function invokeEMTranslator(doc) { + var translator = Zotero.loadTranslator("web"); + // Embedded Metadata + translator.setTranslator("951c027d-74ac-47d4-a107-9c3069ab7b48"); + translator.setDocument(doc); + translator.setHandler("itemDone", function (t, i) { + postProcess(doc, i); + }); + translator.translate(); +} + +// scraping abstractNote from HTML, that is not included in Embedded Metadata +function postProcess(doc, item) { + let abstractEntry = ZU.xpathText(doc, '//p[@class="summary"]'); + if (!item.abstractNote && abstractEntry) item.abstractNote = abstractEntry; + for (let i = 0; i < item.attachments.length; i++) { + if (item.attachments[i].title == 'Snapshot') { + item.attachments.splice(i, 1); + break; + } + } + item.complete(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.ceeol.com/search/article-detail?id=934009", + "items": [ + { + "itemType": "journalArticle", + "title": "God’s Holy Ordinance", + "creators": [ + { + "firstName": "Robert", + "lastName": "Benne", + "creatorType": "author" + } + ], + "date": "2020", + "ISSN": "2450-4955, 2451-2141", + "abstractNote": "Summary/Abstract: In this article, I argue that the church must build up its theology of marriage in a more disciplined manner because the culture no longer sustains the Christian notion. In making a substantive argument I rely on the Lutheran “two ways that God reigns” approach in which we share “places of responsibility” with all humans, but in which the Christian virtues of faith, love, and hope transform those places into genuine Christian callings. I then contend strongly for the continued rejection of same-sex marriage among orthodox Christians. I conclude with what I hope is a compassionate pastoral approach—gracious tolerance—toward homosexual Christians.", + "issue": "6", + "language": "English", + "libraryCatalog": "www.ceeol.com", + "pages": "7-21", + "publicationTitle": "Philosophy and Canon Law", + "url": "https://www.ceeol.com/search/article-detail?id=934009", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "faith" + }, + { + "tag": "gracious tolerance" + }, + { + "tag": "hope" + }, + { + "tag": "individualism" + }, + { + "tag": "love" + }, + { + "tag": "places of responsibility" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.ceeol.com/search/article-detail?id=945560", + "items": [ + { + "itemType": "journalArticle", + "title": "Zastosowanie modelu struktury kapitału Mertona Howarda Millera w warunkach zmienności polityki fiskalnej w Polsce w latach 2018–2019", + "creators": [ + { + "firstName": "Slawomir", + "lastName": "Antkiewicz", + "creatorType": "author" + } + ], + "date": "2019", + "ISSN": "2300-6102, 2353-9496", + "abstractNote": "Summary/Abstract: An essential condition for the proper functioning of Polish enterprises is the stability of tax solutions. However, over the years 2018–2019, several variants of tax changes appeared, which may have a significant impact on the capital structure of enterprises. The implementation of one of the variants will create specific preferences for the use of equity or foreign capital. The purpose of the papers is to analyse the impact of possible changes in the tax rates on the decisions of management boards of enterprises regarding the methods of financing Polish enterprises and shaping their capital structure. To achieve the research goal, the paper presents the capital structure and the evolution of theoretical concepts regarding the preferences for financing enterprises with shares or bonds. Particular attention was paid to Merton Howard Miller’s model, which argued that enterprises can use interest tax shields that reduce the basis for calculating income tax. The analytical-descriptive and comparative methods were used. Scenarios of changes in taxation were presented and preferences for the use of equity or foreign capital were demonstrated using the Miller model. The research results indicate that in the current legal situation there are preferences for financing an entity with corporate bonds and if the most realistic scenario of liquidating the tax levied on interest paid to bond holders plays out, these preferences will further increase.", + "issue": "1", + "language": "Polish", + "libraryCatalog": "www.ceeol.com", + "pages": "7-23", + "publicationTitle": "International Business and Global Economy", + "url": "https://www.ceeol.com/search/article-detail?id=945560", + "volume": "38", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "bonds" + }, + { + "tag": "capital structure" + }, + { + "tag": "debt" + }, + { + "tag": "equity capital" + }, + { + "tag": "shares" + }, + { + "tag": "tax shield" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.ceeol.com/search/article-detail?id=925530", + "items": [ + { + "itemType": "journalArticle", + "title": "Az automatizálás munkaerőpiaci és munkajogi kérdései", + "creators": [], + "date": "2020", + "ISSN": "2734-6226, 2734-7095, 2734-6226", + "abstractNote": "Summary/Abstract: The fundamental value of labour law at all times is that it provides security in the economic sense and thus creates predictability: on the one hand, with rules protecting the worker and, on the other hand, by building a social network on the part of the state in case the worker is unable to work. In addition, it is crucial that labour law regulations can properly adapt to the economic and social changes of the 21st century, to the emergence of new trends. The development of robotics and artificial intelligence will undoubtedly have an impact on the dynamic and static elements of the work environment, the labour market, and the labour relationship, thus generating new challenges.", + "issue": "4", + "language": "Hungarian", + "libraryCatalog": "www.ceeol.com", + "pages": "63-76", + "publicationTitle": "Erdélyi Jogélet", + "url": "https://www.ceeol.com/search/article-detail?id=925530", + "volume": "III", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "artificial intelligence" + }, + { + "tag": "automation" + }, + { + "tag": "occupational safety" + }, + { + "tag": "responsibility" + }, + { + "tag": "robotics" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.ceeol.com/search/article-detail?id=934330", + "items": [ + { + "itemType": "journalArticle", + "title": "Pavao Maček, Pogledići i Malenići. Dva plemenita roda od Kurilovca: S priloženim rodoslovnim stablima", + "creators": [ + { + "firstName": "Ivan", + "lastName": "Jurković", + "creatorType": "author" + } + ], + "date": "2020", + "ISSN": "0351-9767, 1848-9087", + "abstractNote": "Summary/Abstract: Book-Review: Pavao Maček, Pogledići i Malenići. Dva plemenita roda od Kurilovca: S priloženim rodoslovnim stablima, Zagreb: Družtvo za povjestnicu Zagrebačke nadbiskupije “Tkalčić”, 2019, 574 stranice i dva rodoslovna stabla. Review by Ivan Jurković.", + "issue": "58", + "language": "Croatian", + "libraryCatalog": "www.ceeol.com", + "pages": "154-156", + "publicationTitle": "Povijesni prilozi", + "shortTitle": "Pavao Maček, Pogledići i Malenići. Dva plemenita roda od Kurilovca", + "url": "https://www.ceeol.com/search/article-detail?id=934330", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Pavao Maček" + }, + { + "tag": "Pogledići and Malenići" + }, + { + "tag": "genealogical trees" + }, + { + "tag": "two noble families from Kurilovac" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.ceeol.com/search/journal-detail?id=1266", + "defer": true, + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.ceeol.com/search/journal-detail?id=761", + "defer": true, + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/Champlain Society - Collection.js b/translators/Champlain Society - Collection.js new file mode 100644 index 0000000..11f738f --- /dev/null +++ b/translators/Champlain Society - Collection.js @@ -0,0 +1,220 @@ +{ + "translatorID": "50d3ca81-3c4c-406b-afb2-0fe8105b9b38", + "label": "Champlain Society - Collection", + "creator": "Adam Crymble", + "target": "^https?://link\\.library\\.utoronto\\.ca", + "minVersion": "1.0.0b4.r5", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-12-28 04:41:28" +} + +function detectWeb(doc, url) { + if (doc.location.href.match("search_results")) { + return "multiple"; + } else if (doc.location.href.match("item_record")) { + return "book"; + } +} + +//Champlain Collection translator. Code by Adam Crymble + +function associateData (newItem, dataTags, field, zoteroField) { + if (dataTags[field]) { + newItem[zoteroField] = dataTags[field]; + } +} + +function scrape(doc, url) { + + var namespace = doc.documentElement.namespaceURI; + var nsResolver = namespace ? function(prefix) { + if (prefix == 'x') return namespace; else return null; + } : null; + + var dataTags = new Object(); + var tagsContent = new Array(); + var fieldTitle; + + var newItem = new Zotero.Item("book"); + + var headers = doc.evaluate('//table[1]/tbody/tr/td[1]/b/font', doc, nsResolver, XPathResult.ANY_TYPE, null); + var contents = doc.evaluate('//td/table[1]/tbody/tr/td[2]/font', doc, nsResolver, XPathResult.ANY_TYPE, null); + var xPathCount = doc.evaluate('count (//table[1]/tbody/tr/td[1]/b/font)', doc, nsResolver, XPathResult.ANY_TYPE, null); + + for (i=0; i. + + ***** END LICENSE BLOCK ***** +*/ + +// Simple translator for ChatGPT that grabs the date and model info +// for private and public chats. + +// Please don't take any of the translator authorship advice that ChatGPT +// gives in the test page. It's mostly wrong. + + +function detectWeb(doc, url) { + if (url.includes('/c/') || url.includes('/share/')) { + return 'webpage'; + } + return false; +} + +async function doWeb(doc, url) { + let item = new Zotero.Item('webpage'); + item.title = doc.title; + item.websiteTitle = 'ChatGPT'; + item.websiteType = 'Generative AI chat'; + + if (url.includes('/share/')) { + item.url = url; + } + + item.creators.push({ + creatorType: 'author', + lastName: 'OpenAI', + fieldMode: 1 + }); + item.attachments.push({ + title: 'Snapshot', + document: doc + }); + + try { + await enrichItemWithAPI(doc, url, item); + } + catch (e) { + Zotero.debug(e); + } + + item.complete(); +} + +async function enrichItemWithAPI(doc, url, item) { + let dataScript = [...doc.querySelectorAll('script')] + .find(script => script.textContent.startsWith('window.__reactRouterContext.streamController.enqueue(')) + .textContent; + let extract = (key) => { + let formattedKey = `\\"${key}\\",\\"`; + let keyIndex = dataScript.indexOf(formattedKey); + if (keyIndex === -1) return null; + return dataScript.substring(keyIndex + formattedKey.length).split('\\"')[0]; + }; + + let language = extract('locale'); + let deviceID = extract('WebAnonymousCookieID'); + let accessToken = extract('accessToken'); + let clientVersion = doc.documentElement.dataset.build; + + let id = url.match(/\/(?:c|share)\/([^#?/]+)/)[1]; + let apiSlug; + if (url.includes('/c/')) { + apiSlug = 'conversation/' + id; + } + else { + apiSlug = 'share/' + id; + } + + let apiURL = '/backend-api/' + apiSlug; + let headers = { + 'OAI-Language': language, + 'OAI-Device-Id': deviceID, + 'OAI-Client-Version': clientVersion, + }; + if (accessToken) { + headers.Authorization = `Bearer ${accessToken}`; + } + + let json = await requestJSON(apiURL, { headers }); + item.title = json.title; + let date = new Date((json.update_time || json.create_time) * 1000); + item.date = ZU.strToISO(date.toISOString()); + if (json.model) { + item.websiteTitle += ` (${json.model.title})`; + } + + if (url.includes('/c/')) { + // Private conversation: Add existing share URL if available + try { + let { items: shares } + = await requestJSON('/backend-api/shared_conversations?order=created', { headers }); + let share = shares.find(share => share.conversation_id === id); + if (share) { + Zotero.debug('Conversation has been shared as ' + share.id); + if (new Date(share.update_time) >= date) { + Zotero.debug('Share is up to date'); + item.url = `https://chatgpt.com/share/${share.id}`; + } + else { + Zotero.debug(`Out of date: ${share.update_time} < ${date}`); + } + } + else { + Zotero.debug('Not yet shared'); + } + } + catch (e) { + Zotero.debug('Unable to find share'); + Zotero.debug(e); + } + } +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://chatgpt.com/share/68fa640b-9fc8-8013-a803-3d5241df6556", + "items": [ + { + "itemType": "webpage", + "title": "Write Zotero translator", + "creators": [ + { + "creatorType": "author", + "lastName": "OpenAI", + "fieldMode": 1 + } + ], + "date": "2025-10-24", + "url": "https://chatgpt.com/share/68fa640b-9fc8-8013-a803-3d5241df6556", + "websiteTitle": "ChatGPT (GPT-5)", + "websiteType": "Generative AI chat", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Chicago Journal of Theoretical Computer Science.js b/translators/Chicago Journal of Theoretical Computer Science.js new file mode 100644 index 0000000..40f72c5 --- /dev/null +++ b/translators/Chicago Journal of Theoretical Computer Science.js @@ -0,0 +1,203 @@ +{ + "translatorID": "1e2a9aba-eb04-4398-9e3a-630e6132db13", + "label": "Chicago Journal of Theoretical Computer Science", + "creator": "Morgan Shirley", + "target": "^https?://cjtcs\\.cs\\.uchicago\\.edu/articles", + "minVersion": "5.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2025-05-14 00:10:19" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2025 Morgan Shirley + + 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 ***** +*/ + +/** + * Volumes are at articles/year/contents.html + * Individual articles are at articles/year/#/contents.html + * Special issues at articles/[issue name]/contents.html + */ +function detectWeb(doc, url) { + var singleRe = /^https?:\/\/cjtcs\.cs\.uchicago\.edu\/articles\/\w+\/\d+\/contents.html/ + var multipleRe = /^https?:\/\/cjtcs\.cs\.uchicago\.edu\/articles\/\w+\/contents.html/ + if (multipleRe.test(url)) { + return getMultiple(doc, true) && "multiple"; + } + else if (singleRe.test(url)) { + return "journalArticle"; + } + else return false; +} + +function getMultiple(doc, checkOnly) { + var items = {}; + var found = false; + // We need to be specific to avoid navigating to special issues + var rows = doc.querySelectorAll('ul > li > ul > li'); + for (let row of rows) { + // Only the first link in a list item is an article + let article_link = row.querySelector('a[href*="contents.html"]'); + let href = article_link.href; + 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(getMultiple(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 bibUrl = doc.querySelector('a[href*=".bib"]') + let bibText = fixAuthorLine(await requestText(bibUrl.href)); + let translator = Zotero.loadTranslator("import"); + translator.setTranslator('9cb70025-a888-4a29-a210-93ec52da40d4'); + translator.setString(bibText); + translator.setHandler('itemDone', (_obj, item) => { + //DOI is listed on page + let doiElement = doc.querySelector('a[href*="dx.doi.org"]'); + item.DOI = ZU.cleanDOI(doiElement.href); + + //Download PDF, or Snapshot if unavailable + let pdfElement = doc.querySelector('a[href*=".pdf"]'); + if (pdfElement) { + item.attachments.push({ + url: pdfElement.href, + title: 'Full Text PDF', + mimeType: 'application/pdf' + }); + } + else { + item.attachments.push({ + title: 'Snapshot', + document: doc + }); + } + item.complete(); + }); + await translator.translate(); +} + +// Sometimes the bibtex will omit an equals sign after "author" +function fixAuthorLine(input) { + return input.split('\n').map(line => { + return line.replace(/^(\s*author)(?!\s*=)/, '$1='); + }).join('\n'); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://cjtcs.cs.uchicago.edu/articles/2010/1/contents.html", + "items": [ + { + "itemType": "journalArticle", + "title": "Quantum Boolean Functions", + "creators": [ + { + "firstName": "Ashley", + "lastName": "Montanaro", + "creatorType": "author" + }, + { + "firstName": "Tobias J.", + "lastName": "Osborne", + "creatorType": "author" + } + ], + "date": "2010-01", + "DOI": "10.4086/cjtcs.2010.001", + "issue": "1", + "itemID": "cj10-01", + "libraryCatalog": "Chicago Journal of Theoretical Computer Science", + "publicationTitle": "Chicago Journal of Theoretical Computer Science", + "volume": "2010", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://cjtcs.cs.uchicago.edu/articles/2010/contents.html", + "items": "multiple" + }, + { + "type": "web", + "url": "http://cjtcs.cs.uchicago.edu/articles/CATS2009/1/contents.html", + "items": [ + { + "itemType": "journalArticle", + "title": "On Process Complexity", + "creators": [ + { + "firstName": "Adam R.", + "lastName": "Day", + "creatorType": "author" + } + ], + "date": "2010-06", + "DOI": "10.4086/cjtcs.2010.004", + "issue": "4", + "itemID": "cats9-1", + "libraryCatalog": "Chicago Journal of Theoretical Computer Science", + "publicationTitle": "Chicago Journal of Theoretical Computer Science", + "volume": "2010", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Christian Science Monitor.js b/translators/Christian Science Monitor.js new file mode 100644 index 0000000..b889284 --- /dev/null +++ b/translators/Christian Science Monitor.js @@ -0,0 +1,148 @@ +{ + "translatorID": "04c0db88-a7fc-4d1a-9cf7-471d0990acb1", + "label": "Christian Science Monitor", + "creator": "Sebastian Karcher", + "target": "^https?://(features\\.csmonitor|www\\.csmonitor)\\.com", + "minVersion": "2.1.9", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2016-11-01 18:26:01" +} + +/* FW LINE 59:b820c6d */ function flatten(t){var e=new Array;for(var i in t){var r=t[i];r instanceof Array?e=e.concat(flatten(r)):e.push(r)}return e}var FW={_scrapers:new Array};FW._Base=function(){this.callHook=function(t,e,i,r){if("object"==typeof this.hooks){var n=this.hooks[t];"function"==typeof n&&n(e,i,r)}},this.evaluateThing=function(t,e,i){var r=typeof t;if("object"===r){if(t instanceof Array){var n=this.evaluateThing,a=t.map(function(t){return n(t,e,i)});return flatten(a)}return t.evaluate(e,i)}return"function"===r?t(e,i):t},this.makeItems=function(t,e,i,r,n){n()}},FW.Scraper=function(t){FW._scrapers.push(new FW._Scraper(t))},FW._Scraper=function(t){for(x in t)this[x]=t[x];this._singleFieldNames=["abstractNote","applicationNumber","archive","archiveLocation","artworkMedium","artworkSize","assignee","audioFileType","audioRecordingType","billNumber","blogTitle","bookTitle","callNumber","caseName","code","codeNumber","codePages","codeVolume","committee","company","conferenceName","country","court","date","dateDecided","dateEnacted","dictionaryTitle","distributor","docketNumber","documentNumber","DOI","edition","encyclopediaTitle","episodeNumber","extra","filingDate","firstPage","forumTitle","genre","history","institution","interviewMedium","ISBN","ISSN","issue","issueDate","issuingAuthority","journalAbbreviation","label","language","legalStatus","legislativeBody","letterType","libraryCatalog","manuscriptType","mapType","medium","meetingName","nameOfAct","network","number","numberOfVolumes","numPages","pages","patentNumber","place","postType","presentationType","priorityNumbers","proceedingsTitle","programTitle","programmingLanguage","publicLawNumber","publicationTitle","publisher","references","reportNumber","reportType","reporter","reporterVolume","rights","runningTime","scale","section","series","seriesNumber","seriesText","seriesTitle","session","shortTitle","studio","subject","system","thesisType","title","type","university","url","version","videoRecordingType","volume","websiteTitle","websiteType"],this._makeAttachments=function(t,e,i,r){if(i instanceof Array)i.forEach(function(i){this._makeAttachments(t,e,i,r)},this);else if("object"==typeof i){var n=i.urls||i.url,a=i.types||i.type,s=i.titles||i.title,o=i.snapshots||i.snapshot,u=this.evaluateThing(n,t,e),l=this.evaluateThing(s,t,e),c=this.evaluateThing(a,t,e),h=this.evaluateThing(o,t,e);u instanceof Array||(u=[u]);for(var f in u){var p,m,v,d=u[f];p=c instanceof Array?c[f]:c,m=l instanceof Array?l[f]:l,v=h instanceof Array?h[f]:h,r.attachments.push({url:d,title:m,mimeType:p,snapshot:v})}}},this.makeItems=function(t,e,i,r,n){var a=new Zotero.Item(this.itemType);a.url=e;for(var s in this._singleFieldNames){var o=this._singleFieldNames[s];if(this[o]){var u=this.evaluateThing(this[o],t,e);u instanceof Array?a[o]=u[0]:a[o]=u}}var l=["creators","tags"];for(var c in l){var h=l[c],f=this.evaluateThing(this[h],t,e);if(f)for(var p in f)a[h].push(f[p])}this._makeAttachments(t,e,this.attachments,a),r(a,this,t,e),n()}},FW._Scraper.prototype=new FW._Base,FW.MultiScraper=function(t){FW._scrapers.push(new FW._MultiScraper(t))},FW._MultiScraper=function(t){for(x in t)this[x]=t[x];this._mkSelectItems=function(t,e){var i=new Object;for(var r in t)i[e[r]]=t[r];return i},this._selectItems=function(t,e,i){var r=new Array;Zotero.selectItems(this._mkSelectItems(t,e),function(t){for(var e in t)r.push(e);i(r)})},this._mkAttachments=function(t,e,i){var r=this.evaluateThing(this.attachments,t,e),n=new Object;if(r)for(var a in i)n[i[a]]=r[a];return n},this._makeChoices=function(t,e,i,r,n){if(t instanceof Array)t.forEach(function(t){this._makeTitlesUrls(t,e,i,r,n)},this);else if("object"==typeof t){var a=t.urls||t.url,s=t.titles||t.title,o=this.evaluateThing(a,e,i),u=this.evaluateThing(s,e,i),l=u instanceof Array;o instanceof Array||(o=[o]);for(var c in o){var h,f=o[c];h=l?u[c]:u,n.push(f),r.push(h)}}},this.makeItems=function(t,e,i,r,n){if(this.beforeFilter){var a=this.beforeFilter(t,e);if(a!=e)return void this.makeItems(t,a,i,r,n)}var s=[],o=[];this._makeChoices(this.choices,t,e,s,o);var u=this._mkAttachments(t,e,o),l=this.itemTrans;this._selectItems(s,o,function(t){if(t){var e=function(t){var e=t.documentURI,i=l;void 0===i&&(i=FW.getScraper(t,e)),void 0===i||i.makeItems(t,e,u[e],r,function(){})};Zotero.Utilities.processDocuments(t,e,n)}else n()})}},FW._MultiScraper.prototype=new FW._Base,FW.WebDelegateTranslator=function(t){return new FW._WebDelegateTranslator(t)},FW._WebDelegateTranslator=function(t){for(x in t)this[x]=t[x];this.makeItems=function(t,e,i,r,n){var a=this,s=Zotero.loadTranslator("web");s.setHandler("itemDone",function(i,n){r(n,a,t,e)}),s.setDocument(t),this.translatorId?(s.setTranslator(this.translatorId),s.translate()):(s.setHandler("translators",function(t,e){e.length&&(s.setTranslator(e[0]),s.translate())}),s.getTranslators()),n()}},FW._WebDelegateTranslator.prototype=new FW._Base,FW._StringMagic=function(){this._filters=new Array,this.addFilter=function(t){return this._filters.push(t),this},this.split=function(t){return this.addFilter(function(e){return e.split(t).filter(function(t){return""!=t})})},this.replace=function(t,e,i){return this.addFilter(function(r){return r.match(t)?r.replace(t,e,i):r})},this.prepend=function(t){return this.replace(/^/,t)},this.append=function(t){return this.replace(/$/,t)},this.remove=function(t,e){return this.replace(t,"",e)},this.trim=function(){return this.addFilter(function(t){return Zotero.Utilities.trim(t)})},this.trimInternal=function(){return this.addFilter(function(t){return Zotero.Utilities.trimInternal(t)})},this.match=function(t,e){return e||(e=0),this.addFilter(function(i){var r=i.match(t);return void 0===r||null===r?void 0:r[e]})},this.cleanAuthor=function(t,e){return this.addFilter(function(i){return Zotero.Utilities.cleanAuthor(i,t,e)})},this.key=function(t){return this.addFilter(function(e){return e[t]})},this.capitalizeTitle=function(){return this.addFilter(function(t){return Zotero.Utilities.capitalizeTitle(t)})},this.unescapeHTML=function(){return this.addFilter(function(t){return Zotero.Utilities.unescapeHTML(t)})},this.unescape=function(){return this.addFilter(function(t){return unescape(t)})},this._applyFilters=function(t,e){for(i in this._filters){t=flatten(t),t=t.filter(function(t){return void 0!==t&&null!==t});for(var r=0;r0&&a[0])return n}},FW.getScraper=function(t,e){var i=FW.detectWeb(t,e);return FW._scrapers.filter(function(r){return r.evaluateThing(r.itemType,t,e)==i&&r.evaluateThing(r.detect,t,e)})[0]},FW.doWeb=function(t,e){var i=FW.getScraper(t,e);i.makeItems(t,e,[],function(t,e,i,r){e.callHook("scraperDone",t,i,r),t.title||(t.title=""),t.complete()},function(){Zotero.done()}),Zotero.wait()}; + + + +/* + ***** BEGIN LICENSE BLOCK ***** + + Christian Science Monitor Translator + Copyright © 2011 Sebastian Karcher and CHNM + + 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) { return FW.detectWeb(doc, url); } +function doWeb(doc, url) { return FW.doWeb(doc, url); } + + + +/** Articles */ +FW.Scraper({ +itemType : 'magazineArticle', +detect : FW.Xpath('//h1[@id="headline"]'), +title : FW.Xpath('//h1[@id="headline"]').text().trim(), +attachments : [{ url: FW.Url(), + title: "CS Monitor Snapshot", + type: "text/html" }], +creators : FW.Xpath('//meta[contains(@name, "sailthru.author")]/@content').text().cleanAuthor("author"), +date : FW.Xpath('//time[@id="date-published"]/@datetime').text(), +abstractNote : FW.Xpath('//h2[@id="summary"]').text(), +ISSN : "0882-7729", +publicationTitle : "Christian Science Monitor" +}); + + + +FW.MultiScraper({ +itemType : 'multiple', +detect : FW.Url().match(/\/content\/search\?/), +choices : { + titles : FW.Xpath('//h3[@class="story_headline"]/a').text().trim(), + urls : FW.Xpath('//h3[@class="story_headline"]/a').key("href") +} +}); + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://www.csmonitor.com/World/Middle-East/2011/1204/Why-Iran-lashes-out-at-West", + "items": [ + { + "itemType": "magazineArticle", + "title": "Why Iran lashes out at West", + "creators": [ + { + "firstName": "Scott", + "lastName": "Peterson", + "creatorType": "author" + } + ], + "date": "2011-12-04T09:45:36-05:00", + "ISSN": "0882-7729", + "abstractNote": "Is Iran pursuing a systematic strategy to provoke its enemies? It's not always that simple.", + "libraryCatalog": "Christian Science Monitor", + "publicationTitle": "Christian Science Monitor", + "url": "http://www.csmonitor.com/World/Middle-East/2011/1204/Why-Iran-lashes-out-at-West", + "attachments": [ + { + "title": "CS Monitor Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.csmonitor.com/World/Americas/Latin-America-Monitor/2011/1202/Is-it-time-for-Obama-to-simply-ask-Cuba-s-President-Castro-to-free-Alan-Gross", + "items": [ + { + "itemType": "magazineArticle", + "title": "Is it time for Obama to simply ask Cuba's President Castro to free Alan Gross?", + "creators": [ + { + "firstName": "Anya Landau", + "lastName": "French", + "creatorType": "author" + } + ], + "date": "2011-12-02T11:00:00-05:00", + "ISSN": "0882-7729", + "abstractNote": "US officials are proposing new measures to force Cuba to release USAID worker Alan Gross from prison, but guest blogger Anya Landau French suggests trying something different.", + "libraryCatalog": "Christian Science Monitor", + "publicationTitle": "Christian Science Monitor", + "url": "http://www.csmonitor.com/World/Americas/Latin-America-Monitor/2011/1202/Is-it-time-for-Obama-to-simply-ask-Cuba-s-President-Castro-to-free-Alan-Gross", + "attachments": [ + { + "title": "CS Monitor Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.csmonitor.com/content/search?SearchText=Argentina", + "items": "multiple" + } +] +/** END TEST CASES **/ \ No newline at end of file diff --git a/translators/Chronicling America.js b/translators/Chronicling America.js new file mode 100644 index 0000000..7e1fd0e --- /dev/null +++ b/translators/Chronicling America.js @@ -0,0 +1,131 @@ +{ + "translatorID": "fa8f8274-ada5-415a-96dd-a5c19fce7046", + "label": "Chronicling America", + "creator": "Sebastian Karcher", + "target": "^https?://chroniclingamerica\\.loc\\.gov", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2013-03-31 23:29:08" +} + +/* + Chronicling America Translator + Copyright (C) 2012 Sebastian Karcher + + This program 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. + + This program 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 this program. If not, see . +*/ + +function detectWeb(doc,url) { + var xpath='//meta[@name="citation_title"]'; + + if (ZU.xpath(doc, xpath).length > 0) { + return "newspaperArticle"; + } + + if (url.search(/\/search\/pages\/results\/?/)!=-1) { + return "multiple"; + } + + return false; +} + + +function doWeb(doc,url) +{ + if (detectWeb(doc, url) == "multiple") { + var hits = {}; + var urls = []; + var results = ZU.xpath(doc,'//td/div[@class="highlite"]/a[2]'); + + for (var i in results) { + hits[results[i].href] = results[i].textContent; + } + Z.selectItems(hits, function(items) { + if (items == null) return true; + for (var j in items) { + urls.push(j); + } + ZU.processDocuments(urls, doWeb); + }); + } else { + var translator = Zotero.loadTranslator('web'); + //use Embedded Metadata + translator.setTranslator("951c027d-74ac-47d4-a107-9c3069ab7b48"); + translator.setDocument(doc); + translator.setHandler('itemDone', function(obj, item) { + item.itemType = "newspaperArticle"; + if (item.abstractNote) item.notes.push(item.abstractNote); + item.abstractNote = ""; + item.itemID = ""; + var pdfurl = ZU.xpathText(doc, '//head/link[@type="application/pdf"]/@href'); + if (pdfurl){ + item.attachments.push({url:'http://chroniclingamerica.loc.gov' +pdfurl, title:"Chronicling American PDF", mimeType: "application/pdf"}) + } + item.language=ZU.xpathText(doc, '//meta[@name="mods.languageTerm"]/@content') + var publication = ZU.xpathText(doc, '//meta[@name="mods.title"]/@content'); + if (publication) item.publication = publication.replace(/[\.\s]*$/, ""); + item.complete(); + + }); + translator.translate(); + } +} +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://chroniclingamerica.loc.gov/search/pages/results/?date1=1836&rows=20&searchType=basic&state=&date2=1922&proxtext=wilson&y=0&x=0&dateFilterType=yearRange", + "items": "multiple" + }, + { + "type": "web", + "url": "http://chroniclingamerica.loc.gov/lccn/sn83030193/1912-02-14/ed-1/seq-15/#words=Wilson&date1=1836&rows=20&searchType=basic&state=&date2=1922&proxtext=wilson&y=0&x=0&dateFilterType=yearRange&index=4", + "items": [ + { + "itemType": "newspaperArticle", + "title": "The evening world. (New York, N.Y.) 1887-1931, February 14, 1912, Image 15", + "creators": [], + "date": "1912/02/14", + "ISSN": "1941-0654", + "language": "eng", + "libraryCatalog": "chroniclingamerica.loc.gov", + "url": "http://chroniclingamerica.loc.gov/lccn/sn83030193/1912-02-14/ed-1/seq-15/", + "attachments": [ + { + "title": "Snapshot" + }, + { + "title": "Chronicling American PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + "New York (N.Y.)--Newspapers.", + "New York (State)--New York County.--fast--(OCoLC)fst01234953", + "New York (State)--New York.--fast--(OCoLC)fst01204333", + "New York County (N.Y.)--Newspapers." + ], + "notes": [ + "The evening world. (New York, N.Y.) 1887-1931, February 14, 1912, Image 15, brought to you by The New York Public Library, Astor, Lenox and Tilden Foundation, and the National Digital Newspaper Program." + ], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ \ No newline at end of file diff --git a/translators/CiNii Research.js b/translators/CiNii Research.js new file mode 100644 index 0000000..d7321cd --- /dev/null +++ b/translators/CiNii Research.js @@ -0,0 +1,168 @@ +{ + "translatorID": "46291dc3-5cbd-47b7-8af4-d009078186f6", + "label": "CiNii Research", + "creator": "Michael Berkowitz, Mitsuo Yoshida and Satoshi Ando", + "target": "^https?://cir\\.nii\\.ac\\.jp/", + "minVersion": "1.0.0b4.r5", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2024-09-26 14:22:20" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2024 Michael Berkowitz, Mitsuo Yoshida and Satoshi Ando + + 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) { + if (url.includes("/crid/")) { + return "journalArticle"; + } + else if (doc.evaluate('//a[contains(@href, "/crid/")]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { + return "multiple"; + } + return false; +} + +function doWeb(doc, url) { + var arts = []; + if (detectWeb(doc, url) == "multiple") { + var items = {}; + var links = doc.evaluate('//a[contains(@href, "/crid/")]', doc, null, XPathResult.ANY_TYPE, null); + var link; + while ((link = links.iterateNext())) { + items[link.href] = Zotero.Utilities.trimInternal(link.textContent); + } + Zotero.selectItems(items, function (items) { + if (!items) { + return; + } + for (var i in items) { + arts.push(i); + } + Zotero.Utilities.processDocuments(arts, scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, _url) { + var newurl = doc.location.href; + var biblink = ZU.xpathText(doc, '//li/div/a[contains(text(), "BibTeX")]/@href'); + //Z.debug(biblink) + var tags = []; + if (doc.evaluate('//a[@rel="tag"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { + var kws = doc.evaluate('//a[@rel="tag"]', doc, null, XPathResult.ANY_TYPE, null); + var kw; + while ((kw = kws.iterateNext())) { + tags.push(Zotero.Utilities.trimInternal(kw.textContent)); + } + } + //var abstractPath = '//div[@class="abstract"]/p[@class="entry-content"]'; + var abstractPath = '//div[contains(@class, "abstract")]/p[contains(@class, "entry-content")]'; + var abstractNote; + if (doc.evaluate(abstractPath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { + abstractNote = doc.evaluate(abstractPath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent; + } + Zotero.Utilities.HTTP.doGet(biblink, function (text) { + var trans = Zotero.loadTranslator("import"); + trans.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4"); + trans.setString(text); + trans.setHandler("itemDone", function (obj, item) { + item.url = newurl; + item.attachments = [{ url: item.url, title: item.title + " Snapshot", mimeType: "text/html" }]; + item.tags = tags; + item.abstractNote = abstractNote; + if (item.ISSN) { + item.ISSN = ZU.cleanISSN(item.ISSN); + } + item.complete(); + }); + trans.translate(); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://cir.nii.ac.jp/all?q=test&range=0&count=20&sortorder=1&type=0", + "items": "multiple" + }, + { + "type": "web", + "url": "https://cir.nii.ac.jp/crid/1390001204062164736", + "items": [ + { + "itemType": "journalArticle", + "title": "観測用既存鉄骨造モデル構造物を用いたオンライン応答実験", + "creators": [ + { + "firstName": "謙一", + "lastName": "大井", + "creatorType": "author" + }, + { + "firstName": "與助", + "lastName": "嶋脇", + "creatorType": "author" + }, + { + "firstName": "拓海", + "lastName": "伊藤", + "creatorType": "author" + }, + { + "firstName": "玉順", + "lastName": "李", + "creatorType": "author" + } + ], + "date": "2002", + "DOI": "10.11188/seisankenkyu.54.384", + "ISSN": "1881-2058", + "abstractNote": "特集 ERS(耐震構造学)", + "issue": "6", + "itemID": "1390001204062164736", + "libraryCatalog": "CiNii Research", + "pages": "384-387", + "publicationTitle": "生産研究", + "url": "https://cir.nii.ac.jp/crid/1390001204062164736", + "volume": "54", + "attachments": [ + { + "title": "観測用既存鉄骨造モデル構造物を用いたオンライン応答実験 Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Citavi 5 XML.js b/translators/Citavi 5 XML.js new file mode 100644 index 0000000..f142fcd --- /dev/null +++ b/translators/Citavi 5 XML.js @@ -0,0 +1,516 @@ +{ + "translatorID": "e7243cef-a709-4a46-ba46-1b1318051bec", + "label": "Citavi 5 XML", + "creator": "Philipp Zumstein, Tomasz Najdek", + "target": "xml", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "configOptions": { + "dataMode": "xml/dom", + "async": true + }, + "inRepository": true, + "translatorType": 1, + "lastUpdated": "2025-01-04 01:03:00" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2016 Philipp Zumstein + + 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 ***** +*/ + + +/* +TEST DATA can be found here: + - Single reference (162 KB) text: https://gist.github.com/zuphilip/02d6478ace4636e4e090e348443c551e + - Larger project (1221 KB): https://gist.github.com/zuphilip/76ce89ebbdac0386507b36cff3fd499a + - Other project (1,11 MB): https://gist.github.com/anonymous/10fc363b6d79dae897e296a4327aa707 + - Citavi 6 project (935 KB): https://gist.github.com/zuphilip/00a4ec6df58ac24b68366e32531bae4b + - Nested categories: (34 KB): https://gist.github.com/tnajdek/b2375e52b48c7bf82f9f592b4f2122f5 +*/ + +function detectImport() { + var text = Zotero.read(1000); + return text.includes(" 0) { + item.publisher = attachName(doc, publishers).join('; '); + } + + var keywords = ZU.xpathText(doc, '//ReferenceKeywords/OnetoN[starts-with(text(), "' + item.itemID + '")]'); + if (keywords && keywords.length > 0) { + item.tags = attachName(doc, keywords); + } + if (rememberTags[item.itemID]) { + for (var j = 0; j < rememberTags[item.itemID].length; j++) { + item.tags.push(rememberTags[item.itemID][j]); + } + } + + // For all corresponding knowledge items attach a note containing + // the information of it. + var citations = ZU.xpath(doc, '//KnowledgeItem[ReferenceID="' + item.itemID + '"]'); + for (let j = 0; j < citations.length; j++) { + var noteObject = {}; + noteObject.id = ZU.xpathText(citations[j], '@id'); + var title = ZU.xpathText(citations[j], 'CoreStatement'); + var text = ZU.xpathText(citations[j], 'Text'); + var pages = extractPages(ZU.xpathText(citations[j], 'PageRange')); + noteObject.note = ''; + if (title) { + noteObject.note += '

    ' + title + "

    \n"; + } + if (text) { + noteObject.note += "

    " + ZU.xpathText(citations[j], 'Text') + "

    \n"; + } + if (pages) { + noteObject.note += "" + pages + ""; + } + if (rememberTags[noteObject.id]) { + noteObject.tags = rememberTags[noteObject.id]; + } + if (noteObject.note != "") { + item.notes.push(noteObject); + } + } + + // Locations will be saved as URIs in attachments, DOI, extra etc. + var locations = ZU.xpath(doc, '//Locations/Location[ReferenceID="' + item.itemID + '"]'); + // If we only have partial information about the callnumber or + // library location, then we save this info in these two arrays + // which will then processed after the for loop if no other info + // was found. + var onlyLibraryInfo = []; + var onlyCallNumber = []; + for (let j = 0; j < locations.length; j++) { + var address = ZU.xpathText(locations[j], 'Address'); + if (address && citaviVersion[0] !== "5") { + var jsonAddress = JSON.parse(address); + // Z.debug(jsonAddress); + address = jsonAddress.UriString; + } + var addressType = ZU.xpathText(locations[j], 'MirrorsReferencePropertyId'); + if (address) { + if (addressType == "Doi" && !item.DOI) { + item.DOI = address; + } + else if (addressType == "PubMedId" && ((item.extra && !item.extra.includes("PMID")) || !item.extra)) { + addExtraLine(item, "PMID", address); + } + else { + // distinguish between local paths and internet addresses + // (maybe also encoded in AddressInfo subfield?) + item.attachments.push( + (address.indexOf('http://') == 0 || address.indexOf('https://') == 0) + ? { url: address, title: "Online" } + : { path: address, title: "Full Text" } + ); + } + } + var callNumber = ZU.xpathText(locations[j], 'CallNumber'); + var libraryId = ZU.xpathText(locations[j], 'LibraryID'); + if (callNumber && libraryId) { + item.callNumber = callNumber; + item.libraryCatalog = ZU.xpathText(doc.getElementById(libraryId), "Name"); + } + else if (callNumber) { + onlyCallNumber.push(callNumber); + } + else if (libraryId) { + onlyLibraryInfo.push(ZU.xpathText(doc.getElementById(libraryId), "Name")); + } + } + if (!item.callNumber) { + if (onlyCallNumber.length > 0) { + item.callNumber = onlyCallNumber[0]; + } + else if (onlyLibraryInfo.length > 0) { + item.libraryCatalog = onlyLibraryInfo[0]; + } + } + + // Only for journalArticle and conferencePaper the DOI field is + // currently established and therefore we need to add the info for + // all other itemTypes in the extra field. + if (item.DOI && item.itemType != "journalArticle" && item.itemType != "conferencePaper") { + addExtraLine(item, "DOI", item.DOI); + } + + // The items of type contribution need more data from their container + // element and are therefore not yet finished. The other items can + // be completed here. + itemIdList[item.itemID] = item; + + if (type == "Contribution") { + unfinishedReferences.push(item); + } + else { + await item.complete(); // eslint-disable-line no-await-in-loop + Z.setProgress(++progress.current / progress.total * 100); + } + } +} + +// For unfinished references we add additional data from the +// container item and save the relation between them as well. +async function importUnfinished({ doc, itemIdList, progress, unfinishedReferences }) { + for (var i = 0; i < unfinishedReferences.length; i++) { + var item = unfinishedReferences[i]; + var containerString = ZU.xpathText(doc, `//ReferenceReferences/OnetoN[contains(text(), "${item.itemID}")]`); + if (containerString) { + var containerId = containerString.split(';')[0]; + var containerItem = itemIdList[containerId]; + if (containerItem.type == "ConferenceProceedings") { + item.itemType = "conferencePaper"; + } + item.publicationTitle = containerItem.title; + item.place = containerItem.place; + item.publisher = containerItem.publisher; + item.ISBN = containerItem.ISBN; + item.volume = containerItem.volume; + item.edition = containerItem.edition; + item.series = containerItem.series; + + for (var j = 0; j < containerItem.creators.length; j++) { + var creatorObject = containerItem.creators[j]; + var role = creatorObject.creatorType; + if (role == "author") { + creatorObject.creatorType = "bookAuthor"; + } + item.creators.push(creatorObject); + } + + item.seeAlso.push(containerItem.itemID); + } + await item.complete(); // eslint-disable-line no-await-in-loop + Z.setProgress(++progress.current / progress.total * 100); + } +} + +// Task items will be mapped to new standalone note +async function importTasks({ tasks, progress }) { + for (var i = 0, n = tasks.length; i < n; i++) { + let item = new Zotero.Item("note"); + var dueDate = ZU.xpathText(tasks[i], './DueDate'); + if (dueDate) { + item.note = "

    " + ZU.xpathText(tasks[i], './Name') + " until " + dueDate + "

    "; + } + else { + item.note = "

    " + ZU.xpathText(tasks[i], './Name') + "

    "; + } + var noteText = ZU.xpathText(tasks[i], './Notes'); + if (noteText) { + item.note += "\n" + noteText; + } + + item.seeAlso.push(ZU.xpathText(tasks[i], './ReferenceID')); + + item.tags.push("#todo"); + await item.complete(); // eslint-disable-line no-await-in-loop + Z.setProgress(++progress.current / progress.total * 100); + } +} + +function addHierarchyNumberRecursive(collections, level = null) { + let index = 1; + for (const collection of collections) { + const hierarchyNumber = level === null ? `${index++}` : `${level}.${index++}`; + collection.name = `${hierarchyNumber} ${collection.name}`; + addHierarchyNumberRecursive( + collection.children.filter(c => c instanceof Zotero.Collection), hierarchyNumber + ); + } +} + +function importCategories({ categories, doc, progress }) { + // typo CategoryCatgories was fixed in Citavi 6 + var hierarchy = ZU.xpath(doc, '//CategoryCatgories/OnetoN|//CategoryCategories/OnetoN'); + + const parentMap = new Map(); + for (let i = 0, n = hierarchy.length; i < n; i++) { + var categoryLists = hierarchy[i].textContent.split(";"); + parentMap.set(categoryLists[0], categoryLists.slice(1)); + } + + // Create a Zotero collection for each Citavi category + const collectionsMap = new Map(); + for (let i = 0, n = categories.length; i < n; i++) { + var collection = new Zotero.Collection(); + collection.id = ZU.xpathText(categories[i], './@id'); + collection.name = ZU.xpathText(categories[i], './Name'); + collection.type = 'collection'; + collection.children = []; + + // Assign items to collections + var referenceCategories = ZU.xpath(doc, '//ReferenceCategories/OnetoN[contains(text(), "' + collection.id + '")]'); + for (let j = 0; j < referenceCategories.length; j++) { + var refid = referenceCategories[j].textContent.split(';')[0]; + collection.children.push({ type: 'item', id: refid }); + } + collectionsMap.set(collection.id, collection); + } + + const addedChildIDs = []; + + // Recreate collections hierarchy + for (const [parentID, childIDs] of parentMap.entries()) { + if (!collectionsMap.has(parentID)) { + continue; + } + const parentCollection = collectionsMap.get(parentID); + + childIDs.forEach((childID) => { + if (collectionsMap.has(childID)) { + parentCollection.children.push(collectionsMap.get(childID)); + addedChildIDs.push(childID); + } + }); + } + + // skip collections that were successfuly assigned to a parent + for (const childID of addedChildIDs) { + collectionsMap.delete(childID); + } + + // add hierarchy number to a collection name (e.g. 1 for first root + // collection and 1.1, 1.2 etc. for subcollections) + addHierarchyNumberRecursive(collectionsMap.values()); + + for (const collection of collectionsMap.values()) { + collection.complete(); + Z.setProgress(++progress.current / progress.total * 100); + } +} + +async function doImport() { + var doc = Zotero.getXML(); + var citaviVersion = ZU.xpathText(doc, '//CitaviExchangeData/@Version'); + + // Groups will also be mapped to tags which can be assigned to + // items or notes. + var groups = ZU.xpath(doc, '//Groups/Group'); + var rememberTags = {}; + for (var i = 0; i < groups.length; i++) { + var id = ZU.xpathText(groups[i], './@id'); + var name = ZU.xpathText(groups[i], './Name'); + var referenceGroups = ZU.xpath(doc, `//ReferenceGroups/OnetoN[contains(text(), "${id}")]|//KnowledgeItemGroups/OnetoN[contains(text(), "${id}")]`); + for (var j = 0; j < referenceGroups.length; j++) { + var refid = referenceGroups[j].textContent.split(';')[0]; + if (rememberTags[refid]) { + rememberTags[refid].push(name); + } + else { + rememberTags[refid] = [name]; + } + } + } + var tasks = ZU.xpath(doc, '//TaskItems/TaskItem'); + var categories = ZU.xpath(doc, '//Categories/Category'); + + // Main information for each reference. + var references = ZU.xpath(doc, '//References/Reference'); + var unfinishedReferences = []; + var itemIdList = {}; + + // Because Zotero may also import annotations, we only move progress within 0-50% range, hence `totalProgress * 2` + // https://github.com/zotero/zotero/blob/6ca854a018e8bfe4251fbf42610276c441b5d943/chrome/content/zotero/import/citavi.js#L28 + const totalProgress = references.length + tasks.length + categories.length; + const progress = { total: totalProgress * 2, current: 0 }; + + await importItems({ references, doc, citaviVersion, rememberTags, itemIdList, progress, unfinishedReferences }); + await importUnfinished({ doc, itemIdList, unfinishedReferences, progress }); + await importTasks({ tasks, progress }); + importCategories({ categories, doc, progress }); +} + +function attachName(doc, ids) { + var valueList = []; + + if (!ids || !ids.length || ids.length <= 0) { + return valueList; + } + + var idList = ids.split(';'); + // skip the first element which is the id of reference + for (var j = 1; j < idList.length; j++) { + var author = doc.getElementById(idList[j]); + valueList.push(ZU.xpathText(author, 'Name')); + } + return valueList; +} + +// For each id in the list of ids, find the +// corresponding node in the document and +// attach the data to the creators array. +function attachPersons(doc, item, ids, type) { + if (!ids || !ids.length || ids.length <= 0) { + return; + } + var authorIds = ids.split(';'); + // skip the first element which is the id of reference + for (var j = 1; j < authorIds.length; j++) { + var author = doc.getElementById(authorIds[j]); + var lastName = ZU.xpathText(author, 'LastName'); + var firstName = ZU.xpathText(author, 'FirstName'); + var middleName = ZU.xpathText(author, 'MiddleName'); + if (firstName && lastName) { + if (middleName) { + firstName += ' ' + middleName; + } + item.creators.push({ lastName, firstName, creatorType: type }); + } + if (!firstName && lastName) { + item.creators.push({ lastName, creatorType: type, fieldMode: true }); + } + } +} + +function addExtraLine(item, prefix, text) { + if (text) { + if (!item.extra) { + item.extra = ''; + } + item.extra += prefix + ': ' + text + "\n"; + } +} + +function extractPages(multilineText) { + if (multilineText) { + var parts = multilineText.split("\n"); + return parts[parts.length - 1].replace(/[^0-9\-–]/g, ''); + } + return ''; +} diff --git a/translators/CiteSeer.js b/translators/CiteSeer.js new file mode 100644 index 0000000..766d98a --- /dev/null +++ b/translators/CiteSeer.js @@ -0,0 +1,196 @@ +{ + "translatorID": "fa396dd4-7d04-4f99-95e1-93d6f355441d", + "label": "CiteSeer", + "creator": "Sebastian Karcher, Guy Aglionby", + "target": "^https?://citeseerx?\\.ist\\.psu\\.edu", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2018-01-28 16:31:16" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2018 Sebastian Karcher, Guy Aglionby + 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) { + if ((url.includes('/search') || url.includes('/showciting')) && getSearchResults(doc).length) { + return "multiple"; + } + //for running the tests with book example + if (url == "http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.332.356&rank=1") return "book"; + if ((url.includes('/viewdoc/') && doc.getElementById('bibtex')) + || url.includes('/download?doi=')) { + return "journalArticle"; + } +} + +function getSearchResults(doc) { + return ZU.xpath(doc, '//div[@class="result"]/h3/a'); +} + +function doWeb(doc, url) { + var articles = []; + if (detectWeb(doc, url) == "multiple") { + var items = {}; + var titles = getSearchResults(doc); + for (var i=0; i. + + ***** END LICENSE BLOCK ***** +*/ + + +function detectWeb(doc, _url) { + // every page claims to be an article, so we have to do something a little + // more specific + if (doc.querySelector('[itemprop="headline"]')) { + return "report"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('article h1 > a'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', function (obj, item) { + item.title = item.title.replace(/\s*- The Citizen Lab\s*$/, ''); + + item.creators = []; + for (let author of doc.querySelectorAll('header [rel="author"]')) { + item.creators.push(ZU.cleanAuthor(author.textContent, 'author')); + } + + let pdfURL = attr(doc, '#other_version_of_post a', 'href'); + if (pdfURL) { + item.attachments.push({ + title: 'Full Text PDF', + mimeType: 'application/pdf', + url: pdfURL + }); + } + + delete item.language; // inaccurate for non-English reports + + // let's try to match their recommended citations for official publications + // from https://citizenlab.ca/publications/ + item.libraryCatalog = ''; + item.institution = 'Citizen Lab, University of Toronto'; + + ZU.processDocuments('/publications/', function (pubsDoc) { + let pointer = pubsDoc.querySelector(`a[href="${item.url}"]`); + if (pointer) { + let cite = pointer.parentNode.textContent; + let reportNumber = cite.match(/Citizen Lab Research Report No\. [^,]+/); + if (reportNumber) { + item.reportNumber = reportNumber[0]; + item.institution = 'University of Toronto'; + } + } + + item.complete(); + }); + }); + + translator.getTranslatorObject(function (trans) { + trans.itemType = "report"; + trans.doWeb(doc, url); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://citizenlab.ca/2021/09/forcedentry-nso-group-imessage-zero-click-exploit-captured-in-the-wild/", + "items": [ + { + "itemType": "report", + "title": "FORCEDENTRY: NSO Group iMessage Zero-Click Exploit Captured in the Wild", + "creators": [ + { + "firstName": "Bill", + "lastName": "Marczak", + "creatorType": "author" + }, + { + "firstName": "John", + "lastName": "Scott-Railton", + "creatorType": "author" + }, + { + "firstName": "Bahr Abdul", + "lastName": "Razzak", + "creatorType": "author" + }, + { + "firstName": "Noura", + "lastName": "Al-Jizawi", + "creatorType": "author" + }, + { + "firstName": "Siena", + "lastName": "Anstis", + "creatorType": "author" + }, + { + "firstName": "Kristin", + "lastName": "Berdan", + "creatorType": "author" + }, + { + "firstName": "Ron", + "lastName": "Deibert", + "creatorType": "author" + } + ], + "date": "2021-09-13T19:26:12+00:00", + "abstractNote": "While analyzing the phone of a Saudi activist infected with NSO Group’s Pegasus spyware, we discovered a zero-day zero-click exploit against iMessage. The exploit, which we call FORCEDENTRY, targets Apple’s image rendering library, and was effective against Apple iOS, MacOS and WatchOS devices.", + "institution": "Citizen Lab, University of Toronto", + "shortTitle": "FORCEDENTRY", + "url": "https://citizenlab.ca/2021/09/forcedentry-nso-group-imessage-zero-click-exploit-captured-in-the-wild/", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://citizenlab.ca/2021/04/canadas-proposed-privacy-law-reforms-are-not-enough-improving-organizational-transparency-and-accountability-bill-c11/", + "items": [ + { + "itemType": "report", + "title": "Canada’s Proposed Privacy Law Reforms Are Not Enough: A Path to Improving Organizational Transparency and Accountability", + "creators": [ + { + "firstName": "Christopher", + "lastName": "Parsons", + "creatorType": "author" + } + ], + "date": "2021-04-23T13:00:52+00:00", + "abstractNote": "Given our experiences, we have specific recommendations for how any federal commercial privacy legislation must be amended to better protect individuals from the predations and power of private organizations. In making our recommendations we have chosen to focus almost exclusively on the Openness and Transparency, Access to and Amendment of Personal Information, and Whistleblower sections of Bill C-11.", + "institution": "University of Toronto", + "reportNumber": "Citizen Lab Research Report No. 138", + "shortTitle": "Canada’s Proposed Privacy Law Reforms Are Not Enough", + "url": "https://citizenlab.ca/2021/04/canadas-proposed-privacy-law-reforms-are-not-enough-improving-organizational-transparency-and-accountability-bill-c11/", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://citizenlab.ca/2021/03/tiktok-vs-douyin-security-privacy-analysis/", + "items": [ + { + "itemType": "report", + "title": "TikTok vs Douyin: A Security and Privacy Analysis", + "creators": [ + { + "firstName": "Pellaeon", + "lastName": "Lin", + "creatorType": "author" + } + ], + "date": "2021-03-22T13:00:16+00:00", + "abstractNote": "A comparative analysis of security, privacy, and censorship issues in TikTok and Douyin, both developed by ByteDance.", + "institution": "University of Toronto", + "reportNumber": "Citizen Lab Research Report No. 137", + "shortTitle": "TikTok vs Douyin", + "url": "https://citizenlab.ca/2021/03/tiktok-vs-douyin-security-privacy-analysis/", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://citizenlab.ca/2021/08/%d9%85%d9%86-%d8%a7%d9%84%d9%84%d8%a4%d9%84%d8%a4%d8%a9-%d8%a5%d9%84%d9%89-%d8%a8%d9%8a%d8%ba%d8%a7%d8%b3%d9%88%d8%b3-%d8%a7%d9%84%d8%ad%d9%83%d9%88%d9%85%d8%a9-%d8%a7%d9%84%d8%a8%d8%ad%d8%b1%d9%8a/", + "items": [ + { + "itemType": "report", + "title": "من اللؤلؤة إلى بيغاسوس: الحكومة البحرينية تخترق نشطاء عبر استغلال ثغرة \"Zero-Click\" من \"NSO Group\"", + "creators": [], + "date": "2021-08-24T10:01:46+00:00", + "abstractNote": "لقد حددنا تسعة نشطاء بحرينيين تم اختراق أجهزتهم الآيفون باستخدام برنامج تجسس \"Pegasus\" من NSO Group في الفترة ما بين يونيو 2020 و فبراير 2021. بعض النشطاء قد تم اختراقهم باستغلال ثغرتين zero-click في iMessage, كنا قد سمينا الثغرتين التي تم اكتشافها في 2020 ب KISMET، أما الثغرة المستخدمة في 2021 فنسميها FORCEDENTRY", + "institution": "Citizen Lab, University of Toronto", + "shortTitle": "من اللؤلؤة إلى بيغاسوس", + "url": "https://citizenlab.ca/2021/08/من-اللؤلؤة-إلى-بيغاسوس-الحكومة-البحري/", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://citizenlab.ca/2019/05/burned-after-reading-endless-mayflys-ephemeral-disinformation-campaign/", + "items": [ + { + "itemType": "report", + "title": "Burned After Reading: Endless Mayfly’s Ephemeral Disinformation Campaign", + "creators": [ + { + "firstName": "Gabrielle", + "lastName": "Lim", + "creatorType": "author" + }, + { + "firstName": "Etienne", + "lastName": "Maynier", + "creatorType": "author" + }, + { + "firstName": "John", + "lastName": "Scott-Railton", + "creatorType": "author" + }, + { + "firstName": "Alberto", + "lastName": "Fittarelli", + "creatorType": "author" + }, + { + "firstName": "Ned", + "lastName": "Moran", + "creatorType": "author" + }, + { + "firstName": "Ron", + "lastName": "Deibert", + "creatorType": "author" + } + ], + "date": "2019-05-14T04:01:02+00:00", + "abstractNote": "Using Endless Mayfly as an illustration, this highlights the challenges of investigating & addressing disinformation from research & policy perspectives.", + "institution": "University of Toronto", + "reportNumber": "Citizen Lab Research Report No. 118", + "shortTitle": "Burned After Reading", + "url": "https://citizenlab.ca/2019/05/burned-after-reading-endless-mayflys-ephemeral-disinformation-campaign/", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + }, + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://citizenlab.ca/?s=mayfly", + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/Civilization.ca.js b/translators/Civilization.ca.js new file mode 100644 index 0000000..2aab1bc --- /dev/null +++ b/translators/Civilization.ca.js @@ -0,0 +1,146 @@ +{ + "translatorID": "8451431a-895f-4732-8339-79eb6756d2f9", + "label": "Civilization.ca", + "creator": "Adam Crymble", + "target": "^https?://collections\\.civilization\\.ca", + "minVersion": "1.0.0b4.r5", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-12-28 04:38:36" +} + +function detectWeb(doc, url) { + if (doc.evaluate('//tr/td[2]/a/font', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { + return "multiple"; + } else if (doc.location.href.match("Display.php")) { + return "artwork"; + } +} + +//Civilization.ca translator. Code by Adam Crymble. + +function associateData (newItem, dataTags, field, zoteroField) { + if (dataTags[field]) { + newItem[zoteroField] = dataTags[field]; + } +} + +function scrape(doc, url) { + + var dataTags = new Object(); + var tagsContent = new Array(); + var fieldTitle; + + var newItem = new Zotero.Item("artwork"); + + var headers = doc.evaluate('//table[2]/tbody/tr/td[1]/span[@class="textb"]/b', doc, null, XPathResult.ANY_TYPE, null); + var contents = doc.evaluate('//tr[2]/td/table[2]/tbody/tr/td[2]', doc, null, XPathResult.ANY_TYPE, null); + var xPathCount = doc.evaluate('count (//table[2]/tbody/tr/td[1]/span[@class="textb"]/b)', doc, null, XPathResult.ANY_TYPE, null); + + newItem.title = contents.iterateNext().textContent.replace(/^\s*|\s+$/g, ''); + var dump = contents.iterateNext(); + + for (i=0; i. + + ***** END LICENSE BLOCK ***** +*/ + + +function detectWeb(doc, url) { + if (url.includes('/index.cfm/detail/')) { + return 'journalArticle'; + } + + let appRoot = doc.querySelector("#app"); // Ajax app "mount point" + if (appRoot) { + // Watch for live filtering of search results) + Z.monitorDOMChanges(appRoot); + } + if (getSearchResults(doc, true)) { + return 'multiple'; + } + + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('#ccpp_results-list .ccpp_result-title>a'); + for (let row of rows) { + let href = row.href; + 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); + } +} + +async function scrape(doc) { + var pmid = text(doc, 'li>a[href*="www.ncbi.nlm.nih.gov/pubmed"]'); + var doi = text(doc, 'li>a[href*="doi.org/10."]'); + var abstract = text(doc, '#cchh-detail-abstract'); + Z.debug(pmid); + Z.debug(doi); + if (pmid) { + pmid = pmid.match(/\.gov\/pubmed\/(\d+)/)[1]; + let translate = Z.loadTranslator('search'); + translate.setTranslator('3d0231ce-fd4b-478c-b1d3-840389e5b68c'); + translate.setSearch({ itemType: "journalArticle", PMID: pmid }); + + await translate.translate(); + } + else if (doi) { + let translate = Z.loadTranslator('search'); + translate.setSearch({ DOI: ZU.cleanDOI(doi) }); + translate.setTranslator('b28d0d42-8549-4c6d-83fc-8382874a5cb9'); // DOI Content Negotiation + translate.setHandler("itemDone", function (obj, item) { + // ad abstract from page + if (abstract && !item.abstractNote) { + item.abstractNote = abstract; + } + item.complete(); + }); + await translate.translate(); + } + else { + // scrape if we have to; I couldn't find a live example of this + var item = new Zotero.Item("journalArticle"); + item.title = text(doc, 'h1>span'); + item.date = ZU.xpathText(doc, '//div[@class="cchh-content_label" and contains(text(), "Year:")]/following-sibling::div'); + let authors = ZU.xpathText(doc, '//div[@class="cchh-content_label" and contains(text(), "Author(s):")]/following-sibling::div'); + let publication = ZU.xpathText(doc, '//div[@class="cchh-content_label" and contains(text(), "Journal:")]/following-sibling::div'); + for (let author of authors.split(", ")) { + author = author.replace(/\s([A-Z]+)$/, ", $1"); + item.creators.push(ZU.cleanAuthor(author, "author", true)); + } + if (publication) { + var pubinfo = publication.match(/^(.+?)\.\s*(\d+)\s*(?:\((\d+)\))?:\s*([\d-]+?)$/); + if (pubinfo) { + item.publicationTitle = pubinfo[1]; + item.volume = pubinfo[2]; + item.issue = pubinfo[3]; + item.pages = pubinfo[4]; + } + } + + item.complete(); + } +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://tools.niehs.nih.gov/cchhl/index.cfm/detail/20124#searchTerm=testing&selectedFacets=&selectedResults=", + "items": [ + { + "itemType": "journalArticle", + "title": "An analytical heat wave definition based on the impact on buildings and occupants", + "creators": [ + { + "creatorType": "author", + "firstName": "Alfonso P.", + "lastName": "Ramallo-González" + }, + { + "creatorType": "author", + "firstName": "Matt E.", + "lastName": "Eames" + }, + { + "creatorType": "author", + "firstName": "Sukumar", + "lastName": "Natarajan" + }, + { + "creatorType": "author", + "firstName": "Daniel", + "lastName": "Fosas-de-Pando" + }, + { + "creatorType": "author", + "firstName": "David A.", + "lastName": "Coley" + } + ], + "date": "06/2020", + "DOI": "10.1016/j.enbuild.2020.109923", + "ISSN": "03787788", + "abstractNote": "Alongside a mean global rise in temperature, climate change predictions point to an increase in heat waves and an associated rise in heat-related mortality. This suggests a growing need to ensure buildings are resilient to such events. Unfortunately, there is no agreed way of doing this, and no standard set of heatwaves for scientists or engineers to use. In addition, in all cases, heat waves are defined in terms of external conditions, yet, as the Paris heat wave of 2003 showed, people die in the industrialised world from the conditions inside buildings, not those outside. In this work, we reverse engineer external temperature time series from monitored conditions within a representative set of buildings during a heat wave. This generates a general probabilistic analytical relationship between internal and external heatwaves and thereby a standard set of events for testing resilience. These heat waves are by their simplicity ideal for discussions between clients and designers, or for the setting of national building codes. In addition, they provide a new framework for the declaration of a health emergency. (C) 2020 Published by Elsevier B.V.", + "journalAbbreviation": "Energy and Buildings", + "language": "en", + "libraryCatalog": "DOI.org (Crossref)", + "pages": "109923", + "publicationTitle": "Energy and Buildings", + "url": "https://linkinghub.elsevier.com/retrieve/pii/S0378778819330622", + "volume": "216", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://tools.niehs.nih.gov/cchhl/index.cfm/main/search#/params?searchTerm=heat%20pump&selectedFacets=&selectedResults=", + "defer": true, + "items": "multiple" + }, + { + "type": "web", + "url": "https://tools.niehs.nih.gov/cchhl/index.cfm/detail/10206#searchTerm=heat%20pump&selectedFacets=&selectedResults=", + "items": [ + { + "itemType": "journalArticle", + "title": "Heat waves, aging, and human cardiovascular health", + "creators": [ + { + "firstName": "W. Larry", + "lastName": "Kenney", + "creatorType": "author" + }, + { + "firstName": "Daniel H.", + "lastName": "Craighead", + "creatorType": "author" + }, + { + "firstName": "Lacy M.", + "lastName": "Alexander", + "creatorType": "author" + } + ], + "date": "2014-10", + "DOI": "10.1249/MSS.0000000000000325", + "ISSN": "1530-0315", + "abstractNote": "This brief review is based on a President's Lecture presented at the Annual Meeting of the American College of Sports Medicine in 2013. The purpose of this review was to assess the effects of climate change and consequent increases in environmental heat stress on the aging cardiovascular system. The earth's average global temperature is slowly but consistently increasing, and along with mean temperature changes come increases in heat wave frequency and severity. Extreme passive thermal stress resulting from prolonged elevations in ambient temperature and prolonged physical activity in hot environments creates a high demand on the left ventricle to pump blood to the skin to dissipate heat. Even healthy aging is accompanied by altered cardiovascular function, which limits the extent to which older individuals can maintain stroke volume, increase cardiac output, and increase skin blood flow when exposed to environmental extremes. In the elderly, the increased cardiovascular demand during heat waves is often fatal because of increased strain on an already compromised left ventricle. Not surprisingly, excess deaths during heat waves 1) occur predominantly in older individuals and 2) are overwhelmingly cardiovascular in origin. Increasing frequency and severity of heat waves coupled with a rapidly growing at-risk population dramatically increase the extent of future untoward health outcomes.", + "extra": "PMID: 24598696\nPMCID: PMC4155032", + "issue": "10", + "journalAbbreviation": "Med Sci Sports Exerc", + "language": "eng", + "libraryCatalog": "PubMed", + "pages": "1891-1899", + "publicationTitle": "Medicine and Science in Sports and Exercise", + "volume": "46", + "attachments": [ + { + "title": "PubMed entry", + "mimeType": "text/html", + "snapshot": false + } + ], + "tags": [ + { + "tag": "Aged" + }, + { + "tag": "Aged, 80 and over" + }, + { + "tag": "Aging" + }, + { + "tag": "Cardiovascular Diseases" + }, + { + "tag": "Cardiovascular System" + }, + { + "tag": "Cause of Death" + }, + { + "tag": "Climate Change" + }, + { + "tag": "Heat Stress Disorders" + }, + { + "tag": "Humans" + }, + { + "tag": "Skin Aging" + }, + { + "tag": "Sports Medicine" + }, + { + "tag": "Sweating" + } + ], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Clinical Key.js b/translators/Clinical Key.js new file mode 100644 index 0000000..f938fc0 --- /dev/null +++ b/translators/Clinical Key.js @@ -0,0 +1,367 @@ +{ + "translatorID": "a55463ba-e403-415b-80d4-284d5f9b4b15", + "label": "Clinical Key", + "creator": "Jaret M. Karnuta, Mike Davidson", + "target": "^https?://(www\\.|www-)clinicalkey(\\.|-)com", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2017-01-30 08:08:52" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2017 Jaret M. Karnuta & Mike Davidson + + 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 ***** +*/ + +/* +This translator is designed specifically for use on book section portions and journal articles of +ClinicalKey. It will not work on book overview pages or journal table of contents pages. + +NB: url and doc.location.href are different. I think it is because of the way clinicalkey redirects. +Replicate by going to a content page (/content/book/...) and then going to a broswing page (/browse/book/...). +URL remains the page of the previous page (content page) and doc.location.href is the current page (as it should be). + +Hence, I never use url and change its content to doc.location.href in detectWeb, the only function that uses the url + +To get journal article metadata, Publisher Item Identifier (PIIs) are extracted from the Scopus EID +and queried using the CrossRef REST API. +Documentation at: +https://github.com/CrossRef/rest-api-doc +CrossReff REST API Return Values at: +https://github.com/CrossRef/rest-api-doc/blob/master/api_format.md +*/ + +function detectWeb(doc, url) { + //see NB above for explanation + url = doc.location.href; + + //contentType depends on url, which is present, but rest of site is loaded via ajax (I think) + //monitor dom and reset if changes + var jsession = doc.getElementById('jsessionid'); + if (jsession){ + Zotero.monitorDOMChanges(jsession, {attributes:true}); + if (!jsession.value){ + return; + } + } + + var contentType; + //contains /content/book/ and does not contain login? + if (url.indexOf("/content/book/") != -1 && url.indexOf("login?") == -1){ + contentType = "bookSection"; + } + //similar structure to above + else if (url.indexOf('/browse/book/') != -1 && url.indexOf("login?") == -1){ + contentType = "book"; + } + // similar structure to above, for journal articles + else if (url.indexOf('/content/journal/') != -1 && url.indexOf("login?") == -1){ + contentType = "journalArticle"; + } + + //contentType not set + if (!contentType){ + return; + } + return contentType; +} + +function doWeb(doc, url){ + var contentType = detectWeb(doc, url); + + //if book section + if (contentType == 'bookSection'){ + var newItem = new Zotero.Item(contentType); + newItem = scrapeBookSection(doc, newItem); + //pdf (if present) + var pdfLink = getPDFLink(doc); + if (pdfLink) { + newItem.attachments.push({ + url:pdfLink, + title:"Book Section PDF", + mimeType:"application/pdf" + }); + } + //populate common attributes + //url, see NB above for explanation as to why url is NOT used + newItem.url = doc.location.href; + newItem.complete(); + } + //if book, use ISBN translator + //borrowed from amazon translator + else if (contentType == 'book'){ + var isbn = ZU.xpath(doc, "//button/@data-metadata-isbn"); + if (!isbn){ + return; + } + isbn = ZU.cleanISBN(isbn[0].value); + //use search translator to get metadata from isbn + var search = Zotero.loadTranslator("search"); + //set translators and search + search.setHandler("translators", function(obj, translators) { + search.setTranslator(translators); + search.setHandler("itemDone", function(obj, lookupItem) { + newItem=lookupItem; + //update ISBN + newItem.ISBN = ZU.cleanISBN(isbn); + //Override library catalog + newItem.libraryCatalog = "Clinical Key"; + //update url, see NB for rationale why url not used + newItem.url = doc.location.href; + }); + search.translate(); + }); + //no need to override error handler + //save item + search.setHandler("done", function() { + newItem.complete(); + }); + search.setSearch({ ISBN: isbn }); + search.getTranslators(); + } + else if (contentType == 'journalArticle') { + var eid; + var pii; + try { + eid = url.split('/'); + pii = eid.pop().slice(7); + if (!/^S(\d{15}X|\d{16})/.test(pii)){ + throw new Error('PII from url failed. Trying Xpath'); + } + } catch(e) { + Zotero.debug(e); + eid = ZU.xpathText(doc, "//ul/@data-eid"); + pii = eid.slice(7); + if (!/^S(\d{15}X|\d{16})/.test(pii)){ + throw new Error('PII from Xpath failed'); + } + } + queryCrossRef(pii, doc); + } + +} + +//Search & Processing based on CrossRef.js translator +function queryCrossRef (pii, doc){ + crossRefQuery = 'http://api.crossref.org/works?query=' + pii; + //TODO: implement API version request + //acceptHeader = {'Accept': 'application/vnd.crossref-api-message+json; version=1.0'} + ZU.doGet(crossRefQuery, function(responseText) { + processCrossRefREST(responseText, doc); + }); +} + +function processCrossRefREST(jsonOutput, doc){ + var jsonParsed = JSON.parse(jsonOutput); + + if (jsonParsed['message']['total-results'] > 1) { + // Multiple results shouldn't occur as pii is unique + // handle only first returned object just in case + Zotero.debug('Returned multiple results. Continue processing first'); + } + else if (jsonParsed['message']['total-results'] == 0) { + // If the search failed to find results + Zotero.debug('Crossref API failed to find query match'); + return; + } + + if (!/^1/.test(jsonParsed['message-version'])){ + // check that the API version is compatible with this translator + // translator currently written according to v1 + Zotero.debug('Request returned wrong API version'); + } + + // shorten JSON to the single reference + var ref = jsonParsed['message']['items'][0]; + + if (ref['type'] == 'journal-article') { + // prep for CSL JSON translator + ref['type'] = 'article-journal'; + } else if (ref['type'] != 'journal-article') { + // log the unexpected + Zotero.debug('Returned unexpected reference type'); + } + + // use CSL JSON translator + var text = JSON.stringify(ref); + var trans = Zotero.loadTranslator('import'); + trans.setTranslator('bc03b4fe-436d-4a1f-ba59-de4d2d7a63f7'); + trans.setString(text); + + //Attempt to download fulltext PDF + var pdfLink = getPDFLink(doc); + + trans.setHandler('itemDone', function(obj, item) { + if (pdfLink) + item.attachments.push({ + url:pdfLink, + title:"Full Text PDF", + mimeType:"application/pdf" + }); + item.complete(); + }); + + trans.translate(); +} + +function getPDFLink(doc) { + var pdfLink = doc.getElementsByClassName('x-pdf')[0].href; + if (!pdfLink) { + pdfLink = ZU.xpathText(doc, './/*[@data-action="pdfDownload"]/@href'); + } else if (!pdfLink) { + pdfLink = ZU.xpathText(doc, './/*[@action="download"]/@href'); + } + return pdfLink; +} + +function scrapeBookSection(doc, item){ + //book title + var bookTitle = ZU.xpathText(doc, '//*[@data-once-text="XocsCtrl.title"]'); + item.bookTitle = bookTitle; + //section title + var title = ZU.xpathText(doc, '//*[@ng-bind-html="ContentCtrl.title"]'); + item.title = title; + //authors + var authorsList = ZU.xpath(doc, '//ul[@ng-bind-html="XocsCtrl.authorsHtml"]/li/a'); + for (var i = 0;i 1 +//E.g., Twenty-Second -> 22 +function textToNumber(text){ + var textarr = [ + "first", + "second", + "third", + "fourth", + "fifth", + "sixth", + "seventh", + "eighth", + "ninth", + "tenth", + "eleventh", + "twelfth", + "thirteenth", + "fourteenth", + "fifteenth", + "sixteenth", + "seventeenth", + "eighteenth", + "nineteenth", + "twentieth", + "twenty-first", + "twenty-second", + "twenty-third", + "twenty-fourth", + "twenty-fifth", + "twenty-sixth", + "twenty-seventh", + "twenty-eighth", + "twenty-ninth", + "thirtieth", + "thirty-first" + ]; + var number = textarr.indexOf(text.toLowerCase()); + //shift from 0 to 1 based indexing + return (number != -1)? number + 1 : text; +} diff --git a/translators/Code4Lib Journal.js b/translators/Code4Lib Journal.js new file mode 100644 index 0000000..a2573d4 --- /dev/null +++ b/translators/Code4Lib Journal.js @@ -0,0 +1,143 @@ +{ + "translatorID": "a326fc49-60c2-405b-8f44-607e5d18b9ad", + "label": "Code4Lib Journal", + "creator": "Michael Berkowitz", + "target": "^https?://journal\\.code4lib\\.org/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2018-08-23 11:15:21" +} + +// attr()/text() v2 +function attr(docOrElem,selector,attr,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.getAttribute(attr):null;}function text(docOrElem,selector,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.textContent:null;} + + +function detectWeb(doc, url) { + if (getSearchResults(doc, true)) { + return "multiple"; + } else if (text(doc, 'h1[class="articletitle"]')) { + return "journalArticle"; + } +} + + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('div.article>h2.articletitle>a'); + for (let i=0; i. + + ***** END LICENSE BLOCK ***** +*/ + + +function detectWeb(doc, url) { + if (url.includes('/bills/')) { + return "bill"; + } + else if (url.includes('/bill-search') && getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll(`header.search-result-single-item>h4>a[href*="/bills/"]`); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function scrape(doc) { + var item = new Zotero.Item("bill"); + + item.title = text(doc, 'h1.node-title'); + + let billNumber = text(doc, '.field-name-field-bill-number'); + + if (billNumber) { + item.billNumber = ZU.trimInternal(billNumber); + } + + let sponsors = [...doc.querySelectorAll('.sponsor-item .member h4')].reverse(); + + for (let sponsor of sponsors) { + let sponsorName = ZU.trimInternal(sponsor.textContent); + item.creators.push(ZU.cleanAuthor(sponsorName, "sponsor", false)); + } + item.legislativeBody = 'Colorado General Assembly'; + + item.session = text(doc, '.bill-session .field-items > *'); + + item.attachments.push({ title: "Snapshot", document: doc }); + + let tags = doc.querySelectorAll('.bill-subjects .field-item'); + for (let tag of tags) { + item.tags.push(tag.textContent); + } + + item.complete(); +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://leg.colorado.gov/bills/hb20-1084", + "items": [ + { + "itemType": "bill", + "title": "Requirements For Dog And Cat Breeders And Sellers", + "creators": [ + { + "firstName": "Mike", + "lastName": "Foote", + "creatorType": "sponsor" + }, + { + "firstName": "Monica", + "lastName": "Duran", + "creatorType": "sponsor" + } + ], + "billNumber": "HB20-1084", + "legislativeBody": "Colorado General Assembly", + "session": "2020 Regular Session", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "Agriculture" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://leg.colorado.gov/bill-search?search_api_views_fulltext=education%20sirota&field_chamber=All&field_bill_type=All&field_sessions=64656&sort_bef_combine=search_api_relevance%20DESC", + "items": "multiple" + }, + { + "type": "web", + "url": "https://leg.colorado.gov/bills/hjr19-1015", + "items": [ + { + "itemType": "bill", + "title": "Adjourn Sine Die", + "creators": [ + { + "firstName": "Stephen", + "lastName": "Fenberg", + "creatorType": "sponsor" + }, + { + "firstName": "Alec", + "lastName": "Garnett", + "creatorType": "sponsor" + } + ], + "billNumber": "HJR19-1015", + "legislativeBody": "Colorado General Assembly", + "session": "2019 Regular Session", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://leg.colorado.gov/bills/sb17b-001", + "items": [ + { + "itemType": "bill", + "title": "Taxation Of Retail Marijuana Sales", + "creators": [ + { + "firstName": "Lucia", + "lastName": "Guzman", + "creatorType": "sponsor" + } + ], + "billNumber": "SB17B-001", + "legislativeBody": "Colorado General Assembly", + "session": "2017 Extraordinary Session", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Columbia University Press.js b/translators/Columbia University Press.js new file mode 100644 index 0000000..c8b9c34 --- /dev/null +++ b/translators/Columbia University Press.js @@ -0,0 +1,238 @@ +{ + "translatorID": "a75e0594-a9e8-466e-9ce8-c10560ea59fd", + "label": "Columbia University Press", + "creator": "Philipp Zumstein", + "target": "^https?://(www\\.)?cup\\.columbia\\.edu/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2016-09-10 11:35:07" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2016 Philipp Zumstein + + 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) { + if (url.indexOf("/book/")>-1) { + return "book"; + } else if (getSearchResults(doc, true)) { + return "multiple"; + } +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = ZU.xpath(doc, '//div[contains(@class, "search-list")]//h2/a'); + for (var i=0; i-1 || url.indexOf("common-place-archives.org")>-1) { + return "journalArticle"; + } +} + + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = ZU.xpath(doc, '//h3[contains(@class, "article-title")]/a|//h2/a'); + for (var i=0; i-1) { + newItem.title = ZU.xpathText(doc, '//article/h1'); + var author = ZU.xpathText(doc, '//article/h1/following-sibling::p'); + if (author) { + newItem.creators.push(ZU.cleanAuthor(author, "author")); + } + newItem.abstractNote = ZU.xpathText(doc, '//article/div[contains(@class, "entry-excerpt")]'); + newItem.date = ZU.strToISO(ZU.trimInternal(ZU.xpathText(doc, '//article/ol[contains(@class, "breadcrumb")]/li/text()'))); + var volno = ZU.xpathText(doc, '//article/ol[contains(@class, "breadcrumb")]/li[1]/a'); + var m = volno.match(/Vol\. (\d+) No\. (\d+)/); + if (m) { + newItem.volume = m[1]; + newItem.issue = m[2]; + } + + } else { + //get issue year and month + //these will determine what xpaths we use for title and author + //e.g. vol. 12 · no. 1 · October 2011 + var dateRe = /([^<]*)<\/a>/; + var m = dateRe.exec(ZU.trimInternal(doc.getElementsByTagName("body")[0].innerHTML)); + if (m) { + newItem.volume = m[1]; + newItem.issue = m[2]; + var n = m[3].match(/· ([\w\s]+)$/); + if (n) { + newItem.date = ZU.strToISO(n[1]); + } + } + + var author = ZU.xpathText(doc, '//div[@id="content"]/p/span[1]'); + var title = ZU.xpathText(doc, '//div[@id="content"]/p/span[2]'); + if (author) { + //determine if we have a book review + // if so, get the publication information + if (author.indexOf("Review by") != -1 ) { + title = String.concat("Review of ", title); + author = author.substring(10); + } + newItem.creators.push(ZU.cleanAuthor(author, "author")); + } else { //we have older issue + //check if we are on a review + var review = ZU.xpathText(doc, '/html/body/table/tbody/tr/td[2]/p[2]'); + if (review.indexOf("Review") != -1) { + title = ZU.xpathText(doc, '/html/body/table/tbody/tr/td[2]/p/i'); + title = "Review of " + title; + author = review.substring(10); + } else { //for articles + title = ZU.xpathText(doc, '/html/body/table/tbody/tr/td[2]/p/b'); + author = ZU.xpathText(doc, '/html/body/table/tbody/tr/td[2]/p[1]').split(/\n/)[1];; + } + newItem.creators.push(ZU.cleanAuthor(author, "author")); + } + newItem.title = title; + } + + newItem.attachments.push({document:doc, title:doc.title}); + newItem.complete(); +} +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://www.common-place-archives.org/vol-12/no-01/tales/", + "items": [ + { + "itemType": "journalArticle", + "title": "Looking for Limbs in all the Right Places", + "creators": [ + { + "firstName": "Megan Kate", + "lastName": "Nelson", + "creatorType": "author" + } + ], + "date": "2011-10", + "issue": "01", + "libraryCatalog": "Common-Place", + "publicationTitle": "Common-Place", + "url": "http://www.common-place-archives.org/vol-12/no-01/tales/", + "volume": "12", + "attachments": [ + { + "title": "Common-place: Tales from the Vault" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.common-place-archives.org/vol-03/no-03/mccaffrey/", + "items": [ + { + "itemType": "journalArticle", + "title": "American Originals", + "creators": [ + { + "firstName": "Katherine Stebbins", + "lastName": "McCaffrey", + "creatorType": "author" + } + ], + "date": "2003-04", + "issue": "03", + "libraryCatalog": "Common-Place", + "publicationTitle": "Common-Place", + "url": "http://www.common-place-archives.org/vol-03/no-03/mccaffrey/", + "volume": "03", + "attachments": [ + { + "title": "Common-place: American Originals" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://common-place.org/book/alive-with-the-sound-of-music/", + "items": [ + { + "itemType": "journalArticle", + "title": "Alive with the Sound of Music", + "creators": [ + { + "firstName": "Douglas", + "lastName": "Shadle", + "creatorType": "author" + } + ], + "date": "2008-04", + "abstractNote": "Next to Stephen Foster, William Henry Fry was arguably the most important American composer working before the Civil War.", + "issue": "3", + "libraryCatalog": "Common-Place", + "publicationTitle": "Common-Place", + "url": "http://common-place.org/book/alive-with-the-sound-of-music/", + "volume": "08", + "attachments": [ + { + "title": "Alive with the Sound of Music - Common-placeCommon-place: The Journal of early American Life" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ \ No newline at end of file diff --git a/translators/Computer History Museum Archive.js b/translators/Computer History Museum Archive.js new file mode 100644 index 0000000..cb116ab --- /dev/null +++ b/translators/Computer History Museum Archive.js @@ -0,0 +1,1319 @@ +{ + "translatorID": "f3b81c4e-28b4-41ae-9824-55739fe9c91a", + "label": "Computer History Museum Archive", + "creator": "Bo An", + "target": "^https?://www\\.computerhistory\\.org/collections/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-06-07 16:40:38" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + Copyright © 2020-2021 Bo An + 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) { + const collection = "/collections/search/"; + const artifact = "/collections/catalog/"; + const isCollection = url.includes(collection); + const isArtifact = url.includes(artifact); + if (isCollection) { + return 'multiple'; + } + else if (isArtifact) { + return getZoteroItemType(doc); + } + return false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), (items) => { + if (!items) { + return true; + } + const articles = []; + for (const i in items) { + articles.push(i); + } + ZU.processDocuments(articles, scrape); + return true; + }); + } + else { + scrape(doc, url); + } +} + +function getSearchResults(doc, checkOnly) { + let items = {}; + let found = false; + const entries = doc.querySelectorAll('p.objtext'); + + for (let i = 0; i < entries.length; i++) { + const titleDiv = entries[i].querySelector('span.objtitle a'); + if (!titleDiv) continue; + const href = titleDiv.href; + const title = titleDiv.textContent; + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function scrape(doc, _) { + const zoteroItemType = getZoteroItemType(doc); + + let newItem = new Zotero.Item(zoteroItemType); + + const nodes = getFieldNodes(doc); + + nodes.forEach((node) => { + const fieldTitleNode = node.querySelector("h4"); + const fieldTitle = fieldTitleNode.textContent.trim(); + switch (fieldTitle) { + case 'Title': + newItem.title = getContent(node, fieldTitle); + break; + case 'Date': + newItem.date = getContent(node, fieldTitle); + break; + case 'Participants': + case 'Contributor': + newItem.creators = getContributors(node); + break; + case 'Publisher': + if (newItem.itemType == 'artwork') { + newItem.rights = getContent(node, fieldTitle); + } + else { + newItem.publisher = getContent(node, fieldTitle); + } + break; + case 'Place of Publication': + newItem.place = getContent(node, fieldTitle); + break; + case 'Extent': + newItem.numPages = getContent(node, fieldTitle).replace(' p.', ''); + break; + case 'Lot Number': + newItem.archiveLocation = getContent(node, fieldTitle); + break; + case 'Description': + newItem.abstractNote = insertToTheStartOfAbstract(getContent(node, fieldTitle), newItem.abstractNote); + break; + case 'Biographical Notes': + newItem.abstractNote = insertToTheEndOfAbstract(getContent(node, fieldTitle), newItem.abstractNote, fieldTitle); + break; + case 'Copyright Holder': + newItem.rights = getContent(node, fieldTitle); + break; + case 'Subject': + const allTagsString = getContent(node, fieldTitle); + const allTags = allTagsString.split(';').map(tag => tag.trim()).sort(); + if (allTags && allTags.length > 0) { + newItem.tags = allTags; + } + break; + // other archival and / or meta info that go into extra. + case 'Format': + if (newItem.itemType == 'videoRecording') { + // note that format field for Video Recording type is not displayed in scaffold. + newItem.videoRecordingFormat = getContent(node, fieldTitle); + break; + } + if (newItem.itemType == 'audioRecording') { + newItem.audioRecordingFormat = getContent(node, fieldTitle); + break; + } + if (newItem.itemType == 'artwork') { + newItem.medium = getContent(node, fieldTitle); + break; + } + case 'Dimensions': + if (newItem.itemType == 'artwork') { + newItem.artworkSize = getContent(node, fieldTitle); + break; + } + case 'Duration': + if (newItem.itemType == 'videoRecording' || newItem.itemType == 'audioRecording') { + // note that format field for Video Recording type is not displayed in scaffold. + newItem.runningTime = getContent(node, fieldTitle); + break; + } + // notes that if there are conditional logics for a field, like "dimensions", they need to come above. Therewise, they might be polluted by stacked switch cases, like "Categories" got mixed with "Dimensions". + case 'Category': + case 'Collection Title': + case 'Credit': + case 'Place Manufactured': + case 'Manufacturer': + case 'System Requirements': + case 'Series Title': + case 'Platform': + // the categories vary therefore many are collapsed under 'extra'. + case 'Catalog Number': + newItem.extra = addToExtra(newItem.extra, getContent(node, fieldTitle), fieldTitle); + break; + // parsing identifying numbers with existing Zotero fields e.g. ISBN + case 'Identifying Numbers': + node.querySelectorAll('tr').forEach((div) => { + const numberKey = div.querySelector('td.col1').textContent; + const numberVal = div.querySelector('td.col2').textContent; + switch (numberKey) { + case 'ISBN10': + newItem.ISBN = numberVal; + break; + case 'Other number': + break; + default: + newItem.extra = addToExtra(newItem.extra, numberVal, numberKey); + break; + } + }); + } + }); + + // add pdf documents + const pdfDiv = doc.querySelectorAll('div.mediaDocument li a'); + if (pdfDiv) { + pdfDiv.forEach((div) => { + const fileName = div.textContent; + const pdfPath = div.href; + if (pdfPath) { + newItem.attachments.push({ + url: pdfPath, + mimeType: "application/pdf", + title: `${fileName ? fileName : newItem.title}`, + }); + } + }); + } + + // add audio recordings + const audioDiv = doc.querySelectorAll('div.mediaAudio li a'); + if (audioDiv) { + audioDiv.forEach((div) => { + const audioPath = div.href; + const fileName = div.textContent; + if (audioPath) { + newItem.attachments.push({ + url: audioPath, + mimeType: "audio/mpeg", + title: `${fileName ? fileName : newItem.title}` + }); + } + }); + } + + // add object images + const imageDiv = doc.querySelectorAll('div.mediarow a.media-large img'); + if (imageDiv) { + imageDiv.forEach((div) => { + const imagePath = div.src; + const fileName = div.textContent; + if (imagePath) { + newItem.attachments.push({ + url: imagePath, + title: `${fileName ? fileName : newItem.title}`, + mimeType: 'image/png' + }); + } + }); + } + + // add video links + const videoDivs = doc.querySelectorAll('div.mediaVideo iframe'); + if (videoDivs) { + videoDivs.forEach((div) => { + const videoPath = div.src; + const fileName = div.textContent; + if (videoPath) { + newItem.attachments.push({ + url: videoPath, + title: `${fileName ? fileName : newItem.title}`, + snapshot: false + }); + } + }); + } + + newItem.archive = 'Computer History Museum'; + + newItem.complete(); +} + +// get field nodes containing item information from html doc. +function getFieldNodes(doc) { + const fields = [...doc.querySelectorAll("div.field")]; + + // clone the node to avoid altering the document. + return fields.map(nodeOriginal => nodeOriginal.cloneNode(true)); +} + +// get the corresponding types. CHM Still Image = Zotero Artwork; CHM Moving Image = Zotero Video Recording; CHM Software = Zotero Computer Program. Other CHM types are all "books". +function getZoteroItemType(doc) { + let type = 'book'; + + const nodes = getFieldNodes(doc); + + nodes.forEach((node) => { + const fieldTitleNode = node.querySelector("h4"); + const fieldTitle = fieldTitleNode.textContent.trim(); + if (fieldTitle == 'Type') { + let chmItemType = getContent(node, fieldTitle); + + chmItemType = chmItemType.toLowerCase(); + + switch (chmItemType) { + case 'audio': + type = 'audioRecording'; + break; + case 'moving image': + type = "videoRecording"; + break; + case 'software': + type = "computerProgram"; + break; + case 'still image': + type = 'artwork'; + break; + default: + type = 'book'; + } + } + return type; + }); + + return type; +} + +// helper functions +function insertToTheStartOfAbstract(insert, abstract, fieldTitle) { + const abstractContent = (fieldTitle !== undefined ? fieldTitle + ': ' : '') + insert + '\n' + (abstract ? abstract : ''); + return abstractContent ? abstractContent : ''; +} + +function insertToTheEndOfAbstract(insert, abstract, fieldTitle) { + const abstractContent = (abstract ? abstract + '\n' : '') + (fieldTitle !== undefined ? fieldTitle + ': ' : '') + insert; + return abstractContent ? abstractContent : ''; +} + +function getContent(node, fieldTitle) { + const content = node.textContent.replace(fieldTitle, '').trim(); + return content ? content : ''; +} +function addToExtra(oldExtra, newContent, fieldTitle) { + return (oldExtra ? oldExtra + '\n' : '') + fieldTitle + ': ' + newContent.replace(/ {2}/g, '').replace(/\n\n/g, '').replace('\n', ': '); +} + +function getContributors(node) { + let contributors = []; + const people = node.querySelectorAll('td'); + people.forEach((personDiv) => { + const spans = personDiv.querySelectorAll('span'); + const name = spans[0].textContent; + const [lastName, firstName] = name.split(', '); + contributors.push({ + firstName, + lastName, + creatorType: "contributor" + }); + }); + return contributors; +} + + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102658053", + "items": [ + { + "itemType": "book", + "title": "Knuth, Donald oral history", + "creators": [ + { + "firstName": "Edward", + "lastName": "Feigenbaum", + "creatorType": "contributor" + }, + { + "firstName": "Donald E.", + "lastName": "Knuth", + "creatorType": "contributor" + }, + { + "firstName": "Yan", + "lastName": "Rosenshteyn", + "creatorType": "contributor" + } + ], + "date": "2007-03-14; 2007-03-21", + "abstractNote": "In this wide-ranging interview conducted by Edward Feigenbaum, Donald Knuth talks about the progression of his life and career. Topics include his family background and early interest in music, physics and mathematics, his first exposure to programming, finding a mentor, and writing a doctoral thesis. He describes how \"The Art of Computer Programming\" became \"the story of my life\", and why it was put on hold for the TeX and METAFONT projects. He also talks about personal work habits, programming style, analysis of algorithms, the influence of religion in his life, and his advice to the next generation of scientists.", + "archive": "Computer History Museum", + "archiveLocation": "X3926.2007", + "extra": "Catalog Number: 102658053\nCategory: Transcription\nCollection Title: Oral history collection", + "libraryCatalog": "Computer History Museum Archive", + "numPages": "73", + "place": "Mountain View, California", + "publisher": "Computer History Museum", + "attachments": [ + { + "mimeType": "application/pdf", + "title": "102658053-05-01-acc.pdf" + } + ], + "tags": [ + { + "tag": "Analysis of algorithms" + }, + { + "tag": "Combinatorial analysis--Data processing" + }, + { + "tag": "Combinatorics" + }, + { + "tag": "Fellow Award Honoree" + }, + { + "tag": "IBM 650 (Computer)" + }, + { + "tag": "Knuth, Donald" + }, + { + "tag": "Literate programming" + }, + { + "tag": "METAFONT" + }, + { + "tag": "Religion" + }, + { + "tag": "Stanford University" + }, + { + "tag": "TeX" + }, + { + "tag": "The Art of Computer Programming" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102646282", + "items": [ + { + "itemType": "book", + "title": "IBM 1401 Programming Systems", + "creators": [], + "date": "1959", + "abstractNote": "The brochure explains the IBM 1401 programming languages and their application to the 1401 data processing system. The brochure is printed in black, white, and blue. The front cover shows the words Programming and Systems in a repetitive design with the name Donald G. McBrien stamped in the upper right corner. The back cover shows the company logo on a blue background. Throughout the inside pages are black and white photographs of the computer and images of reports generated by the system. Text contents include: What is a 1401 program?; What is a stored program machine?; What are 1401 programming systems?; What 1401 programming systems mean to management?; IBM programming systems; Here's how one of the 1401 programming systems -- Report Program Generator -- works to increase programming efficiency; New IBM services include:; Other services available to every IBM customer.", + "archive": "Computer History Museum", + "archiveLocation": "X3067.2005", + "extra": "Catalog Number: 102646282\nDimensions: 9 5/8 x 7 6/8 in.\nCategory: Promotional Material", + "libraryCatalog": "Computer History Museum Archive", + "numPages": "6", + "place": "U.S.", + "publisher": "International Business Machines Corporation. Data Processing Division. (IBM)", + "rights": "International Business Machines Corporation (IBM). Data Processing Division", + "attachments": [ + { + "mimeType": "application/pdf", + "title": "IBM.1401.1959.102646282.pdf" + }, + { + "title": "IBM 1401 Programming Systems", + "mimeType": "image/png" + } + ], + "tags": [ + { + "tag": "1401 data processing system (Computer)" + }, + { + "tag": "1401 programming systems (Software)" + }, + { + "tag": "Business applications" + }, + { + "tag": "COBOL (Software)" + }, + { + "tag": "Digital communications--Social aspects" + }, + { + "tag": "Digital computer: mainframe" + }, + { + "tag": "International Business Machines Corporation (IBM). Data Processing Division" + }, + { + "tag": "Scientific applications" + }, + { + "tag": "Software" + }, + { + "tag": "promotional materials" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102623002", + "items": [ + { + "itemType": "book", + "title": "A guide to Fortran IV programming", + "creators": [], + "date": "1972", + "ISBN": "9780471582816", + "abstractNote": "Second edition. Signed by McCracken on title page.", + "archive": "Computer History Museum", + "archiveLocation": "X3682.2007", + "extra": "Catalog Number: 102623002\nLCCN: 72-4745\nLOC call num: QA76.73.F25 M3 1972\nDimensions: 28 cm.\nCategory: Book", + "libraryCatalog": "Computer History Museum Archive", + "numPages": "288", + "place": "New York", + "publisher": "John Wiley & Sons", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102790985", + "items": [ + { + "itemType": "book", + "title": "Logic Programming Workshop '83 poster", + "creators": [], + "date": "1983", + "abstractNote": "PDF scan of the poster for the Logic Programming Workshop '83 in Algarve Portugal, June 26 - July 1, 1983.", + "archive": "Computer History Museum", + "archiveLocation": "X9292.2020", + "extra": "Catalog Number: 102790985\nCategory: Promotional Material", + "libraryCatalog": "Computer History Museum Archive", + "numPages": "1; 0.0004 GB", + "attachments": [ + { + "mimeType": "application/pdf", + "title": "LPW_Albufeira_1983_poster.pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102620354", + "items": [ + { + "itemType": "book", + "title": "LP20 Linear Programming System", + "creators": [], + "archive": "Computer History Museum", + "archiveLocation": "X4248.2008", + "extra": "Catalog Number: 102620354\nProgram ID number: 10.1.009\nCategory: Manual\nCollection Title: 1620 Restoration Project Collection\nCredit: Gift of John Maniotes", + "libraryCatalog": "Computer History Museum Archive", + "publisher": "International Business Machines Corporation (IBM)", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102765924", + "items": [ + { + "itemType": "book", + "title": "Jacquard programming cards", + "creators": [], + "abstractNote": "The object is a series of cardboard punch cards connected by string. The cards are hand numbered sequentially from 6 to 44.", + "archive": "Computer History Museum", + "archiveLocation": "X8070.2017", + "extra": "Catalog Number: 102765924\nDimensions: folded for storage: 2 1/2 in x 9 1/4 in x 5 in; unfolded: 1/8 in x 9 1/4 in x 97 1/2 in\nCategory: I/O/punched card device\nCredit: Gift of the Museum of American Heritage", + "libraryCatalog": "Computer History Museum Archive", + "attachments": [ + { + "title": "Jacquard programming cards", + "mimeType": "image/png" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102701957", + "items": [ + { + "itemType": "book", + "title": "Bizmac programming manual binder", + "creators": [], + "date": "1956", + "archive": "Computer History Museum", + "archiveLocation": "X5121.2009", + "extra": "Catalog Number: 102701957\nManufacturer: RCA Corporation\nDimensions: overall: 2 in x 10 in x 11 1/2 in\nCategory: Ephemera/other", + "libraryCatalog": "Computer History Museum Archive", + "attachments": [ + { + "title": "Bizmac programming manual binder", + "mimeType": "image/png" + }, + { + "title": "Bizmac programming manual binder", + "mimeType": "image/png" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102738167", + "items": [ + { + "itemType": "book", + "title": "Abe, Takao oral history", + "creators": [ + { + "firstName": "Takao", + "lastName": "Abe", + "creatorType": "contributor" + }, + { + "firstName": "Doug", + "lastName": "Fairbairn", + "creatorType": "contributor" + } + ], + "date": "2016-06-20", + "abstractNote": "Mr. Abe was born in 1936 in Otaru, on Hokkaido, the northern island of Japan. He attended Hokkaido University, majoring in physics. He was recruited by a previous graduate of the same university to come to Tokyo and work for Shin-Etsu Handotai. The year was 1964. Abe requested a job in basic research, but the company needed help in growing crystalline silicon for use in semiconductors. \n\nAbe was given the job to improve the quality of the silicon ingots. He traveled to Bell Labs and to Siemens, as Siemens was the source of their crystal growing equipment. During the interview, Abe describes the ups and downs of the industry and his substantial contributions to the quality of silicon wafers.", + "archive": "Computer History Museum", + "archiveLocation": "X7645.2016", + "extra": "Catalog Number: 102738167\nFormat: PDF\nCategory: Transcription\nCollection Title: CHM oral history collection\nCredit: Computer History Museum", + "libraryCatalog": "Computer History Museum Archive", + "numPages": "24", + "place": "Tokyo, Japan", + "publisher": "Computer History Museum", + "attachments": [ + { + "mimeType": "application/pdf", + "title": "Transcript of Takeo Abe's oral history" + } + ], + "tags": [ + { + "tag": "Dash-necking" + }, + { + "tag": "Hokkaido University" + }, + { + "tag": "SIMOX" + }, + { + "tag": "SOI" + }, + { + "tag": "Silicon on Insulator" + }, + { + "tag": "Voronkov" + }, + { + "tag": "silicon wafers" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102746874", + "items": [ + { + "itemType": "book", + "title": "Xbox oral history panel", + "creators": [ + { + "firstName": "Nicholas", + "lastName": "Baker", + "creatorType": "contributor" + }, + { + "firstName": "Eric", + "lastName": "Dennis", + "creatorType": "contributor" + }, + { + "firstName": "Todd", + "lastName": "Holmdahl", + "creatorType": "contributor" + }, + { + "firstName": "Albert J.", + "lastName": "Penello", + "creatorType": "contributor" + }, + { + "firstName": "Dag", + "lastName": "Spicer", + "creatorType": "contributor" + } + ], + "date": "2014-03-25", + "abstractNote": "Three key members of the original Microsoft Xbox team come together in this oral history to discuss the early development of Xbox and Xbox 360, two of the most significant game consoles in computer history. Architect Nick Baker, head of hardware Todd Holmdahl, and marketing lead Albert Penello cover the early development years of the original Xbox and their attempt to gain a foothold in the highly competitive game console market. They then continue with the history of the Xbox 360 console, the successor to the original, and the changing nature of the video game business during that period that allowed for innovations such as live, interconnected play over a network and the Kinect input capture device. Strategic, technical, and marketing aspects of this history are discussed, as are visions for the future of gaming.", + "archive": "Computer History Museum", + "archiveLocation": "X7120.2014", + "extra": "Catalog Number: 102746874\nCategory: Transcription\nCollection Title: Oral history collection\nCredit: Computer History Museum", + "libraryCatalog": "Computer History Museum Archive", + "numPages": "27", + "place": "Mountain View, California", + "publisher": "Computer History Museum", + "rights": "Computer History Museum", + "attachments": [ + { + "mimeType": "application/pdf", + "title": "102746874-05-01-acc.pdf" + } + ], + "tags": [ + { + "tag": "ATI Technologies Inc." + }, + { + "tag": "Allard, J" + }, + { + "tag": "Bach, Robbie" + }, + { + "tag": "Central Processing Unit (CPU)" + }, + { + "tag": "Flextronics" + }, + { + "tag": "Graphics Processing Unit (GPU)" + }, + { + "tag": "Halo" + }, + { + "tag": "International Business Machines Corporation (IBM)" + }, + { + "tag": "Kinect" + }, + { + "tag": "Media Center PC (personal computer)" + }, + { + "tag": "Microsoft Corporation" + }, + { + "tag": "Nvidia Corporation" + }, + { + "tag": "Performance Optimization With Enhanced RISC--Performance Computing (PowerPC)" + }, + { + "tag": "Playstation" + }, + { + "tag": "Sony Corporation" + }, + { + "tag": "Windows" + }, + { + "tag": "Wistron" + }, + { + "tag": "Xbox" + }, + { + "tag": "Xbox 360" + }, + { + "tag": "Xbox One" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/search/?s=oral+history&page=4", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102738261", + "items": [ + { + "itemType": "videoRecording", + "title": "Su, Stephen oral history", + "creators": [ + { + "firstName": "Douglas", + "lastName": "Fairbairn", + "creatorType": "contributor" + }, + { + "firstName": "Stephen", + "lastName": "Su", + "creatorType": "contributor" + } + ], + "date": "2017-04-19", + "abstractNote": "Stephen Su grew up on Taiwan, but in 1980 he came to the US to attend high school and college, including studying semiconductors at Caltech. He worked for Motorola for a period of time before returning to school in 1992 to get an MBA from Kellog. Upon graduation, he joined Boston Consulting Group and went to Hong Kong on a consulting assignment. \nIn 1998, Stephen returned to Taiwan, working for Primax. While there he spent several years managing the Mobile Accessories group, responsible for developing accessories for mobile phone makers like Nokia and Apple. In particular, he was responsible for developing the camera module for several generations of Apple’s iPhone. He tells many interesting stories about working with Apple on this very important program. \nIn 2009, he was recruited to join ITRI, where he is involved with helping steer Taiwan into lucrative new markets through careful investments in promising new technologies.", + "archive": "Computer History Museum", + "archiveLocation": "X8201.2017", + "extra": "Catalog Number: 102738261\nCategory: Oral history\nCredit: Computer History Museum", + "libraryCatalog": "Computer History Museum Archive", + "place": "Mountain View, CA", + "studio": "Computer History Museum", + "videoRecordingFormat": "MOV", + "attachments": [ + { + "title": "Su, Stephen oral history", + "snapshot": false + } + ], + "tags": [ + { + "tag": "Apple" + }, + { + "tag": "Camera" + }, + { + "tag": "ITRI" + }, + { + "tag": "iPhone" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/search/?s=oral+history&page=5", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102796519", + "items": [ + { + "itemType": "computerProgram", + "title": "TRS-80 word processing applications", + "creators": [], + "date": "1984", + "abstractNote": "One 5 1/4 floppy disk. Label: Single-sided, double-density disk for TRS-80 Word Processing Applications for Profile III Plus for the TRS-80 Model III or Model 4 with 48K memory. ISBN: 0-8359-7881-8.", + "archive": "Computer History Museum", + "archiveLocation": "X4114.2007", + "company": "Reston Publishing Company", + "extra": "Catalog Number: 102796519\nSystem Requirements: TRS-80 Model III or Model 4 with 48K memory\nFormat: 5 1/4 inch floppy disk\nCollection Title: Radio Shack collection\nSeries Title: Software", + "libraryCatalog": "Computer History Museum Archive", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102740039", + "items": [ + { + "itemType": "videoRecording", + "title": "Kramlich, Dick (C. Richard) oral history part 1 of 4", + "creators": [ + { + "firstName": "David C.", + "lastName": "Brock", + "creatorType": "contributor" + }, + { + "firstName": "James", + "lastName": "Fortier", + "creatorType": "contributor" + }, + { + "firstName": "C. Richard", + "lastName": "Kramlich", + "creatorType": "contributor" + } + ], + "date": "2015-03-31", + "abstractNote": "C. Richard Kramlich co-founded the venture capital firm New Enterprise Associates (NEA) in 1978, serving as its managing general partner for two decades. In this oral history, Kramlich discusses his education at the Harvard Business School, his early career in finance, and his entry into venture capital in a partnership with Arthur Rock starting in 1969. He details the establishment of NEA with his co-founders, his personal investment in Apple Computer, and one of NEA’s earliest investments, 3Com. After noting the rise of the graphical in computing, Kramlich discusses at length his investment and involvement with the Apple Computer spinoff, Forethought Inc., its history, and its development of PowerPoint. The interview concludes with some of his thoughts about his investment in Silicon Graphics, the software industry, NEA’s approach, and collecting video art.", + "archive": "Computer History Museum", + "archiveLocation": "X7447.2015", + "extra": "Catalog Number: 102740039\nCategory: Oral history\nCollection Title: CHM Oral History Collection\nCredit: Computer History Museum", + "libraryCatalog": "Computer History Museum Archive", + "place": "Mountain View, California", + "rights": "Computer History Museum", + "runningTime": "01:31:00", + "studio": "Computer History Museum", + "videoRecordingFormat": "MOV", + "attachments": [ + { + "title": "Kramlich, Dick (C. Richard) oral history part 1 of 4", + "snapshot": false + } + ], + "tags": [ + { + "tag": "3Com" + }, + { + "tag": "Apple" + }, + { + "tag": "Forethought, Inc." + }, + { + "tag": "Graphics" + }, + { + "tag": "Kramlich, C. Richard" + }, + { + "tag": "Networking" + }, + { + "tag": "New Enterprise Associates (NEA)" + }, + { + "tag": "PowerPoint" + }, + { + "tag": "Rock, Arthur" + }, + { + "tag": "Silicon Graphics" + }, + { + "tag": "Software" + }, + { + "tag": "Venture Capital" + }, + { + "tag": "Video Art" + }, + { + "tag": "personal computers (PCs)" + }, + { + "tag": "software industry" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102645840", + "items": [ + { + "itemType": "videoRecording", + "title": "Challenges and Directions in Fault-Tolerant Computing, lecture by Jack Goldberg", + "creators": [ + { + "firstName": "Jack", + "lastName": "Goldberg", + "creatorType": "contributor" + } + ], + "date": "1985-10-02", + "abstractNote": "Label taped to the video case reads: \"Two decaes of theoritical and experimental work and numerous recent successful applications have established fault tolerance as a standard objective of high speed, satisfaction of fault tolerance requirements cannot be demonstrated by testing alone, but requires formal analysis. Most of the work in fault tolerance has been concerned with developing effective design techniques. Recent work on reliabilitymodeling and formal proof of fault tolerant design and implementation is laying a foundation for a more rigorous design discipline. The scope of concern has also expanded to include any source of computer reliability, such as design mistakes, in software, hardware, or at any system level. Current art is barely able to keep up with the rapid pace of computer technology, the stresses of new applications and the new expansion in scope of concerns. Particular challenges lie in coping with the imperfections of the ultrasamll, i.e., high density VLSI, and the ultra-large, i.e., large software systems. It is clear that fault tolerance cannot be \"added\" to a design and must be integrated with other design objectives. Simultaneous demands in future systems for high performance, high security, high evolvability and high fault tolerance will require new theoretical models of computer systems and a much closer integration of practical design techniques. The talk will discuss the widening scope of research into computer dependability. New issues include tolerance of design errors (including software), operator errors, and the safety of computer-controlled systems.\"", + "archive": "Computer History Museum", + "extra": "Catalog Number: 102645840\nPlatform: NTSC VHS VCR\nCategory: Lecture\nSeries Title: Stanford Computer Forum Distinguished Lecture Series", + "libraryCatalog": "Computer History Museum Archive", + "place": "Palo Alto, CA, US", + "studio": "Stanford University. Stanford Computer Forum", + "videoRecordingFormat": "VHS", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102706809", + "items": [ + { + "itemType": "audioRecording", + "title": "Tutorials on software systems design", + "creators": [], + "date": "1977-04", + "abstractNote": "The West Coast Computer Faire was an annual computer industry conference and exposition. The first fair was held in 1977 and was organized by Jim Warren and Bob Relling. At the time, it was the biggest computer show in the world, intended to popularize the peronal computer in the home.\n\nThis first fair took place on April 16-17, 1977, in San Francisco Civic Auditorium and Brooks Hall, and saw the debut of the Commodre PET, presented by Chuck Peddle, and the Apple II, presented by then 21-year-old Steve Jobs and Steve Wozniak. There were about 180 exhibitors, among them Intel, MITS, and Digitial Research. More than 12,000 people visited the fair.\n\nPapers presented during this session:\n\nR. W. Ulrickson, \"Learning to program microcomputers? Here's how\"\nLarry Tesler, \"Home text editing\"\n\nBiographical Notes: Robert Wayne Ulrickson received a B.S.E.E. from MIT (1959) and M.S.E.E. from SJSC (1966). He was commissioned and served as a Coast Guard officer before working for Lockheed Missiles and Space in Sunnyvale, California, where he designed PCM telemetry systems for satellites. He joined John Hulme’s Applications Department at Fairchild as supervisor of Systems Engineering where his team defined the 9300 series TTL MSI devices. Systems Engineering became a part of Robert Schreiner’s Custom Micromatrix Arrays Department at Fairchild R&D in 1968, where Bob was Section Manager in charge of array architecture, test engineering, and computer aided design. After CMA’s reorganization, Bob served Fairchild as Manager of Systems and Applications Engineering and as Product Marketing manager for Bipolar ICs. In 1973 Bob joined John Nichols as co-founder and President of Logical Services Incorporated in Santa Clara. Logical developed hundreds of new products incorporating microprocessors until and after it was acquired by Smartflex Systems in 1998. Bob retired to Maui in 2000.", + "archive": "Computer History Museum", + "archiveLocation": "X2595.2004", + "audioRecordingFormat": "Standard audio cassette", + "extra": "Catalog Number: 102706809\nSeries Title: The First West Coast Computer Faire\nCredit: Gift of Jim Warren", + "label": "Butterfly Media Dimensions", + "libraryCatalog": "Computer History Museum Archive", + "place": "San Francisco, CA", + "attachments": [ + { + "mimeType": "audio/mpeg", + "title": "Tutorials on software systems design - Side B" + }, + { + "mimeType": "audio/mpeg", + "title": "Tutorials on software systems design - Side A" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102661095", + "items": [ + { + "itemType": "book", + "title": "People's Computer Company; People's Computers; Recreational Computing", + "creators": [], + "date": "1972-1981", + "abstractNote": "Founded in Oct 1972 as a large-format bimonthly newsprint publication called \"People's Computer Company.\" Name changed to \"People's Computers\" beginning with the May-June 1977 issue and the format changed to a more conventional magazine style, albeit with uncoated paper. Name changed again to \"Recreational Computing\" with Jan-Feb 1979 issue with slicker covers and paper. \n\nNote: The print collection has been augmented with scans provided by Bob Zeidman under lot number X6691.2013. Some issues in the collection exist in digital form only.", + "archive": "Computer History Museum", + "archiveLocation": "X2595.2004", + "extra": "Catalog Number: 102661095\nCategory: Periodical\nCredit: Gift of Jim Warren", + "libraryCatalog": "Computer History Museum Archive", + "publisher": "People's Computer Company", + "attachments": [ + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 1, no. 1 (Oct 1972)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 1, no. 2 (Dec 1972)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 1, no. 3 (Feb 1973)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 1, no. 4 (Apr 1973)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 1, no. 5 (May 1973)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 2, no. 1 (Sep 1973)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 2, no. 2 (Nov 1973)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 2, no. 3 (Jan 1974)" + }, + { + "mimeType": "application/pdf", + "title": "PCC (People's Computer Company) Games (1974)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 2, no. 4 (Mar 1974)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 2, no. 5 (May 1974)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 2, no. 6 (Jul 1974)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 3, no. 1 (Sep 1974)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 3, no. 2 (1974)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 3, no. 3 (Jan 1975)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 3, no. 4 (Mar 1975)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 3, no. 5 (May 1975)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 4, no. 1 (Jul 1975)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 4, no. 2 (Sep 1975)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 4, no. 3 (Nov 1975)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 4, no. 4 (Jan 1976)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 4, no. 5 (Mar-Apr 1976)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 4, no. 6 (May 1976)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 5, no. 1 (Jul 1976)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 5, no. 2 (Aug-Sep 1976)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 5, no. 3 (Nov-Dec 1976)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 5, no. 4 (Jan-Feb 1977)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computer Company, v. 5, no. 5 (Mar-Apr 1977)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computers, v. 5, no. 6 (May-Jun 1977)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computers, v. 6, no. 1 (Jul-Aug 1977)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computers, v. 6, no. 2 (Sep-Oct 1977)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computers, v. 6, no. 3 (Nov-Dec 1977)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computers, v. 6, no. 4 (Jan-Feb 1978)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computers, v. 6, no. 5 (Mar-Apr 1978)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computers, v. 6, no. 6 (May-Jun 1978)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computers, v. 7, no. 1 (Jul-Aug 1978)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computers, v. 7, no. 2 (Sep-Oct 1978)" + }, + { + "mimeType": "application/pdf", + "title": "People's Computers, v. 7, no. 3 (Nov-Dec 1978)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 7, no. 4 (Jan-Feb 1979)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 7, no. 5 (Mar-Apr 1979)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 7, no. 6 (May-Jun 1979)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 8, no. 1 (Jul-Aug 1979)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 8, no. 2 (Sep-Oct 1979)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 8, no. 3 (Nov-Dec 1979)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 8, no. 4 (Jan-Feb 1980)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 8, no. 5 (Mar-Apr 1980)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 8, no. 6 (May-Jun 1980)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 9, no. 1 (Jul-Aug 1980)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 9, no. 2 (Sep-Oct 1980)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 9, no. 3 (Nov-Dec 1980)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 9, no. 4 (Jan-Feb 1981)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 9, no. 5 (Mar-Apr 1981)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 9, no. 6 (May-June 1981)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 10, no. 1 (Jul-Aug 1981)" + }, + { + "mimeType": "application/pdf", + "title": "Recreational Computing, v. 10, no. 2 (Sep-Oct 1981)" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.computerhistory.org/collections/catalog/102630889", + "items": [ + { + "itemType": "artwork", + "title": "Apple IIe", + "creators": [], + "abstractNote": "Black and white identification photograph of the Apple IIe main terminal including monitor, disk drive and keyboard. appriximately 1/2 inch white border surrounds main image. Background is gray. Computer is sitting on a ledge.", + "archive": "Computer History Museum", + "archiveLocation": "X2870.2005", + "artworkMedium": "Photographic print", + "artworkSize": "8 x 10 in.", + "extra": "Catalog Number: 102630889\nCategory: Identification photograph; Publicity photograph\nCredit: Gift of CHM AppleLore", + "libraryCatalog": "Computer History Museum Archive", + "rights": "Apple Computer, Inc.", + "attachments": [ + { + "title": "Apple IIe", + "mimeType": "image/png" + } + ], + "tags": [ + { + "tag": "Apple Computer, Inc." + }, + { + "tag": "Apple IIe (Computer)" + } + ], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Copernicus.js b/translators/Copernicus.js new file mode 100644 index 0000000..54b2f17 --- /dev/null +++ b/translators/Copernicus.js @@ -0,0 +1,461 @@ +{ + "translatorID": "8082115d-5bc6-4517-a4e8-abed1b2a784a", + "label": "Copernicus", + "creator": "Abe Jellinek", + "target": "^https?://[^./]+\\.copernicus\\.org/", + "minVersion": "2.1", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-01-25 15:59:41" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2022 Abe Jellinek + + 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) { + if (url.includes('/articles/') + && (url.endsWith('.pdf') || attr('meta[name="citation_title"]', 'content'))) { + return 'journalArticle'; + } + else if (getSearchResults(doc, true)) { + return 'multiple'; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('a.article-title'); + for (let row of rows) { + let href = row.href; + 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) { + await Promise.all( + Object.keys(items) + .map(url => requestDocument(url).then(scrape)) + ); + } + } + else if (url.endsWith('.pdf')) { + await scrape(await requestDocument(url.replace('.pdf', '.html'))); + } + 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.title = item.title.replace(/''/g, '"'); + if (item.abstractNote) { + item.abstractNote = ZU.cleanTags(item.abstractNote).replace(/^Abstract\./, ''); + } + if (item.date) { + item.date = ZU.strToISO(item.date); + } + item.libraryCatalog = 'Copernicus Online Journals'; + item.complete(); + }); + + let em = await translator.getTranslatorObject(); + em.itemType = 'journalArticle'; + await em.doWeb(doc, url); +} + + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://adgeo.copernicus.org/articles/30/1/2011/adgeo-30-1-2011.html", + "items": [ + { + "itemType": "journalArticle", + "title": "Preface \"Precipitation: Measurement, Climatology, Remote Sensing, and Modeling (EGU 2010)\"", + "creators": [ + { + "firstName": "S.", + "lastName": "Michaelides", + "creatorType": "author" + }, + { + "firstName": "S.", + "lastName": "Athanasatos", + "creatorType": "author" + } + ], + "date": "2011-05-09", + "DOI": "10.5194/adgeo-30-1-2011", + "ISSN": "1680-7340", + "language": "English", + "libraryCatalog": "Copernicus Online Journals", + "pages": "1-2", + "publicationTitle": "Advances in Geosciences", + "shortTitle": "Preface \"Precipitation", + "url": "https://adgeo.copernicus.org/articles/30/1/2011/adgeo-30-1-2011.html", + "volume": "30", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://ars.copernicus.org/articles/6/1/2008/ars-6-1-2008.html", + "items": [ + { + "itemType": "journalArticle", + "title": "Time domain reflectrometry measurements using a movable obstacle for the determination of dielectric profiles", + "creators": [ + { + "firstName": "B.", + "lastName": "Will", + "creatorType": "author" + }, + { + "firstName": "M.", + "lastName": "Gerding", + "creatorType": "author" + }, + { + "firstName": "S.", + "lastName": "Schultz", + "creatorType": "author" + }, + { + "firstName": "B.", + "lastName": "Schiek", + "creatorType": "author" + } + ], + "date": "2008-05-26", + "DOI": "10.5194/ars-6-1-2008", + "ISSN": "1684-9965", + "abstractNote": "Microwave techniques for the measurement of the permittivity of soils including the water content of soils and other materials, especially TDR (time domain reflectometry), have become accepted as routine measurement techniques. This summary deals with an advanced use of the TDR principle for the determination of the water content of soil along a probe. The basis of the advanced TDR technique is a waveguide, which is inserted into the soil for obtaining measurements of the effective soil permittivity, from which the water content is estimated, and an obstacle, which can mechanically be moved along the probe and which acts as a reference reflection for the TDR system with an exactly known position. Based on the known mechanical position of the reference reflection, the measured electrical position can be used as a measure for the effective dielectric constant of the environment. Thus, it is possible to determine the effective dielectric constant with a spatial resolution given by the step size of the obstacle displacement. \n\n A conventional industrial TDR-system, operating in the baseband, is used for the signal generation and for the evaluation of the pulse delay time of the obstacle reflection. Thus, a cost effective method for the acquisition of the dielectric measurement data is available.", + "issue": "A.1", + "language": "English", + "libraryCatalog": "Copernicus Online Journals", + "pages": "1-4", + "publicationTitle": "Advances in Radio Science", + "url": "https://ars.copernicus.org/articles/6/1/2008/ars-6-1-2008.html", + "volume": "6", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://acp.copernicus.org/articles/14/4349/2014/acp-14-4349-2014-metrics.html", + "items": [ + { + "itemType": "journalArticle", + "title": "TransCom N2O model inter-comparison – Part 1: Assessing the influence of transport and surface fluxes on tropospheric N2O variability", + "creators": [ + { + "firstName": "R. L.", + "lastName": "Thompson", + "creatorType": "author" + }, + { + "firstName": "P. K.", + "lastName": "Patra", + "creatorType": "author" + }, + { + "firstName": "K.", + "lastName": "Ishijima", + "creatorType": "author" + }, + { + "firstName": "E.", + "lastName": "Saikawa", + "creatorType": "author" + }, + { + "firstName": "M.", + "lastName": "Corazza", + "creatorType": "author" + }, + { + "firstName": "U.", + "lastName": "Karstens", + "creatorType": "author" + }, + { + "firstName": "C.", + "lastName": "Wilson", + "creatorType": "author" + }, + { + "firstName": "P.", + "lastName": "Bergamaschi", + "creatorType": "author" + }, + { + "firstName": "E.", + "lastName": "Dlugokencky", + "creatorType": "author" + }, + { + "firstName": "C.", + "lastName": "Sweeney", + "creatorType": "author" + }, + { + "firstName": "R. G.", + "lastName": "Prinn", + "creatorType": "author" + }, + { + "firstName": "R. F.", + "lastName": "Weiss", + "creatorType": "author" + }, + { + "firstName": "S.", + "lastName": "O'Doherty", + "creatorType": "author" + }, + { + "firstName": "P. J.", + "lastName": "Fraser", + "creatorType": "author" + }, + { + "firstName": "L. P.", + "lastName": "Steele", + "creatorType": "author" + }, + { + "firstName": "P. B.", + "lastName": "Krummel", + "creatorType": "author" + }, + { + "firstName": "M.", + "lastName": "Saunois", + "creatorType": "author" + }, + { + "firstName": "M.", + "lastName": "Chipperfield", + "creatorType": "author" + }, + { + "firstName": "P.", + "lastName": "Bousquet", + "creatorType": "author" + } + ], + "date": "2014-04-30", + "DOI": "10.5194/acp-14-4349-2014", + "ISSN": "1680-7316", + "abstractNote": "We present a comparison of chemistry-transport models (TransCom-N2O) to examine the importance of atmospheric transport and surface fluxes on the variability of N2O mixing ratios in the troposphere. Six different models and two model variants participated in the inter-comparison and simulations were made for the period 2006 to 2009. In addition to N2O, simulations of CFC-12 and SF6 were made by a subset of four of the models to provide information on the models' proficiency in stratosphere–troposphere exchange (STE) and meridional transport, respectively. The same prior emissions were used by all models to restrict differences among models to transport and chemistry alone. Four different N2O flux scenarios totalling between 14 and 17 TgN yr−1 (for 2005) globally were also compared. The modelled N2O mixing ratios were assessed against observations from in situ stations, discrete air sampling networks and aircraft. All models adequately captured the large-scale patterns of N2O and the vertical gradient from the troposphere to the stratosphere and most models also adequately captured the N2O tropospheric growth rate. However, all models underestimated the inter-hemispheric N2O gradient by at least 0.33 parts per billion (ppb), equivalent to 1.5 TgN, which, even after accounting for an overestimate of emissions in the Southern Ocean of circa 1.0 TgN, points to a likely underestimate of the Northern Hemisphere source by up to 0.5 TgN and/or an overestimate of STE in the Northern Hemisphere. Comparison with aircraft data reveal that the models overestimate the amplitude of the N2O seasonal cycle at Hawaii (21° N, 158° W) below circa 6000 m, suggesting an overestimate of the importance of stratosphere to troposphere transport in the lower troposphere at this latitude. In the Northern Hemisphere, most of the models that provided CFC-12 simulations captured the phase of the CFC-12, seasonal cycle, indicating a reasonable representation of the timing of STE. However, for N2O all models simulated a too early minimum by 2 to 3 months owing to errors in the seasonal cycle in the prior soil emissions, which was not adequately represented by the terrestrial biosphere model. In the Southern Hemisphere, most models failed to capture the N2O and CFC-12 seasonality at Cape Grim, Tasmania, and all failed at the South Pole, whereas for SF6, all models could capture the seasonality at all sites, suggesting that there are large errors in modelled vertical transport in high southern latitudes.", + "issue": "8", + "language": "English", + "libraryCatalog": "Copernicus Online Journals", + "pages": "4349-4368", + "publicationTitle": "Atmospheric Chemistry and Physics", + "shortTitle": "TransCom N2O model inter-comparison – Part 1", + "url": "https://acp.copernicus.org/articles/14/4349/2014/acp-14-4349-2014-metrics.html", + "volume": "14", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://acp.copernicus.org/articles/special_issue15.html", + "items": "multiple" + }, + { + "type": "web", + "url": "https://acp.copernicus.org/recent_papers.html", + "items": "multiple" + }, + { + "type": "web", + "url": "https://nhess.copernicus.org/articles/13/299/2013/", + "items": [ + { + "itemType": "journalArticle", + "title": "Technical Note: Use of remote sensing for landslide studies in Europe", + "creators": [ + { + "firstName": "V.", + "lastName": "Tofani", + "creatorType": "author" + }, + { + "firstName": "S.", + "lastName": "Segoni", + "creatorType": "author" + }, + { + "firstName": "A.", + "lastName": "Agostini", + "creatorType": "author" + }, + { + "firstName": "F.", + "lastName": "Catani", + "creatorType": "author" + }, + { + "firstName": "N.", + "lastName": "Casagli", + "creatorType": "author" + } + ], + "date": "2013-02-08", + "DOI": "10.5194/nhess-13-299-2013", + "ISSN": "1561-8633", + "abstractNote": "Within the framework of FP7, an EU-funded SafeLand project, a questionnaire was prepared to collect information about the use of remote sensing for landslide study and to evaluate its actual application in landslide detection, mapping and monitoring. The questionnaire was designed using a Google form and was disseminated among end-users and researchers involved in landslide studies in Europe. In total, 49 answers from 17 different European countries were collected. The outcomes showed that landslide detection and mapping is mainly performed with aerial photos, often associated with optical and radar imagery. Concerning landslide monitoring, satellite radars prevail over the other types of data. Remote sensing is mainly used for detection/mapping and monitoring of slides, flows and lateral spreads with a preferably large scale of analysis (1:5000–1:25 000). All the compilers integrate remote sensing data with other thematic data, mainly geological maps, landslide inventory maps and DTMs and derived maps. According to the research and working experience of the compilers, remote sensing is generally considered to have a medium effectiveness/reliability for landslide studies. \n\n The results of the questionnaire can contribute to an overall sketch of the use of remote sensing in current landslide studies and show that remote sensing can be considered a powerful and well-established instrument for landslide mapping, monitoring and hazard analysis.", + "issue": "2", + "language": "English", + "libraryCatalog": "Copernicus Online Journals", + "pages": "299-309", + "publicationTitle": "Natural Hazards and Earth System Sciences", + "shortTitle": "Technical Note", + "url": "https://nhess.copernicus.org/articles/13/299/2013/", + "volume": "13", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://nhess.copernicus.org/articles/13/505/2013/", + "items": [ + { + "itemType": "journalArticle", + "title": "19 May 2011 Kütahya – Simav earthquake and evaluation of existing sample RC buildings according to the TEC-2007 criteria", + "creators": [ + { + "firstName": "M. H.", + "lastName": "Arslan", + "creatorType": "author" + }, + { + "firstName": "M.", + "lastName": "Olgun", + "creatorType": "author" + }, + { + "firstName": "M. A.", + "lastName": "Köroğlu", + "creatorType": "author" + }, + { + "firstName": "I. H.", + "lastName": "Erkan", + "creatorType": "author" + }, + { + "firstName": "A.", + "lastName": "Köken", + "creatorType": "author" + }, + { + "firstName": "O.", + "lastName": "Tan", + "creatorType": "author" + } + ], + "date": "2013-02-25", + "DOI": "10.5194/nhess-13-505-2013", + "ISSN": "1561-8633", + "abstractNote": "This study examines the damage caused to reinforced concrete structures by the 2011 earthquake that occurred in Simav, Turkey. The study briefly reports on post-earthquake field observations, tectonic characteristics of the earthquake area, geotechnical characteristics of the field, and seismic characteristics of the earthquake. The main part of the study comprises a field study, material experiments, and performance analyses of two reinforced concrete buildings that survived the earthquake with medium level damage. The building performance was calculated and assessed according to the Turkish Earthquake Code requirements for existing building stock, and recommendations were made based on the findings.", + "issue": "2", + "language": "English", + "libraryCatalog": "Copernicus Online Journals", + "pages": "505-522", + "publicationTitle": "Natural Hazards and Earth System Sciences", + "url": "https://nhess.copernicus.org/articles/13/505/2013/", + "volume": "13", + "attachments": [ + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Cornell LII.js b/translators/Cornell LII.js new file mode 100644 index 0000000..0774300 --- /dev/null +++ b/translators/Cornell LII.js @@ -0,0 +1,252 @@ +{ + "translatorID": "930d49bc-44a1-4c22-9dde-aa6f72fb11e5", + "label": "Cornell LII", + "creator": "Bill McKinney", + "target": "^https?://www\\.law\\.cornell\\.edu/supct/.+", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsbv", + "lastUpdated": "2013-02-09 12:09:10" +} + +function detectWeb(doc, url) { + var liiRegexp = /\/supct\/html\/.+/ + if (liiRegexp.test(url)) { + return "case"; + } else { + var aTags = doc.getElementsByTagName("a"); + for (var i=0; i 0) { + var tmpDis = dis[0].innerHTML; + tmpDis = tmpDis.replace(/\s+/g, " "); + newItem.title = newItem.title + " (" + tmpDis + ")"; + newItem.caseName= newItem.caseName + " (" + tmpDis + ")"; + } + + // parse citation into parts so that bluebook can be constructed + var cite = doc.getElementsByTagName("CASENUMBER"); + if (cite.length > 0) { + var citeRegex = /([0-9]+)\s+U\.S\.\s+([0-9]+)/; + var citeMatch = citeRegex.exec(cite[0].innerHTML); + if (citeMatch) { + caselawSourceVolume = citeMatch[1]; + newItem.reporterVolume = citeMatch[1]; + caselawSourceStartPage = citeMatch[2]; + newItem.firstPage = citeMatch[2]; + } + } + + // look for offcite span element + var spanTags = doc.getElementsByTagName("span"); + if (spanTags.length > 0) { + for (var i=0; i 0) { + var tmpNotice= notice [0].innerHTML; + tmpNotice= tmpNotice.replace(/\s+/g, " "); + newItem.notes.push({note:tmpNotice}); + } + + newItem.complete(); +} + +function doWeb(doc, url) { + //sample search result URL: + //http://www.law.cornell.edu/supct/search/display.html?terms=citizens&url=/supct/html/94-1340.ZS.html + var liiRegexp = /\/supct\/html\/.+/ + if (liiRegexp.test(url)) { + scrape(doc, url); + } else { + + var items = Zotero.Utilities.getItemArray(doc, doc, liiRegexp); + var urls = new Array(); + Zotero.selectItems(items, function (items) { + if (!items) { + return true; + } + for (var i in items) { + urls.push(i); + } + Zotero.Utilities.processDocuments(urls, scrape, function () {}); + }); + } + +}/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://www.law.cornell.edu/supct/html/01-618.ZD1.html", + "items": [ + { + "itemType": "case", + "creators": [ + { + "lastName": "Breyer", + "creatorType": "judge", + "fieldMode": true + } + ], + "notes": [ + { + "note": "Bluebook citation: Eldred v. Ashcroft, 537 U.S. 186 (2003)." + } + ], + "tags": [], + "seeAlso": [], + "attachments": [ + { + "title": "PDF version", + "mimeType": "application/pdf", + "downloadable": true + } + ], + "url": "http://www.law.cornell.edu/supct/html/01-618.ZD1.html", + "language": "en-us", + "court": "U.S. Supreme Court", + "reporter": "U.S.", + "title": "Eldred v. Ashcroft (Breyer, J., dissenting)", + "caseName": "Eldred v. Ashcroft (Breyer, J., dissenting)", + "shortTitle": "Eldred v. Ashcroft", + "history": "ON WRIT OF CERTIORARI TO THE UNITED STATES COURT OF APPEALS FOR THE DISTRICT OF COLUMBIA CIRCUIT", + "dateDecided": "2003 January 15", + "reporterVolume": "537", + "firstPage": "186", + "libraryCatalog": "Cornell LII", + "accessDate": "CURRENT_TIMESTAMP" + } + ] + }, + { + "type": "web", + "url": "http://www.law.cornell.edu/supct/search/index.html?query=animals&scope=onlysyllabi", + "items": "multiple" + } +] +/** END TEST CASES **/ \ No newline at end of file diff --git a/translators/Cornell University Press.js b/translators/Cornell University Press.js new file mode 100644 index 0000000..b77a5f1 --- /dev/null +++ b/translators/Cornell University Press.js @@ -0,0 +1,235 @@ +{ + "translatorID": "4363275e-5cc5-4627-9a7f-951fb58a02c3", + "label": "Cornell University Press", + "creator": "Sebastian Karcer", + "target": "^https?://www\\.cornellpress\\.cornell\\.edu/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2016-09-10 11:32:31" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2012 Sebastian Karcher + + 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) { + if (url.match("/book/")) { + return "book"; + } else if (url.match("/search/?") || url.match("/catalog/?")) { + return "multiple"; + } +} + +function doWeb(doc, url) { + var books = new Array(); + if (detectWeb(doc, url) == "multiple") { + var items = new Object(); + var rows = ZU.xpath(doc, '//div[@class="GCOIblockcontents"]') + for (var i in rows) { + titles = ZU.xpathText(rows[i], './a/div[@class="MainTitle"]') + urls = ZU.xpathText(rows[i], './a/@href') + items[urls] = titles; + } + Zotero.selectItems(items, function (items) { + if (!items) { + return true; + } + for (var i in items) { + books.push(i); + } + Zotero.Utilities.processDocuments(books, scrape); + }); + } else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var newItem = new Zotero.Item("book"); + var dataTags = new Object(); + var fields = ZU.xpath(doc, '//span[@class="detailbox"]'); + + for (var i in fields) { + var field = fields[i].textContent.trim(); + var value = ZU.xpathText(fields[i], './following-sibling::span[@class="DetailLabelText"]'); + //Z.debug(field + ": " + value) + switch (field) { + case "Title": + newItem.title = value; + break; + case "Subtitle": + newItem.title = newItem.title + ": " + value; + break; + case "Author": + newItem.creators.push(ZU.cleanAuthor(value, "author")); + break; + case "Authors": + var author = value.split(/\s*,\s*/); + for (var j in author) { + newItem.creators.push(ZU.cleanAuthor(author[j], "author")); + } + break; + case "Edited by": + var editor = value.split(/\s*,\s*/); + for (var j in editor) { + newItem.creators.push(ZU.cleanAuthor(editor[j], "editor")); + } + break; + case "Translated by": + var translator = value.split(/\s*,\s*/); + for (var j in translator) { + newItem.creators.push(ZU.cleanAuthor(translator[j], "translator")); + } + break; + case "Publisher": + newItem.publisher = value; + break; + case "ISBN-13": + newItem.ISBN = value; + break; + case "Publication Date": + case "Title First Published": + case "Publication Date": + newItem.date = ZU.strToISO(value); + break; + case "Collection": + newItem.series = value; + break; + case "Language": + case "Languages": + newItem.language = value; + break; + case "Nb of pages": + case "Main content page count": + newItem.numPages = value; + break; + case "BISAC Subject Heading": + var tags = value.split(/\n/); + for (var j in tags) { + newItem.tags[j] = tags[j].replace(/.+\//, "").trim(); + } + break; + } + } + + //add default publisher, place if nothing else is specified + if (!newItem.publisher) { + newItem.publisher = "Cornell University Press"; + newItem.place = "Ithaca, NY"; + } else if (!newItem.place) { + if (newItem.publisher.indexOf("Leuven") != -1) { + newItem.place = "Leuven"; + } else { + newItem.place = "Ithaca, NY" + } + } + + newItem.abstractNote = ZU.xpathText(doc, '//div[@id="bookpagedescription"]'); + newItem.complete(); +} /** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://www.cornellpress.cornell.edu/book/?GCOI=80140100486370", + "items": [ + { + "itemType": "book", + "title": "Missing: Persons and Politics", + "creators": [ + { + "firstName": "Jenny", + "lastName": "Edkins", + "creatorType": "author" + } + ], + "date": "2011-09-01", + "ISBN": "9781501705649", + "abstractNote": "Stories of the missing offer profound insights into the tension between how political systems see us and how we see each other. The search for people who go missing as a result of war, political violence, genocide, or natural disaster reveals how forms of governance that objectify the person are challenged. Contemporary political systems treat persons instrumentally, as objects to be administered rather than as singular beings: the apparatus of government recognizes categories, not people. In contrast, relatives of the missing demand that authorities focus on a particular person: families and friends are looking for someone who to them is unique and irreplaceable.\n\n\n\n\tIn Missing, Jenny Edkins highlights stories from a range of circumstances that shed light on this critical tension: the aftermath of World War II, when millions in Europe were displaced; the period following the fall of the World Trade Center towers in Manhattan in 2001 and the bombings in London in 2005; searches for military personnel missing in action; the thousands of political \"disappearances\" in Latin America; and in more quotidian circumstances where people walk out on their families and disappear of their own volition. When someone goes missing we often find that we didn't know them as well as we thought: there is a sense in which we are \"missing\" even to our nearest and dearest and even when we are present, not absent. In this thought-provoking book, Edkins investigates what this more profound \"missingness\" might mean in political terms.", + "libraryCatalog": "Cornell University Press", + "numPages": "296", + "place": "Ithaca, NY", + "publisher": "Cornell University Press", + "shortTitle": "Missing", + "attachments": [], + "tags": [ + "History & Theory", + "Political" + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.cornellpress.cornell.edu/book/?GCOI=80140100195440", + "items": [ + { + "itemType": "book", + "title": "Paradigms for a Metaphorology", + "creators": [ + { + "firstName": "Hans", + "lastName": "Blumenberg", + "creatorType": "author" + }, + { + "firstName": "Robert", + "lastName": "Savage", + "creatorType": "translator" + } + ], + "date": "2010-08-19", + "ISBN": "9781501704352", + "abstractNote": "\"Paradigms for a Metaphorology may be read as a kind of beginner's guide to Blumenberg, a programmatic introduction to his vast and multifaceted oeuvre. Its brevity makes it an ideal point of entry for readers daunted by the sheer bulk of Blumenberg's later writings, or distracted by their profusion of historical detail. Paradigms expresses many of Blumenberg's key ideas with a directness, concision, and clarity he would rarely match elsewhere. What is more, because it served as a beginner’s guide for its author as well, allowing him to undertake an initial survey of problems that would preoccupy him for the remainder of his life, it has the additional advantage that it can offer us a glimpse into what might be called the 'genesis of the Blumenbergian world.’\"—from the Afterword by Robert Savage\n\n\n\n\tWhat role do metaphors play in philosophical language? Are they impediments to clear thinking and clear expression, rhetorical flourishes that may well help to make philosophy more accessible to a lay audience, but that ought ideally to be eradicated in the interests of terminological exactness? Or can the images used by philosophers tell us more about the hopes and cares, attitudes and indifferences that regulate an epoch than their carefully elaborated systems of thought?\n\n\n\n\tIn Paradigms for a Metaphorology, originally published in 1960 and here made available for the first time in English translation, Hans Blumenberg (1920–1996) approaches these questions by examining the relationship between metaphors and concepts. Blumenberg argues for the existence of \"absolute metaphors\" that cannot be translated back into conceptual language. These metaphors answer the supposedly naïve, theoretically unanswerable questions whose relevance lies quite simply in the fact that they cannot be brushed aside, since we do not pose them ourselves but find them already posed in the ground of our existence. They leap into a void that concepts are unable to fill.\n\n\n\n\tAn afterword by the translator, Robert Savage, positions the book in the intellectual context of its time and explains its continuing importance for work in the history of ideas.", + "libraryCatalog": "Cornell University Press", + "numPages": "160", + "place": "Ithaca, NY", + "publisher": "Cornell University Press", + "series": "Signale: Modern German Letters, Cultures, and Thought", + "attachments": [], + "tags": [ + "Criticism", + "Methodology", + "Semiotics & Theory" + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://www.cornellpress.cornell.edu/catalog/?category_id=19", + "items": "multiple" + }, + { + "type": "web", + "url": "http://www.cornellpress.cornell.edu/search/?fa=rechercheA&keyType=all&keywords=translated&title=&author=&isbnORissn=&Collection_ID=&Format_id=&Editeur=&LanguageCode=&StartYear=----&EndYear=2012&formfield1234567893=39860609%2C19953448&formfield1234567894=", + "items": "multiple" + } +] +/** END TEST CASES **/ \ No newline at end of file diff --git a/translators/CourtListener.js b/translators/CourtListener.js new file mode 100644 index 0000000..0050740 --- /dev/null +++ b/translators/CourtListener.js @@ -0,0 +1,265 @@ +{ + "translatorID": "07890a30-866e-452a-ac3e-c19fcb39b597", + "label": "CourtListener", + "creator": "Sebastian Karcher", + "target": "^https?://www\\.courtlistener\\.com/", + "minVersion": "5.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2025-04-29 03:02:00" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2024 Sebastian Karcher + + 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) { + if (url.includes('/opinion/')) { + return 'case'; + } + else if (getSearchResults(doc, true)) { + return 'multiple'; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('article > h3 > a'); + for (let row of rows) { + let href = row.href; + 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); + } +} + +async function scrape(doc, url = doc.location.href) { + var item = new Zotero.Item('case'); + + let citations = ZU.xpath(doc, '//li/strong[contains(text(), "Citations:")]/following-sibling::span') + .map(el => el.textContent.trim()); + + let citation = text(doc, 'center b .citation'); + item.caseName = text(doc, '#caption'); + item.court = text(doc, '.case-court'); + item.reporter = text(doc, '.citation .reporter'); + item.reporterVolume = text(doc, '.citation .volume'); + item.firstPage = text(doc, '.citation .page'); + if (!item.reporter && !item.reporterVolume) { + // the reporter elements aren't always tagged. We might have to parse them + // the best version is in the top of the opinion (we always want that for history matching, + // so getting that outside the conditional + + // if that's not there, we're parsing from the title of the case + if (!citation) { + citation = citations[0]; + } + let citeExpr = citation.trim().match(/^(\d+)\s((?:[A-Z][a-z]?\.\s?)+(?:[2-3]d)?(?:Supp\.)?)\s(\d{1,4})(,|$)/); + if (citeExpr) { + item.reporterVolume = citeExpr[1]; + item.reporter = citeExpr[2]; + item.firstPage = citeExpr[3]; + } + else { + // if we can't match the reporter elements properly, just write the whole thing to citation. + item.history = citation; + } + } + + if (!item.history) { + item.history = citations.slice(1).join(', '); + } + + item.dateDecided = text(doc, ".case-date-new"); + // No good selectors for docket number and authors + let docket = ZU.xpathText(doc, '//li[strong[contains(text(), "Docket Number:")]]/text()[1]'); + item.docketNumber = docket ? docket.trim() : ""; + let authors = doc.querySelectorAll(".opinion-section-title > a[href*='/person/']"); + for (let author of authors) { + item.creators.push(ZU.cleanAuthor(author.textContent.trim(), "author", false)); + } + item.url = url.replace(/\/\?.*/, ""); + item.attachments.push({ document: doc, title: "Full Text" }); + item.extra = ""; + item.complete(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.courtlistener.com/opinion/1872757/gibson-v-bossier-city-general-hosp/?type=o&q=testing&type=o&order_by=score%20desc&stat_Precedential=on", + "items": [ + { + "itemType": "case", + "caseName": "Gibson v. Bossier City General Hosp.", + "creators": [], + "dateDecided": "Nov. 26, 1991", + "court": "Louisiana Court of Appeal", + "docketNumber": "22693-CA, 23002-CA", + "firstPage": "1332", + "history": "1991 La. App. LEXIS 3211, 1991 WL 249791", + "reporter": "So.2d", + "reporterVolume": "594", + "url": "https://www.courtlistener.com/opinion/1872757/gibson-v-bossier-city-general-hosp", + "attachments": [ + { + "title": "Full Text", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.courtlistener.com/opinion/1611405/blackwell-v-power-test-corp/?type=o&type=o&q=testing&order_by=score+desc&stat_Precedential=on&page=3", + "items": [ + { + "itemType": "case", + "caseName": "Blackwell v. Power Test Corp.", + "creators": [ + { + "firstName": "Henry Curtis", + "lastName": "Meanor", + "creatorType": "author" + } + ], + "dateDecided": "Aug. 19, 1981", + "court": "District Court, D. New Jersey", + "docketNumber": "Civ. A. 80-2227", + "firstPage": "802", + "history": "1981 U.S. Dist. LEXIS 10126", + "reporter": "F.Supp.", + "reporterVolume": "540", + "url": "https://www.courtlistener.com/opinion/1611405/blackwell-v-power-test-corp", + "attachments": [ + { + "title": "Full Text", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.courtlistener.com/opinion/108284/griggs-v-duke-power-co/?q=testing", + "items": [ + { + "itemType": "case", + "caseName": "Griggs v. Duke Power Co.", + "creators": [ + { + "firstName": "Warren Earl", + "lastName": "Burger", + "creatorType": "author" + } + ], + "dateDecided": "March 8, 1971", + "court": "Supreme Court of the United States", + "docketNumber": "124", + "firstPage": "424", + "history": "91 S. Ct. 849, 28 L. Ed. 2d 158, 3 Empl. Prac. Dec. (CCH) 8137, 3 Fair Empl. Prac. Cas. (BNA) 175, 1971 U.S. LEXIS 134", + "reporter": "U.S.", + "reporterVolume": "401", + "url": "https://www.courtlistener.com/opinion/108284/griggs-v-duke-power-co", + "attachments": [ + { + "title": "Full Text", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.courtlistener.com/?q=testing", + "items": "multiple" + }, + { + "type": "web", + "url": "https://www.courtlistener.com/opinion/3959231/state-v-martin/?q=State%20v.%20Martin&type=o&order_by=score%20desc&stat_Precedential=on", + "items": [ + { + "itemType": "case", + "caseName": "State v. Martin", + "creators": [ + { + "firstName": "Robert L.", + "lastName": "Black", + "creatorType": "author" + } + ], + "dateDecided": "Feb. 9, 1983", + "court": "Ohio Court of Appeals", + "docketNumber": "C-820238", + "firstPage": "717", + "history": "20 Ohio App. 3d 172, 20 Ohio B. 215, 1983 Ohio App. LEXIS 16057", + "reporter": "N.E.2d", + "reporterVolume": "485", + "url": "https://www.courtlistener.com/opinion/3959231/state-v-martin", + "attachments": [ + { + "title": "Full Text", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Crossref REST.js b/translators/Crossref REST.js new file mode 100644 index 0000000..c13b88f --- /dev/null +++ b/translators/Crossref REST.js @@ -0,0 +1,1757 @@ +{ + "translatorID": "0a61e167-de9a-4f93-a68a-628b48855909", + "label": "Crossref REST", + "creator": "Martynas Bagdonas", + "target": "", + "minVersion": "5.0.0", + "maxVersion": "", + "priority": 90, + "inRepository": true, + "translatorType": 8, + "lastUpdated": "2025-08-03 05:38:26" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2018 + + 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 ***** +*/ + +// Based on Crossref Unixref XML translator + +// The translator uses the newer REST API +// https://github.com/Crossref/rest-api-doc +// https://github.com/Crossref/rest-api-doc/blob/master/api_format.md +// http://api.crossref.org/types + +// REST API documentation not always reflect the actual API +// and some fields are undocumented e.g. resource, institution, etc. are missing + +// Some fields are sometimes missing for certain items when compared to the Crossref Unixref XML +// translator e.g. ISBN, pages, editors, contributors, language, etc. + +function removeUnsupportedMarkup(text) { + let markupRE = /<(\/?)(\w+)[^<>]*>/gi; + let supportedMarkup = ['i', 'b', 'sub', 'sup', 'span', 'sc']; + let transformMarkup = { + 'scp': { + open: '', + close: '' + } + }; + // Remove CDATA markup + text = text.replace(//g, '$1'); + text = text.replace(markupRE, function (m, close, name) { + name = name.toLowerCase(); + if (supportedMarkup.includes(name)) { + return (close ? ''; + } + let newMarkup = transformMarkup[name]; + if (newMarkup) { + return close ? newMarkup.close : newMarkup.open; + } + return ''; + }); + return text; +} + +function decodeEntities(n) { + let escaped = { + '&': '&', + '"': '"', + '<': '<', + '>': '>' + }; + return n.replace(/\n/g, '').replace(/("|<|>|&)/g, (str, item) => escaped[item]); +} + +function fixAuthorCapitalization(string) { + // Try to use capitalization function from Zotero Utilities, + // because the current one doesn't support unicode names. + // Can't fix this either because ZU.XRegExp.replace is + // malfunctioning when calling from translators. + if (ZU.capitalizeName) { + return ZU.capitalizeName(string); + } + if (typeof string === 'string' && string.toUpperCase() === string) { + string = string.toLowerCase().replace(/\b[a-z]/g, function (m) { + return m[0].toUpperCase(); + }); + } + return string; +} + +function parseCreators(result, item, typeOverrideMap) { + let types = ['author', 'editor', 'chair', 'translator']; + + for (let type of types) { + if (result[type]) { + let creatorType = typeOverrideMap && typeOverrideMap[type] !== undefined + ? typeOverrideMap[type] + : (type === 'author' || type === 'editor' || type === 'translator' ? type : 'contributor'); + + if (!creatorType) { + continue; + } + + for (let creator of result[type]) { + let newCreator = {}; + newCreator.creatorType = creatorType; + + if (creator.name) { + newCreator.fieldMode = 1; + newCreator.lastName = creator.name; + } + else { + newCreator.firstName = fixAuthorCapitalization(creator.given); + newCreator.lastName = fixAuthorCapitalization(creator.family); + if (!newCreator.firstName) { + newCreator.fieldMode = 1; + } + } + + item.creators.push(newCreator); + } + } + } +} + +function parseDate(dateObj) { + if (dateObj && dateObj['date-parts'] && dateObj['date-parts'][0]) { + let [year, month, day] = dateObj['date-parts'][0]; + if (year) { + if (month) { + if (day) { + return year + '-' + month.toString().padStart(2, '0') + '-' + day.toString().padStart(2, '0'); + } + else { + return month.toString().padStart(2, '0') + '/' + year; + } + } + else { + return year.toString(); + } + } + } + return null; +} + +function processCrossref(json) { + json = JSON.parse(json); + let creatorTypeOverrideMap = {}; + for (let result of json.message.items) { + let item; + if (['journal', 'journal-article', 'journal-volume', 'journal-issue'].includes(result.type)) { + item = new Zotero.Item('journalArticle'); + } + else if (['report', 'report-series', 'report-component'].includes(result.type)) { + item = new Zotero.Item('report'); + } + else if (['book', 'book-series', 'book-set', 'book-track', + 'monograph', 'reference-book', 'edited-book'].includes(result.type)) { + item = new Zotero.Item('book'); + } + else if (['book-chapter', 'book-part', 'book-section', 'reference-entry'].includes(result.type)) { + item = new Zotero.Item('bookSection'); + creatorTypeOverrideMap = { author: 'bookAuthor' }; + } + else if (result.type === 'other' && result.ISBN && result['container-title']) { + item = new Zotero.Item('bookSection'); + if (result['container-title'].length >= 2) { + item.seriesTitle = result['container-title'][0]; + item.bookTitle = result['container-title'][1]; + } + else { + item.bookTitle = result['container-title'][0]; + } + creatorTypeOverrideMap = { author: 'bookAuthor' }; + } + else if (['standard'].includes(result.type)) { + item = new Zotero.Item('standard'); + } + else if (['dataset', 'database'].includes(result.type)) { + item = new Zotero.Item('dataset'); + } + else if (['proceedings', 'proceedings-article', 'proceedings-series'].includes(result.type)) { + item = new Zotero.Item('conferencePaper'); + } + else if (result.type === 'dissertation') { + item = new Zotero.Item('thesis'); + item.date = parseDate(result.approved); + item.thesisType = result.degree && result.degree[0] && result.degree[0].replace(/\(.+\)/, ''); + } + else if (result.type === 'posted-content') { + if (result.subtype === 'preprint') { + item = new Zotero.Item('preprint'); + item.repository = result['group-title']; + } + else { + item = new Zotero.Item('blogPost'); + if (result.institution && result.institution.length) { + item.blogTitle = result.institution[0].name && result.institution[0].name; + } + } + } + else if (result.type === 'peer-review') { + item = new Zotero.Item('manuscript'); + item.type = 'peer review'; + if (!result.author) { + item.creators.push({ lastName: 'Anonymous Reviewer', fieldMode: 1, creatorType: 'author' }); + } + if (result.relation && result.relation['is-review-of'] && result.relation['is-review-of'].length) { + let identifier; + let reviewOf = result.relation['is-review-of'][0]; + let type = reviewOf['id-type']; + let id = reviewOf.id; + if (type === 'doi') { + identifier = 'https://doi.org/' + id + ''; + } + else if (type === 'url') { + identifier = '' + id + ''; + } + else { + identifier = id; + } + item.notes.push('Review of ' + identifier); + } + } + else { + item = new Zotero.Item('document'); + } + + parseCreators(result, item, creatorTypeOverrideMap); + + if (result.description) { + item.notes.push(result.description); + } + + item.abstractNote = result.abstract && removeUnsupportedMarkup(result.abstract); + // Fall back to article number if no page number + // https://www.crossref.org/documentation/schema-library/markup-guide-metadata-segments/article-ids/ + item.pages = result.page || result['article-number']; + item.ISBN = result.ISBN && result.ISBN.join(', '); + item.ISSN = result.ISSN && result.ISSN.join(', '); + item.issue = result.issue; + item.volume = result.volume; + item.language = result.language; + item.edition = result['edition-number']; + item.university = item.institution = item.publisher = result.publisher; + + if (result['container-title'] && result['container-title'][0]) { + if (['journalArticle'].includes(item.itemType)) { + item.publicationTitle = result['container-title'][0]; + } + else if (['conferencePaper'].includes(item.itemType)) { + item.proceedingsTitle = result['container-title'][0]; + } + else if (['book'].includes(item.itemType)) { + item.series = result['container-title'][0]; + } + else if (['bookSection'].includes(item.itemType)) { + item.bookTitle = result['container-title'][0]; + } + else { + item.seriesTitle = result['container-title'][0]; + } + } + + item.conferenceName = result.event && result.event.name; + + // "short-container-title" often has the same value as "container-title", so it can be ignored + if (result['short-container-title'] && result['short-container-title'][0] !== result['container-title'][0]) { + item.journalAbbreviation = result['short-container-title'][0]; + } + + if (result.event && result.event.location) { + item.place = result.event.location; + } + else if (result.institution && result.institution[0] && result.institution[0].place) { + item.place = result.institution[0].place.join(', '); + } + else { + item.place = result['publisher-location']; + } + + item.institution = item.university = result.institution && result.institution[0] && result.institution[0].name; + + // Prefer print to other dates + if (parseDate(result['published-print'])) { + item.date = parseDate(result['published-print']); + } + else if (parseDate(result.issued)) { + item.date = parseDate(result.issued); + } + + // For item types where DOI isn't supported, it will be automatically added to the Extra field. + // However, this won't show up in the translator tests + item.DOI = result.DOI; + + item.url = result.resource && result.resource.primary && result.resource.primary.URL; + + // Using only the first license + item.rights = result.license && result.license[0] && result.license[0].URL; + + if (result.title && result.title[0]) { + item.title = result.title[0]; + if (result.subtitle && result.subtitle[0]) { + // Avoid duplicating the subtitle if it already exists in the title + if (item.title.toLowerCase().indexOf(result.subtitle[0].toLowerCase()) < 0) { + // Sometimes title already has a colon + if (item.title[item.title.length - 1] !== ':') { + item.title += ':'; + } + item.title += ' ' + result.subtitle[0]; + } + } + item.title = removeUnsupportedMarkup(item.title); + } + + if (!item.title) { + item.title = '[No title found]'; + } + + // Check if there are potential issues with character encoding and try to fix them. + // E.g., in 10.1057/9780230391116.0016, the en dash in the title is displayed as â<80><93>, + // which is what you get if you decode a UTF-8 en dash (<80><93>) as Latin-1 and then serve + // as UTF-8 ( <80> <93>) + for (let field in item) { + if (typeof item[field] != 'string') { + continue; + } + // Check for control characters that should never be in strings from Crossref + if (/[\u007F-\u009F]/.test(item[field])) { + // <80><93> -> %E2%80%93 -> en dash + try { + item[field] = decodeURIComponent(escape(item[field])); + } + // If decoding failed, just strip control characters + // https://forums.zotero.org/discussion/102271/lookup-failed-for-doi + catch (e) { + item[field] = item[field].replace(/[\u0000-\u001F\u007F-\u009F]/g, ''); + } + } + item[field] = decodeEntities(item[field]); + } + item.libraryCatalog = 'Crossref'; + item.complete(); + } +} + +function detectSearch(item) { + return false; +} + +function doSearch(item) { + let query = null; + + if (item.DOI) { + if (Array.isArray(item.DOI)) { + query = '?filter=doi:' + item.DOI.map(x => ZU.cleanDOI(x)).filter(x => x).join(',doi:'); + } + else { + query = '?filter=doi:' + ZU.cleanDOI(item.DOI); + } + } + else if (item.query) { + query = '?query.bibliographic=' + encodeURIComponent(item.query); + } + else { + return; + } + + // Note: Cannot speed up the request by selecting only the necessary fields because Crossref + // throws errors for selecting certain fields, e.g. resource, institution, etc. + // TODO: Try to test this again in future + // let selectedFields = [ + // 'type', 'ISBN', 'container-title', 'author', 'editor', 'chair', 'translator', + // 'abstract', 'page', 'ISSN', 'issue', 'volume', 'language', 'edition-number', + // 'publisher', 'short-container-title', 'event', 'institution', 'publisher-location', + // 'published-print', 'issued', 'DOI', 'resource', 'license', 'title', 'subtitle', + // 'approved', 'degree', 'subtype', 'group-title', 'relation' + // ]; + // query += '&select=' + encodeURIComponent(selectedFields.join(',')); + + if (Z.getHiddenPref('CrossrefREST.email')) { + query += '&mailto=' + Z.getHiddenPref('CrossrefREST.email'); + } + + ZU.doGet('https://api.crossref.org/works/' + query, function (responseText) { + processCrossref(responseText); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "search", + "input": { + "DOI": "10.1109/isscc.2017.7870285" + }, + "items": [ + { + "itemType": "conferencePaper", + "title": "6.1 A 56Gb/s PAM-4/NRZ transceiver in 40nm CMOS", + "creators": [ + { + "creatorType": "author", + "firstName": "Pen-Jui", + "lastName": "Peng" + }, + { + "creatorType": "author", + "firstName": "Jeng-Feng", + "lastName": "Li" + }, + { + "creatorType": "author", + "firstName": "Li-Yang", + "lastName": "Chen" + }, + { + "creatorType": "author", + "firstName": "Jri", + "lastName": "Lee" + } + ], + "date": "02/2017", + "DOI": "10.1109/isscc.2017.7870285", + "conferenceName": "2017 IEEE International Solid- State Circuits Conference - (ISSCC)", + "libraryCatalog": "Crossref", + "place": "San Francisco, CA, USA", + "proceedingsTitle": "2017 IEEE International Solid-State Circuits Conference (ISSCC)", + "publisher": "IEEE", + "url": "http://ieeexplore.ieee.org/document/7870285/", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1111/1574-6941.12040" + }, + "items": [ + { + "itemType": "journalArticle", + "title": "Microbial community changes at a terrestrial volcanic CO2vent induced by soil acidification and anaerobic microhabitats within the soil column", + "creators": [ + { + "creatorType": "author", + "firstName": "Janin", + "lastName": "Frerichs" + }, + { + "creatorType": "author", + "firstName": "Birte I.", + "lastName": "Oppermann" + }, + { + "creatorType": "author", + "firstName": "Simone", + "lastName": "Gwosdz" + }, + { + "creatorType": "author", + "firstName": "Ingo", + "lastName": "Möller" + }, + { + "creatorType": "author", + "firstName": "Martina", + "lastName": "Herrmann" + }, + { + "creatorType": "author", + "firstName": "Martin", + "lastName": "Krüger" + } + ], + "date": "04/2013", + "DOI": "10.1111/1574-6941.12040", + "ISSN": "0168-6496", + "issue": "1", + "journalAbbreviation": "FEMS Microbiol Ecol", + "language": "en", + "libraryCatalog": "Crossref", + "pages": "60-74", + "publicationTitle": "FEMS Microbiology Ecology", + "url": "https://academic.oup.com/femsec/article-lookup/doi/10.1111/1574-6941.12040", + "volume": "84", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.2747/1539-7216.50.2.197" + }, + "items": [ + { + "itemType": "journalArticle", + "title": "The ChineseHukouSystem at 50", + "creators": [ + { + "creatorType": "author", + "firstName": "Kam Wing", + "lastName": "Chan" + } + ], + "date": "03/2009", + "DOI": "10.2747/1539-7216.50.2.197", + "ISSN": "1538-7216, 1938-2863", + "issue": "2", + "language": "en", + "libraryCatalog": "Crossref", + "pages": "197-221", + "publicationTitle": "Eurasian Geography and Economics", + "url": "https://www.tandfonline.com/doi/full/10.2747/1539-7216.50.2.197", + "volume": "50", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.17077/etd.xnw0xnau" + }, + "items": [ + { + "itemType": "thesis", + "title": "Contributions to geomagnetic theory", + "creators": [ + { + "creatorType": "author", + "firstName": "Joseph Emil", + "lastName": "Kasper" + } + ], + "date": "1958", + "libraryCatalog": "Crossref", + "place": "Iowa City, IA, United States", + "rights": "http://rightsstatements.org/vocab/InC/1.0/", + "thesisType": "Doctor of Philosophy", + "university": "The University of Iowa", + "url": "https://iro.uiowa.edu/esploro/outputs/doctoral/9983777035702771", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.31219/osf.io/8ag3w" + }, + "items": [ + { + "itemType": "preprint", + "title": "Open Practices in Visualization Research", + "creators": [ + { + "creatorType": "author", + "firstName": "Steve", + "lastName": "Haroz" + } + ], + "date": "2018-07-03", + "DOI": "10.31219/osf.io/8ag3w", + "abstractNote": "Two fundamental tenants of scientific research are that it can be scrutinized and built-upon. Both require that the collected data and supporting materials be shared, so others can examine, reuse, and extend them. Assessing the accessibility of these components and the paper itself can serve as a proxy for the reliability, replicability, and applicability of a field’s research. In this paper, I describe the current state of openness in visualization research and provide suggestions for authors, reviewers, and editors to improve open practices in the field. A free copy of this paper, the collected data, and the source code are available at https://osf.io/qf9na/", + "libraryCatalog": "Open Science Framework", + "repository": "Center for Open Science", + "rights": "https://creativecommons.org/licenses/by/4.0/legalcode", + "url": "https://osf.io/8ag3w", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.21468/SciPost.Report.10" + }, + "items": [ + { + "itemType": "manuscript", + "title": "Report on 1607.01285v1", + "creators": [ + { + "lastName": "Anonymous Reviewer", + "fieldMode": 1, + "creatorType": "author" + } + ], + "date": "2016-09-08", + "libraryCatalog": "Crossref", + "manuscriptType": "peer review", + "url": "https://scipost.org/SciPost.Report.10", + "attachments": [], + "tags": [], + "notes": [ + "Review of https://doi.org/10.21468/SciPostPhys.1.1.010" + ], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.4086/cjtcs.2012.002" + }, + "items": [ + { + "itemType": "journalArticle", + "title": "[No title found]", + "creators": [ + { + "creatorType": "author", + "firstName": "Michael", + "lastName": "Hoffman" + }, + { + "creatorType": "author", + "firstName": "Jiri", + "lastName": "Matousek" + }, + { + "creatorType": "author", + "firstName": "Yoshio", + "lastName": "Okamoto" + }, + { + "creatorType": "author", + "firstName": "Phillipp", + "lastName": "Zumstein" + } + ], + "date": "2012", + "DOI": "10.4086/cjtcs.2012.002", + "ISSN": "1073-0486", + "issue": "1", + "journalAbbreviation": "Chicago J. of Theoretical Comp. Sci.", + "language": "en", + "libraryCatalog": "Crossref", + "pages": "1-10", + "publicationTitle": "Chicago Journal of Theoretical Computer Science", + "url": "http://cjtcs.cs.uchicago.edu/articles/2012/2/contents.html", + "volume": "18", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1002/9781119011071.iemp0172" + }, + "items": [ + { + "itemType": "bookSection", + "title": "Appreciation and Eudaimonic Reactions to Media", + "creators": [ + { + "creatorType": "bookAuthor", + "firstName": "Allison", + "lastName": "Eden" + } + ], + "date": "2020-09-09", + "ISBN": "9781119011071", + "abstractNote": "Entertainment has historically been associated with enjoyment. Yet, many experiences considered under the label of entertainment are not particularly enjoyable for viewers, and may instead evoke feelings of sadness, pensiveness, or mixed affect. Attempting to answer the question of why audiences would select media which do not promote hedonic pleasure, researchers have suggested that appreciation may better describe the experience of liking media which provokes mixed affect. Appreciation of media is thought to promote long‐term goals such as life improvement and self‐betterment, in line with the philosophical concept of eudaimonia. This entry examines appreciation‐based responses to media in terms of short‐ and long‐term outcomes.", + "bookTitle": "The International Encyclopedia of Media Psychology", + "edition": "1", + "language": "en", + "libraryCatalog": "Crossref", + "pages": "1-9", + "publisher": "Wiley", + "rights": "http://doi.wiley.com/10.1002/tdm_license_1.1", + "url": "https://onlinelibrary.wiley.com/doi/10.1002/9781119011071.iemp0172", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1045/may2016-peng" + }, + "items": [ + { + "itemType": "journalArticle", + "title": "Scientific Stewardship in the Open Data and Big Data Era Roles and Responsibilities of Stewards and Other Major Product Stakeholders", + "creators": [ + { + "creatorType": "author", + "firstName": "Ge", + "lastName": "Peng" + }, + { + "creatorType": "author", + "firstName": "Nancy A.", + "lastName": "Ritchey" + }, + { + "creatorType": "author", + "firstName": "Kenneth S.", + "lastName": "Casey" + }, + { + "creatorType": "author", + "firstName": "Edward J.", + "lastName": "Kearns" + }, + { + "creatorType": "author", + "firstName": "Jeffrey L.", + "lastName": "Prevette" + }, + { + "creatorType": "author", + "firstName": "Drew", + "lastName": "Saunders" + }, + { + "creatorType": "author", + "firstName": "Philip", + "lastName": "Jones" + }, + { + "creatorType": "author", + "firstName": "Tom", + "lastName": "Maycock" + }, + { + "creatorType": "author", + "firstName": "Steve", + "lastName": "Ansari" + } + ], + "date": "05/2016", + "DOI": "10.1045/may2016-peng", + "ISSN": "1082-9873", + "issue": "5/6", + "language": "en", + "libraryCatalog": "Crossref", + "publicationTitle": "D-Lib Magazine", + "url": "http://www.dlib.org/dlib/may16/peng/05peng.html", + "volume": "22", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1300/J150v03n04_02" + }, + "items": [ + { + "itemType": "journalArticle", + "title": "Service Value Determination: An Integrative Perspective", + "creators": [ + { + "creatorType": "author", + "firstName": "Rama K.", + "lastName": "Jayanti" + }, + { + "creatorType": "author", + "firstName": "Amit K.", + "lastName": "Ghosh" + } + ], + "date": "1996-05-10", + "DOI": "10.1300/j150v03n04_02", + "ISSN": "1050-7051, 1541-0897", + "issue": "4", + "language": "en", + "libraryCatalog": "Crossref", + "pages": "5-25", + "publicationTitle": "Journal of Hospitality & Leisure Marketing", + "shortTitle": "Service Value Determination", + "url": "https://www.tandfonline.com/doi/full/10.1300/J150v03n04_02", + "volume": "3", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.59350/5znft-x4j11" + }, + "items": [ + { + "itemType": "blogPost", + "title": "QDR Creates New Course on Data Management for CITI", + "creators": [ + { + "creatorType": "author", + "firstName": "Sebastian", + "lastName": "Karcher" + } + ], + "date": "2023-03-31", + "blogTitle": "QDR Blog", + "rights": "https://creativecommons.org/licenses/by/4.0/legalcode", + "url": "https://qdr.syr.edu/qdr-blog/qdr-creates-new-course-data-management-citi", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.26509/frbc-wp-200614" + }, + "items": [ + { + "itemType": "report", + "title": "Co-Movement in Sticky Price Models with Durable Goods", + "creators": [ + { + "creatorType": "author", + "firstName": "Charles T.", + "lastName": "Carlstrom" + }, + { + "creatorType": "author", + "firstName": "Timothy Stephen", + "lastName": "Fuerst" + } + ], + "date": "11/2006", + "institution": "Federal Reserve Bank of Cleveland", + "libraryCatalog": "Crossref", + "place": "Cleveland, OH", + "seriesTitle": "Working paper (Federal Reserve Bank of Cleveland)", + "url": "https://www.clevelandfed.org/publications/working-paper/wp-0614-co-movement-in-sticky-price-models-with-durable-goods", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.3389/978-2-88966-016-2" + }, + "items": [ + { + "itemType": "book", + "title": "Biobanks as Essential Tools for Translational Research: The Belgian Landscape", + "creators": [ + { + "creatorType": "editor", + "firstName": "Sofie J. S", + "lastName": "Bekaert" + }, + { + "creatorType": "editor", + "firstName": "Annelies", + "lastName": "Debucquoy" + }, + { + "creatorType": "editor", + "firstName": "Veronique", + "lastName": "T’Joen" + }, + { + "creatorType": "editor", + "firstName": "Laurent Georges", + "lastName": "Dollé" + }, + { + "creatorType": "editor", + "firstName": "Loes", + "lastName": "Linsen" + } + ], + "date": "2020", + "ISBN": "9782889660162", + "libraryCatalog": "Crossref", + "publisher": "Frontiers Media SA", + "series": "Frontiers Research Topics", + "shortTitle": "Biobanks as Essential Tools for Translational Research", + "url": "https://www.frontiersin.org/research-topics/8144/biobanks-as-essential-tools-for-translational-research-the-belgian-landscape", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.18356/31516bf1-en" + }, + "items": [ + { + "itemType": "book", + "title": "Index to Proceedings of the Economic and Social Council", + "creators": [], + "libraryCatalog": "Crossref", + "publisher": "United Nations", + "url": "https://www.un-ilibrary.org/content/periodicals/24124516", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.7139/2017.978-1-56900-592-7" + }, + "items": [ + { + "itemType": "book", + "title": "Occupational Therapy Manager, 6th Ed", + "creators": [ + { + "creatorType": "editor", + "firstName": "Karen", + "lastName": "Jacobs" + }, + { + "creatorType": "editor", + "firstName": "Judith", + "lastName": "Parker Kent" + }, + { + "creatorType": "editor", + "firstName": "Albert", + "lastName": "Copolillo" + }, + { + "creatorType": "editor", + "firstName": "Roger", + "lastName": "Ideishi" + }, + { + "creatorType": "editor", + "firstName": "Shawn", + "lastName": "Phipps" + }, + { + "creatorType": "editor", + "firstName": "Sarah", + "lastName": "McKinnon" + }, + { + "creatorType": "editor", + "firstName": "Donna", + "lastName": "Costa" + }, + { + "creatorType": "editor", + "firstName": "Nathan", + "lastName": "Herz" + }, + { + "creatorType": "editor", + "firstName": "Guy", + "lastName": "McCormack" + }, + { + "creatorType": "editor", + "firstName": "Lee", + "lastName": "Brandt" + }, + { + "creatorType": "editor", + "firstName": "Karen", + "lastName": "Duddy" + } + ], + "ISBN": "9781569005927", + "edition": "6", + "libraryCatalog": "Crossref", + "publisher": "AOTA Press", + "url": "https://library.aota.org/Occupational-Therapy-Manager-6", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.21428/cbd17b20.594a8acc" + }, + "items": [ + { + "itemType": "bookSection", + "title": "Resumen Ejecutivo y Principales Conclusiones", + "creators": [], + "date": "2022-09-12", + "bookTitle": "2022 Global Deep-Sea Capacity Assessment", + "edition": "1", + "libraryCatalog": "Crossref", + "publisher": "Ocean Discovery League, Saunderstown, USA.", + "url": "https://deepseacapacity.oceandiscoveryleague.org/pub/2022-exec-summary-es", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.11647/obp.0163.08" + }, + "items": [ + { + "itemType": "book", + "title": "Extended dagesh forte: Reading without melody", + "creators": [ + { + "creatorType": "author", + "firstName": "Alex", + "lastName": "Foreman" + } + ], + "date": "01/2020", + "libraryCatalog": "Crossref", + "publisher": "Open Book Publishers", + "rights": "http://creativecommons.org/licenses/by/4.0", + "series": "Semitic Languages and Cultures", + "shortTitle": "Extended dagesh forte", + "url": "https://cdn.openbookpublishers.com/resources/10.11647/obp.0163/OBP.0163.08_Gen_1-13_extended_dagesh_forte.mp3", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1021/bk-2009-1027" + }, + "items": [ + { + "itemType": "book", + "title": "Environmental Applications of Nanoscale and Microscale Reactive Metal Particles", + "creators": [ + { + "creatorType": "editor", + "firstName": "Cherie L.", + "lastName": "Geiger" + }, + { + "creatorType": "editor", + "firstName": "Kathleen M.", + "lastName": "Carvalho-Knighton" + } + ], + "date": "2010-02-01", + "ISBN": "9780841269927 9780841224674", + "libraryCatalog": "Crossref", + "place": "Washington DC", + "publisher": "American Chemical Society", + "series": "ACS Symposium Series", + "url": "https://pubs.acs.org/doi/book/10.1021/bk-2009-1027", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.59317/9789390083503" + }, + "items": [ + { + "itemType": "book", + "title": "Plants for Human Survival and Medicines (Co-Published With Crc Press,Uk)", + "creators": [ + { + "creatorType": "author", + "firstName": "Bikarma", + "lastName": "Singh" + } + ], + "date": "2019-07-05", + "ISBN": "9789390083503", + "abstractNote": "This book reports the potential plants for human survival, explored medicinal aspects of the ongoing research and development for discovering new molecules, new drugs, new leads, ethnic-traditional applications and nutraceutical values of plants. It provides a baseline data and information on plants and their hidden knowledge for human health. This is build upon based on twenty-five excellent research articles and main focused plant species are Boswellia serrata, Butea monosperma, Colebrookea oppositifolia, Cymbopogon khasianus, Dendrophthe falcata, Dysoxylum binectariferum, Echinacea purpurea, Grewia asiatica, Picrorrhiza kurroa, Saussurea costus, Withania somnifera, Zanthoxylum armatum, different species of Aconitum and Panax, Ashtavarga groups (Habenaria intermedia, Habenaria edgeworthii, Malaxis acuminata, Malaxis muscifera, Lilium polyphyllum, Polygonatum verticillatum, Polygonatum cirrhifolium and Roscoea procera), and hundreds of potential life-saving plants used by different ethnic tribes of Himalaya as food, shelter and medicine in their day-to-day life. Various research studies and clinical trials mentioned in the book will add and contribute a lot in discovering quick leads for medicine formulations and products development. In addition to research suggestions and valuation of plants for humans contained within each of the articles, an introduction section emphasizes particular research avenues for attention in the drug development programmes. As the reader will note, these compilations represent a wide collection of views, reflecting the diversity of sciences and interests of thousands of ideas that enabled thoughtful deliberations from a wide range of scientific perspectives.", + "libraryCatalog": "Crossref", + "publisher": "NIPA", + "url": "https://www.nipaers.com/ebook/9789390083503", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.9734/bpi/hmms/v13/2889f" + }, + "items": [ + { + "itemType": "bookSection", + "title": "A Review on MVD for Trigeminal Neuralgia", + "creators": [ + { + "creatorType": "bookAuthor", + "firstName": "Renuka S.", + "lastName": "Melkundi" + }, + { + "creatorType": "bookAuthor", + "firstName": "Sateesh", + "lastName": "Melkundi" + } + ], + "date": "2021-07-30", + "bookTitle": "Highlights on Medicine and Medical Science Vol. 13", + "libraryCatalog": "Crossref", + "pages": "108-114", + "publisher": "Book Publisher International (a part of SCIENCEDOMAIN International)", + "url": "https://stm.bookpi.org/HMMS-V13/article/view/2729", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.7328/bgbl_2010_0000231_h34" + }, + "items": [ + { + "itemType": "bookSection", + "title": "Dritte Verordnung zur Änderung der Anlageverordnung", + "creators": [], + "date": "2010-06-29", + "bookTitle": "Bundesgesetzblatt", + "libraryCatalog": "Crossref", + "pages": "841-845", + "publisher": "Recht Fuer Deutschland GmbH", + "url": "http://openurl.makrolog.de/service?url_ver=Z39.88-2004&rft_val_fmt=&rft.gesetzblatt=bd_bgbl&rft.jahrgang=2010&rft.seite=841&svc_id=info:rfd/vkbl", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.14509/23007" + }, + "items": [ + { + "itemType": "bookSection", + "title": "High-resolution lidar data for infrastructure corridors, Wiseman Quadrangle, Alaska", + "creators": [ + { + "creatorType": "bookAuthor", + "firstName": "T. D.", + "lastName": "Hubbard" + }, + { + "creatorType": "bookAuthor", + "firstName": "M. L.", + "lastName": "Braun" + }, + { + "creatorType": "bookAuthor", + "firstName": "R. E.", + "lastName": "Westbrook" + }, + { + "creatorType": "bookAuthor", + "firstName": "P. E.", + "lastName": "Gallagher" + } + ], + "bookTitle": "High-resolution lidar data for Alaska infrastructure corridors", + "libraryCatalog": "Crossref", + "publisher": "Alaska Division of Geological & Geophysical Surveys", + "url": "http://www.dggs.alaska.gov/pubs/id/23007", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1002/0471238961.0308121519200523.a01.pub2" + }, + "items": [ + { + "itemType": "bookSection", + "title": "Chloroprene", + "creators": [ + { + "creatorType": "bookAuthor", + "firstName": "Clare A.", + "lastName": "Stewart" + }, + { + "creatorType": "bookAuthor", + "firstName": "Updated By", + "lastName": "Staff" + } + ], + "date": "2014-04-28", + "bookTitle": "Kirk-Othmer Encyclopedia of Chemical Technology", + "libraryCatalog": "Crossref", + "pages": "1-9", + "place": "Hoboken, NJ, USA", + "publisher": "John Wiley & Sons, Inc.", + "url": "https://onlinelibrary.wiley.com/doi/10.1002/0471238961.0308121519200523.a01.pub2", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.3403/02199208" + }, + "items": [ + { + "itemType": "standard", + "title": "Non-destructive testing. Acoustic emission. Equipment characterization: Verification of operating characteristic", + "creators": [], + "DOI": "10.3403/02199208", + "libraryCatalog": "Crossref", + "place": "London", + "publisher": "BSI British Standards", + "shortTitle": "Non-destructive testing. Acoustic emission. Equipment characterization", + "url": "https://linkresolver.bsigroup.com/junction/resolve/000000000030034606?restype=standard", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.4159/dlcl.hippocrates_cos-nature_women.2012" + }, + "items": [ + { + "itemType": "dataset", + "title": "Nature of Women", + "creators": [ + { + "creatorType": "author", + "lastName": "Hippocrates Of Cos", + "fieldMode": 1 + }, + { + "creatorType": "translator", + "firstName": "Paul", + "lastName": "Potter" + } + ], + "date": "2012", + "DOI": "10.4159/dlcl.hippocrates_cos-nature_women.2012", + "libraryCatalog": "Crossref", + "repository": "Harvard University Press", + "repositoryLocation": "Cambridge, MA", + "url": "http://www.loebclassics.com/view/hippocrates_cos-nature_women/2012/work.xml", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1036/1097-8542.265870" + }, + "items": [ + { + "itemType": "dataset", + "title": "Food analogs", + "creators": [], + "DOI": "10.1036/1097-8542.265870", + "libraryCatalog": "Crossref", + "repository": "McGraw-Hill Professional", + "url": "https://www.accessscience.com/lookup/doi/10.1036/1097-8542.265870", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.2118/29099-ms" + }, + "items": [ + { + "itemType": "conferencePaper", + "title": "Logically Rectangular Mixed Methods for Darcy Flow on General Geometry", + "creators": [ + { + "creatorType": "author", + "firstName": "Todd", + "lastName": "Arbogast" + }, + { + "creatorType": "author", + "firstName": "Philip T.", + "lastName": "Keenan" + }, + { + "creatorType": "author", + "firstName": "Mary F.", + "lastName": "Wheeler" + } + ], + "date": "1995-02-12", + "DOI": "10.2118/29099-ms", + "abstractNote": "ABSTRACT We consider an expanded mixed finite element formulation (cell centered finite differences) for Darcy flow with a tensor absolute permeability. The reservoir can be geometrically general with internal features, but. the computational domain is rectangular. The method is defined on a curvilinear grid that need not, be orthogonal, obtained by mapping the rectangular, computational grid. The original flow problem becomes a similar problem with a modified permeability on the computational grid. Quadrature rules turn the mixed method into a cell-centered finite difference method with a. 9 point stencil in 2-D and 19 in 3-D. As shown by theory and experiment, if the modified permeability on the computational domain is smooth, then the convergence rate is optimal and both pressure and velocity are superconvergent at certain points. If not, Lagrange multiplier pressures can be introduced on boundaries of elements so that optimal convergence is retained. This modification presents only small changes in the solution process; in fact, the same parallel domain decomposition algorithms can be applied with little or no change to the code if the modified permeability is smooth over the subdomains. This Lagrange multiplier procedure can be. used to extend the difference scheme to multi-block domains, and to give, a coupling with unstructured grids. In all cases, the mixed formulation is locally conservative. Computational results illustrate the advantage and convergence of this method.", + "conferenceName": "SPE Reservoir Simulation Symposium", + "libraryCatalog": "Crossref", + "place": "San Antonio, Texas", + "proceedingsTitle": "All Days", + "publisher": "SPE", + "url": "https://onepetro.org/spersc/proceedings/95RSS/All-95RSS/SPE-29099-MS/61095", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.14264/105901" + }, + "items": [ + { + "itemType": "thesis", + "title": "Synthetic and structural studies towards novel backbone peptidomimetics", + "creators": [ + { + "creatorType": "author", + "firstName": "Michael John.", + "lastName": "Kelso" + } + ], + "date": "2002-02-02", + "libraryCatalog": "Crossref", + "thesisType": "PhD Thesis", + "university": "University of Queensland Library", + "url": "https://espace.library.uq.edu.au/view/UQ:105901", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1101/2020.04.07.20057075" + }, + "items": [ + { + "itemType": "preprint", + "title": "A simple method to quantify country-specific effects of COVID-19 containment measures", + "creators": [ + { + "creatorType": "author", + "firstName": "Morten Gram", + "lastName": "Pedersen" + }, + { + "creatorType": "author", + "firstName": "Matteo", + "lastName": "Meneghini" + } + ], + "date": "2020-04-10", + "DOI": "10.1101/2020.04.07.20057075", + "abstractNote": "AbstractMost of the world is currently fighting to limit the impact of the COVID-19 pandemic. Italy, the Western country with most COVID-19 related deaths, was the first to implement drastic containment measures in early March, 2020. Since then most other European countries, the USA, Canada and Australia, have implemented similar restrictions, ranging from school closures, banning of recreational activities and large events, to complete lockdown. Such limitations, and softer promotion of social distancing, may be more effective in one society than in another due to cultural or political differences. It is therefore important to evaluate the effectiveness of these initiatives by analyzing country-specific COVID-19 data. We propose to model COVID-19 dynamics with a SIQR (susceptible – infectious – quarantined – recovered) model, since confirmed positive cases are isolated and do not transmit the disease. We provide an explicit formula that is easily implemented and permits us to fit official COVID-19 data in a series of Western countries. We found excellent agreement with data-driven estimation of the day-of-change in disease dynamics and the dates when official interventions were introduced. Our analysis predicts that for most countries only the more drastic restrictions have reduced virus spreading. Further, we predict that the number of unidentified COVID-19-positive individuals at the beginning of the epidemic is ∼10 times the number of confirmed cases. Our results provide important insight for future planning of non-pharmacological interventions aiming to contain spreading of COVID-19 and similar diseases.", + "libraryCatalog": "Public and Global Health", + "repository": "Cold Spring Harbor Laboratory", + "url": "http://medrxiv.org/lookup/doi/10.1101/2020.04.07.20057075", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.32388/tqr2ys" + }, + "items": [ + { + "itemType": "manuscript", + "title": "Review of: \"Stakeholders' Perception of Socioecological Factors Influencing Forest Elephant Crop Depredation in Gabon, Central Africa\"", + "creators": [ + { + "creatorType": "author", + "firstName": "Abel", + "lastName": "Mamboleo" + } + ], + "date": "2024-02-21", + "libraryCatalog": "Crossref", + "manuscriptType": "peer review", + "shortTitle": "Review of", + "url": "https://www.qeios.com/read/TQR2YS", + "attachments": [], + "tags": [], + "notes": [ + "Review of https://doi.org/10.32388/XSM9RG" + ], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1039/9781847557766" + }, + "items": [ + { + "itemType": "book", + "title": "Nanotechnology: Consequences for Human Health and the Environment", + "creators": [ + { + "creatorType": "editor", + "firstName": "R E", + "lastName": "Hester" + }, + { + "creatorType": "editor", + "firstName": "R M", + "lastName": "Harrison" + } + ], + "date": "2007", + "ISBN": "9780854042166", + "libraryCatalog": "Crossref", + "place": "Cambridge", + "publisher": "Royal Society of Chemistry", + "series": "Issues in Environmental Science and Technology", + "shortTitle": "Nanotechnology", + "url": "http://ebook.rsc.org/?DOI=10.1039/9781847557766", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.3133/sir20175014" + }, + "items": [ + { + "itemType": "report", + "title": "Effects of changes in pumping on regional groundwater-flow paths, 2005 and 2010, and areas contributing recharge to discharging wells, 1990–2010, in the vicinity of North Penn Area 7 Superfund site, Montgomery County, Pennsylvania", + "creators": [ + { + "creatorType": "author", + "firstName": "Lisa A.", + "lastName": "Senior" + }, + { + "creatorType": "author", + "firstName": "Daniel J.", + "lastName": "Goode" + } + ], + "date": "2017", + "institution": "US Geological Survey", + "libraryCatalog": "Crossref", + "seriesTitle": "Scientific Investigations Report", + "url": "https://pubs.usgs.gov/publication/sir20175014", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.14305/jn.19440413.2023.15" + }, + "items": [ + { + "itemType": "journalArticle", + "title": "[No title found]", + "creators": [], + "DOI": "10.14305/jn.19440413.2023.15", + "ISSN": "1944-0413, 1944-0413", + "language": "en", + "libraryCatalog": "Crossref", + "publicationTitle": "Excelsior: Leadership in Teaching and Learning", + "url": "https://surface.syr.edu/excelsior/vol15", + "volume": "15", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1002/(issn)1099-1751" + }, + "items": [ + { + "itemType": "journalArticle", + "title": "The International Journal of Health Planning and Management", + "creators": [], + "DOI": "10.1002/(issn)1099-1751", + "ISSN": "0749-6753, 1099-1751", + "language": "en", + "libraryCatalog": "Crossref", + "url": "http://doi.wiley.com/10.1002/%28ISSN%291099-1751", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1111/ceo.v49.2" + }, + "items": [ + { + "itemType": "journalArticle", + "title": "[No title found]", + "creators": [], + "date": "03/2021", + "DOI": "10.1111/ceo.v49.2", + "ISSN": "1442-6404, 1442-9071", + "issue": "2", + "journalAbbreviation": "Clinical Exper Ophthalmology", + "language": "en", + "libraryCatalog": "Crossref", + "publicationTitle": "Clinical & Experimental Ophthalmology", + "url": "https://onlinelibrary.wiley.com/toc/14429071/49/2", + "volume": "49", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1021/acsami.3c09983.s001" + }, + "items": [ + { + "itemType": "document", + "title": "Multifunctional Ti3C2Tx MXene/Silver Nanowire Membranes with Excellent Catalytic Antifouling, and Antibacterial Properties for Nitrophenol-Containing Water Purification", + "creators": [], + "libraryCatalog": "Crossref", + "publisher": "American Chemical Society (ACS)", + "url": "https://pubs.acs.org/doi/suppl/10.1021/acsami.3c09983/suppl_file/am3c09983_si_001.pdf", + "attachments": [], + "tags": [], + "notes": [ + "Supplemental Information for 10.1021/acsami.3c09983" + ], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.15405/epsbs(2357-1330).2021.6.1" + }, + "items": [ + { + "itemType": "conferencePaper", + "title": "European Proceedings of Social and Behavioural Sciences", + "creators": [], + "DOI": "10.15405/epsbs(2357-1330).2021.6.1", + "conferenceName": "Psychosocial Risks in Education and Quality Educational Processes", + "libraryCatalog": "Crossref", + "publisher": "European Publisher", + "url": "https://europeanproceedings.com/book-series/EpSBS/books/vol109-cipe-2020", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1145/1947940" + }, + "items": [ + { + "itemType": "conferencePaper", + "title": "Proceedings of the 2011 International Conference on Communication, Computing & Security - ICCCS '11", + "creators": [], + "date": "2011", + "DOI": "10.1145/1947940", + "ISBN": "9781450304641", + "conferenceName": "the 2011 International Conference", + "libraryCatalog": "Crossref", + "place": "Rourkela, Odisha, India", + "publisher": "ACM Press", + "url": "http://portal.acm.org/citation.cfm?doid=1947940", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.1103/PhysRevB.110.245108" + }, + "items": [ + { + "itemType": "journalArticle", + "title": "Floquet Schrieffer-Wolff transform based on Sylvester equations", + "creators": [ + { + "creatorType": "author", + "firstName": "Xiao", + "lastName": "Wang" + }, + { + "creatorType": "author", + "firstName": "Fabio Pablo Miguel", + "lastName": "Méndez-Córdoba" + }, + { + "creatorType": "author", + "firstName": "Dieter", + "lastName": "Jaksch" + }, + { + "creatorType": "author", + "firstName": "Frank", + "lastName": "Schlawin" + } + ], + "date": "2024-12-03", + "DOI": "10.1103/physrevb.110.245108", + "ISSN": "2469-9950, 2469-9969", + "abstractNote": "We present a Floquet Schrieffer-Wolff transform (FSWT) to obtain effective Floquet Hamiltonians and micromotion operators of periodically driven many-body systems for any nonresonant driving frequency. The FSWT perturbatively eliminates the oscillatory components in the driven Hamiltonian by solving operator-valued Sylvester equations with systematic approximations. It goes beyond various high-frequency expansion methods commonly used in Floquet theory, as we demonstrate with the example of the driven Fermi-Hubbard model. In the limit of high driving frequencies, the FSWT Hamiltonian reduces to the widely used Floquet-Magnus result. We anticipate this method will be useful for designing Rydberg multiqubit gates, controlling correlated hopping in quantum simulations in optical lattices, and describing multiorbital and long-range interacting systems driven in-gap. Published by the American Physical Society 2024", + "issue": "24", + "journalAbbreviation": "Phys. Rev. B", + "language": "en", + "libraryCatalog": "Crossref", + "publicationTitle": "Physical Review B", + "rights": "https://creativecommons.org/licenses/by/4.0/", + "url": "https://link.aps.org/doi/10.1103/PhysRevB.110.245108", + "volume": "110", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Crossref Unixref XML.js b/translators/Crossref Unixref XML.js new file mode 100644 index 0000000..e83cd70 --- /dev/null +++ b/translators/Crossref Unixref XML.js @@ -0,0 +1,965 @@ +{ + "translatorID": "93514073-b541-4e02-9180-c36d2f3bb401", + "label": "Crossref Unixref XML", + "creator": "Sebastian Karcher", + "target": "xml", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "configOptions": { + "dataMode": "xml/dom" + }, + "inRepository": true, + "translatorType": 1, + "lastUpdated": "2024-10-30 12:58:25" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2019 Sebastian Karcher + + 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 ***** +*/ + + +/* CrossRef uses unixref; documentation at https://data.crossref.org/reports/help/schema_doc/unixref1.1/unixref1.1.html */ + + +/** ******************** + * Utilitiy Functions * + **********************/ + +function innerXML(n) { + var escapedXMLcharacters = { + '&': '&', + '"': '"', + '<': '<', + '>': '>' + }; + return n.innerHTML // outer XML + .replace(/\n/g, "") + .replace(/("|<|>|&)/g, + function (str, item) { + return escapedXMLcharacters[item]; + } + ); +} + +var markupRE = /<(\/?)(\w+)[^<>]*>/gi; +var supportedMarkup = ['i', 'b', 'sub', 'sup', 'span', 'sc']; +var transformMarkup = { + scp: { + open: '', + close: '' + } +}; +function removeUnsupportedMarkup(text) { + return text.replace(//g, '$1') // Remove CDATA markup + .replace(markupRE, function (m, close, name) { + if (supportedMarkup.includes(name.toLowerCase())) { + return m; + } + + var newMarkup = transformMarkup[name.toLowerCase()]; + if (newMarkup) { + return close ? newMarkup.close : newMarkup.open; + } + + return ''; + }); +} + + +function fixAuthorCapitalization(string) { + // Try to use capitalization function from Zotero Utilities, + // because the current one doesn't support unicode names. + // Can't fix this either because ZU.XRegExp.replace is + // malfunctioning when calling from translators. + if (ZU.capitalizeName) return ZU.capitalizeName(string); + if (typeof string === "string" && string.toUpperCase() === string) { + string = string.toLowerCase().replace(/\b[a-z]/g, function (m) { + return m[0].toUpperCase(); + }); + } + return string; +} + +function parseCreators(node, item, typeOverrideMap) { + var contributors = ZU.xpath(node, 'contributors/organization | contributors/person_name'); + if (!contributors.length) { + contributors = ZU.xpath(node, 'organization | person_name'); + } + for (var contributor of contributors) { + var creatorXML = contributor; + var creator = {}; + + var role = creatorXML.getAttribute("contributor_role"); + if (typeOverrideMap && typeOverrideMap[role] !== undefined) { + creator.creatorType = typeOverrideMap[role]; + } + else if (role === "author" || role === "editor" || role === "translator") { + creator.creatorType = role; + } + else { + creator.creatorType = "contributor"; + } + + if (!creator.creatorType) continue; + + if (creatorXML.nodeName === "organization") { + creator.fieldMode = 1; + creator.lastName = creatorXML.textContent; + } + else if (creatorXML.nodeName === "person_name") { + creator.firstName = fixAuthorCapitalization(ZU.xpathText(creatorXML, 'given_name')); + creator.lastName = fixAuthorCapitalization(ZU.xpathText(creatorXML, 'surname')); + if (!creator.firstName) creator.fieldMode = 1; + } + item.creators.push(creator); + } +} + +function parseDate(pubDateNode) { + if (pubDateNode.length) { + var year = ZU.xpathText(pubDateNode[0], 'year'); + var month = ZU.xpathText(pubDateNode[0], 'month'); + var day = ZU.xpathText(pubDateNode[0], 'day'); + + if (year) { + if (month) { + if (day) { + return year + "-" + month + "-" + day; + } + else { + return month + "/" + year; + } + } + else { + return year; + } + } + else return null; + } + else return null; +} + + +function detectImport() { + var line; + var i = 0; + while ((line = Zotero.read()) !== false) { + if (line !== "") { + if (line.includes("")) { + return true; + } + else if (i++ > 7) { + return false; + } + } + } + return false; +} + + +function doImport() { + // XPath does not give us the ability to use the same XPaths regardless of whether or not + // there is a namespace, so we add an element to make sure that there will always be a + // namespace. + + var doc = Zotero.getXML(); + + var doiRecord = ZU.xpath(doc, "//doi_records/doi_record"); + // Z.debug(doiRecord.length) + // ensure this isn't an error + var errorString = ZU.xpathText(doiRecord, 'crossref/error'); + if (errorString !== null) { + throw errorString; + } + + var itemXML, item, refXML, metadataXML, seriesXML; + if ((itemXML = ZU.xpath(doiRecord, 'crossref/journal')).length) { + item = new Zotero.Item("journalArticle"); + refXML = ZU.xpath(itemXML, 'journal_article'); + metadataXML = ZU.xpath(itemXML, 'journal_metadata'); + + item.publicationTitle = ZU.xpathText(metadataXML, 'full_title[1]'); + item.journalAbbreviation = ZU.xpathText(metadataXML, 'abbrev_title[1]'); + item.volume = ZU.xpathText(itemXML, 'journal_issue/journal_volume/volume'); + item.issue = ZU.xpathText(itemXML, 'journal_issue/journal_volume/issue'); + // Sometimes the tag is not nested inside the volume tag; see 10.1007/BF00938486 + if (!item.issue) item.issue = ZU.xpathText(itemXML, 'journal_issue/issue'); + } + else if ((itemXML = ZU.xpath(doiRecord, 'crossref/report-paper')).length) { + // Report Paper + // Example: doi: 10.4271/2010-01-0907 + + item = new Zotero.Item("report"); + refXML = ZU.xpath(itemXML, 'report-paper_metadata'); + if (refXML.length === 0) { + // Example doi: 10.1787/5jzb6vwk338x-en + + refXML = ZU.xpath(itemXML, 'report-paper_series_metadata'); + seriesXML = ZU.xpath(refXML, 'series_metadata'); + } + metadataXML = refXML; + + item.reportNumber = ZU.xpathText(refXML, 'publisher_item/item_number'); + if (!item.reportNumber) item.reportNumber = ZU.xpathText(refXML, 'volume'); + item.institution = ZU.xpathText(refXML, 'publisher/publisher_name'); + item.place = ZU.xpathText(refXML, 'publisher/publisher_place'); + } + else if ((itemXML = ZU.xpath(doiRecord, 'crossref/book')).length) { + // Book chapter + // Example: doi: 10.1017/CCOL0521858429.016 + + // Reference book entry + // Example: doi: 10.1002/14651858.CD002966.pub3 + + // Entire edited book. This should _not_ be imported as bookSection + // Example: doi: 10.4135/9781446200957 + + var bookType = itemXML[0].hasAttribute("book_type") ? itemXML[0].getAttribute("book_type") : null; + var componentType = ZU.xpathText(itemXML[0], 'content_item/@component_type'); + // is this an entry in a reference book? + var isReference = (bookType == "reference" + && ["chapter", "reference_entry", "other"].includes(componentType)) + || (bookType == "other" + && ["chapter", "reference_entry"].includes(componentType)); + + // for items that are entry in reference books OR edited book types that have some type of a chapter entry. + if ((bookType === "edited_book" && componentType) || isReference) { + item = new Zotero.Item("bookSection"); + refXML = ZU.xpath(itemXML, 'content_item'); + + if (isReference) { + metadataXML = ZU.xpath(itemXML, 'book_metadata'); + if (!metadataXML.length) metadataXML = ZU.xpath(itemXML, 'book_series_metadata'); + // TODO: Check book_set_metadata here too, as we do below? + + item.bookTitle = ZU.xpathText(metadataXML, 'titles[1]/title[1]'); + item.seriesTitle = ZU.xpathText(metadataXML, 'series_metadata/titles[1]/title[1]'); + + var metadataSeriesXML = ZU.xpath(metadataXML, 'series_metadata'); + if (metadataSeriesXML.length) parseCreators(metadataSeriesXML, item, { editor: "seriesEditor" }); + } + else { + metadataXML = ZU.xpath(itemXML, 'book_series_metadata'); + if (!metadataXML.length) metadataXML = ZU.xpath(itemXML, 'book_metadata'); + item.bookTitle = ZU.xpathText(metadataXML, 'series_metadata/titles[1]/title[1]'); + if (!item.bookTitle) item.bookTitle = ZU.xpathText(metadataXML, 'titles[1]/title[1]'); + } + + // Handle book authors + parseCreators(metadataXML, item, { author: "bookAuthor" }); + // Book + } + else { + item = new Zotero.Item("book"); + refXML = ZU.xpath(itemXML, 'book_metadata'); + // Sometimes book data is in book_series_metadata + // doi: 10.1007/978-1-4419-9164-5 + + // And sometimes in book_set_metadata + // doi: 10.7551/mitpress/9780262533287.003.0006 + + if (!refXML.length) refXML = ZU.xpath(itemXML, 'book_series_metadata'); + if (!refXML.length) refXML = ZU.xpath(itemXML, 'book_set_metadata'); + metadataXML = refXML; + seriesXML = ZU.xpath(refXML, 'series_metadata'); + } + + item.place = ZU.xpathText(metadataXML, 'publisher/publisher_place'); + } + else if ((itemXML = ZU.xpath(doiRecord, 'crossref/standard')).length) { + item = new Zotero.Item('standard'); + refXML = ZU.xpath(itemXML, 'standard_metadata'); + metadataXML = ZU.xpath(itemXML, 'standard_metadata'); + } + else if ((itemXML = ZU.xpath(doiRecord, 'crossref/conference')).length) { + item = new Zotero.Item("conferencePaper"); + refXML = ZU.xpath(itemXML, 'conference_paper'); + metadataXML = ZU.xpath(itemXML, 'proceedings_metadata'); + seriesXML = ZU.xpath(metadataXML, 'proceedings_metadata'); + + item.publicationTitle = ZU.xpathText(metadataXML, 'proceedings_title'); + item.place = ZU.xpathText(itemXML, 'event_metadata/conference_location'); + item.conferenceName = ZU.xpathText(itemXML, 'event_metadata/conference_name'); + } + + else if ((itemXML = ZU.xpath(doiRecord, 'crossref/database')).length) { + item = new Zotero.Item('dataset'); + refXML = ZU.xpath(itemXML, 'dataset'); + metadataXML = ZU.xpath(itemXML, 'database_metadata'); + var pubDate = ZU.xpath(refXML, 'database_date/publication_date'); + if (!pubDate.length) pubDate = ZU.xpath(metadataXML, 'database_date/publication_date'); + item.date = parseDate(pubDate); + + if (!ZU.xpathText(refXML, 'contributors')) { + parseCreators(metadataXML, item); + } + if (!ZU.xpathText(metadataXML, 'publisher')) { + item.institution = ZU.xpathText(metadataXML, 'institution/institution_name'); + } + } + + else if ((itemXML = ZU.xpath(doiRecord, 'crossref/dissertation')).length) { + item = new Zotero.Item("thesis"); + item.date = parseDate(ZU.xpath(itemXML, "approval_date[1]")); + item.university = ZU.xpathText(itemXML, "institution/institution_name"); + item.place = ZU.xpathText(itemXML, "institution/institution_place"); + var type = ZU.xpathText(itemXML, "degree"); + if (type) item.thesisType = type.replace(/\(.+\)/, ""); + } + + else if ((itemXML = ZU.xpath(doiRecord, 'crossref/posted_content')).length) { + let type = ZU.xpathText(itemXML, "./@type"); + if (type == "preprint") { + item = new Zotero.Item("preprint"); + item.repository = ZU.xpathText(itemXML, "group_title"); + } + else { + item = new Zotero.Item("blogPost"); + item.blogTitle = ZU.xpathText(itemXML, "institution/institution_name"); + } + item.date = parseDate(ZU.xpath(itemXML, "posted_date")); + } + + else if ((itemXML = ZU.xpath(doiRecord, 'crossref/peer_review')).length) { + item = new Zotero.Item("manuscript"); // is this the best category + item.date = parseDate(ZU.xpath(itemXML, "reviewed_date")); + if (ZU.xpath(itemXML, "/contributors/anonymous")) { + item.creators.push({ lastName: "Anonymous Reviewer", fieldMode: 1, creatorType: "author" }); + } + item.type = "peer review"; + var reviewOf = ZU.xpathText(itemXML, "//related_item/inter_work_relation"); + if (reviewOf) { + var identifierType = ZU.xpathText(itemXML, "//related_item/inter_work_relation/@identifier-type"); + var identifier; + if (identifierType == "doi") { + identifier = "https://doi.org/" + reviewOf + ""; + } + else if (identifierType == "url") { + identifier = "" + reviewOf + ""; + } + else { + identifier = reviewOf; + } + var noteText = "Review of " + identifier; + // Z.debug(noteText); + item.notes.push(noteText); + } + } + + else { + item = new Zotero.Item("document"); + } + + + if (!refXML || !refXML.length) { + refXML = itemXML; + } + + if (!metadataXML || !metadataXML.length) { + metadataXML = refXML; + } + + item.abstractNote = ZU.xpathText(refXML, 'description|abstract'); + item.language = ZU.xpathText(metadataXML, './@language'); + item.ISBN = ZU.xpathText(metadataXML, 'isbn'); + item.ISSN = ZU.xpathText(metadataXML, 'issn'); + item.publisher = ZU.xpathText(metadataXML, 'publisher/publisher_name'); + + item.edition = ZU.xpathText(metadataXML, 'edition_number'); + if (!item.volume) item.volume = ZU.xpathText(metadataXML, 'volume'); + + + parseCreators(refXML, item, (item.itemType == 'bookSection' ? { editor: null } : "author")); + + if (seriesXML && seriesXML.length) { + parseCreators(seriesXML, item, { editor: "seriesEditor" }); + item.series = ZU.xpathText(seriesXML, 'titles[1]/title[1]'); + item.seriesNumber = ZU.xpathText(seriesXML, 'series_number'); + item.reportType = ZU.xpathText(seriesXML, 'titles[1]/title[1]'); + } + // prefer article to journal metadata and print to other dates + var pubDateNode = ZU.xpath(refXML, 'publication_date[@media_type="print"]'); + if (!pubDateNode.length) pubDateNode = ZU.xpath(refXML, 'publication_date'); + if (!pubDateNode.length) pubDateNode = ZU.xpath(metadataXML, 'publication_date[@media_type="print"]'); + if (!pubDateNode.length) pubDateNode = ZU.xpath(metadataXML, 'publication_date'); + + + if (pubDateNode.length) { + item.date = parseDate(pubDateNode); + } + + var pages = ZU.xpath(refXML, 'pages[1]'); + if (pages.length) { + item.pages = ZU.xpathText(pages, 'first_page[1]'); + var lastPage = ZU.xpathText(pages, 'last_page[1]'); + if (lastPage) item.pages += "-" + lastPage; + } + else { + // use article Number instead + item.pages = ZU.xpathText(refXML, 'publisher_item/item_number'); + } + + item.DOI = ZU.xpathText(refXML, 'doi_data/doi'); + // add DOI to extra for unsupprted items + if (item.DOI && !ZU.fieldIsValidForType("DOI", item.itemType)) { + if (item.extra) { + item.extra += "\nDOI: " + item.DOI; + } + else { + item.extra = "DOI: " + item.DOI; + } + } + // I think grabbing the first license will usually make the most sense; + // not sure how many different options they are and how well labelled they are + item.rights = ZU.xpathText(refXML, 'program/license_ref[1]'); + item.url = ZU.xpathText(refXML, 'doi_data/resource'); + var title = ZU.xpath(refXML, 'titles[1]/title[1]')[0]; + if (!title && metadataXML) { + title = ZU.xpath(metadataXML, 'titles[1]/title[1]')[0]; + } + if (title) { + item.title = ZU.trimInternal( + removeUnsupportedMarkup(innerXML(title)) + ); + var subtitle = ZU.xpath(refXML, 'titles[1]/subtitle[1]')[0]; + if (subtitle) { + item.title = item.title.replace(/:$/, '') + ': ' + ZU.trimInternal( + removeUnsupportedMarkup(innerXML(subtitle)) + ); + } + item.title = item.title.replace(/\s+<(sub|sup)>/g, "<$1>"); + } + if (!item.title || item.title == "") { + item.title = "[No title found]"; + } + // Zotero.debug(JSON.stringify(item, null, 4)); + + // Check if there are potential issues with character encoding and try to fix them. + // E.g., in 10.1057/9780230391116.0016, the en dash in the title is displayed as â<80><93>, + // which is what you get if you decode a UTF-8 en dash (<80><93>) as Latin-1 and then serve + // as UTF-8 ( <80> <93>) + for (var field in item) { + if (typeof item[field] != 'string') continue; + // Check for control characters that should never be in strings from Crossref + if (/[\u007F-\u009F]/.test(item[field])) { + // <80><93> -> %E2%80%93 -> en dash + try { + item[field] = decodeURIComponent(escape(item[field])); + } + // If decoding failed, just strip control characters + // https://forums.zotero.org/discussion/102271/lookup-failed-for-doi + catch (e) { + item[field] = item[field].replace(/[\u0000-\u001F\u007F-\u009F]/g, ""); + } + } + } + item.complete(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "import", + "input": "\n\n \n \n \n \n 2017 IEEE International Solid- State Circuits Conference - (ISSCC)\n San Francisco, CA, USA\n \n \n \n 2017 IEEE International Solid-State Circuits Conference (ISSCC)\n \n IEEE\n \n \n 2\n 2017\n \n 978-1-5090-3758-2\n \n \n \n \n Pen-Jui\n Peng\n \n \n Jeng-Feng\n Li\n \n \n Li-Yang\n Chen\n \n \n Jri\n Lee\n \n \n \n 6.1 A 56Gb/s PAM-4/NRZ transceiver in 40nm CMOS\n \n \n 2\n 2017\n \n \n 110\n 111\n \n \n 7870285\n \n \n 10.1109/ISSCC.2017.7870285\n http://ieeexplore.ieee.org/document/7870285/\n \n \n http://xplorestaging.ieee.org/ielx7/7866667/7870233/07870285.pdf?arnumber=7870285\n \n \n \n \n \n \n \n\n", + "items": [ + { + "itemType": "conferencePaper", + "title": "6.1 A 56Gb/s PAM-4/NRZ transceiver in 40nm CMOS", + "creators": [ + { + "creatorType": "author", + "firstName": "Pen-Jui", + "lastName": "Peng" + }, + { + "creatorType": "author", + "firstName": "Jeng-Feng", + "lastName": "Li" + }, + { + "creatorType": "author", + "firstName": "Li-Yang", + "lastName": "Chen" + }, + { + "creatorType": "author", + "firstName": "Jri", + "lastName": "Lee" + } + ], + "date": "2/2017", + "DOI": "10.1109/ISSCC.2017.7870285", + "ISBN": "978-1-5090-3758-2", + "conferenceName": "2017 IEEE International Solid- State Circuits Conference - (ISSCC)", + "pages": "110-111", + "place": "San Francisco, CA, USA", + "proceedingsTitle": "2017 IEEE International Solid-State Circuits Conference (ISSCC)", + "publisher": "IEEE", + "url": "http://ieeexplore.ieee.org/document/7870285/", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "import", + "input": "\n \n \n \n \n FEMS Microbiology Ecology\n FEMS Microbiol Ecol\n 01686496\n \n \n \n 04\n 2013\n \n \n 84\n \n 1\n \n \n \n Microbial community\n changes at a terrestrial volcanic CO\n <sub>2</sub>\n vent induced by soil acidification and anaerobic microhabitats within the soil column\n \n \n \n \n Janin\n Frerichs\n Federal Institute for Geosciences and Natural Resources (BGR); Hannover; Germany\n \n \n Birte I.\n Oppermann\n Institute of Biogeochemistry and Marine Chemistry; University of Hamburg; Hamburg; Germany\n \n \n Simone\n Gwosdz\n Federal Institute for Geosciences and Natural Resources (BGR); Hannover; Germany\n \n \n Ingo\n Möller\n Federal Institute for Geosciences and Natural Resources (BGR); Hannover; Germany\n \n \n Martina\n Herrmann\n Institute of Ecology, Limnology/Aquatic Geomicrobiology Working Group; Friedrich Schiller University of Jena; Jena; Germany\n \n \n Martin\n Krüger\n Federal Institute for Geosciences and Natural Resources (BGR); Hannover; Germany\n \n \n \n 04\n 2013\n \n \n 12\n 10\n 2012\n \n \n 60\n 74\n \n \n 10.1111/1574-6941.12040\n https://academic.oup.com/femsec/article-lookup/doi/10.1111/1574-6941.12040\n \n \n http://academic.oup.com/femsec/article-pdf/84/1/60/19537307/84-1-60.pdf\n \n \n \n \n \n \n \n\n", + "items": [ + { + "itemType": "journalArticle", + "title": "Microbial community changes at a terrestrial volcanic CO 2 vent induced by soil acidification and anaerobic microhabitats within the soil column", + "creators": [ + { + "creatorType": "author", + "firstName": "Janin", + "lastName": "Frerichs" + }, + { + "creatorType": "author", + "firstName": "Birte I.", + "lastName": "Oppermann" + }, + { + "creatorType": "author", + "firstName": "Simone", + "lastName": "Gwosdz" + }, + { + "creatorType": "author", + "firstName": "Ingo", + "lastName": "Möller" + }, + { + "creatorType": "author", + "firstName": "Martina", + "lastName": "Herrmann" + }, + { + "creatorType": "author", + "firstName": "Martin", + "lastName": "Krüger" + } + ], + "date": "04/2013", + "DOI": "10.1111/1574-6941.12040", + "ISSN": "01686496", + "issue": "1", + "journalAbbreviation": "FEMS Microbiol Ecol", + "language": "en", + "pages": "60-74", + "publicationTitle": "FEMS Microbiology Ecology", + "url": "https://academic.oup.com/femsec/article-lookup/doi/10.1111/1574-6941.12040", + "volume": "84", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "import", + "input": "\n\n \n \n \n \n Eurasian Geography and Economics\n Eurasian Geography and Economics\n 1538-7216\n 1938-2863\n \n \n \n 05\n 15\n 2013\n \n \n 03\n 2009\n \n \n 50\n \n 2\n \n \n \n \n The Chinese\n <i>Hukou</i>\n System at 50\n \n \n \n \n Kam Wing\n Chan\n a University of Washington\n \n \n \n 05\n 15\n 2013\n \n \n 03\n 2009\n \n \n 197\n 221\n \n \n 5\n 10.2747/1539-7216.50.2.197\n \n \n 10.2747/1539-7216.50.2.197\n https://www.tandfonline.com/doi/full/10.2747/1539-7216.50.2.197\n \n \n https://www.tandfonline.com/doi/pdf/10.2747/1539-7216.50.2.197\n \n \n http://bellwether.metapress.com/index/10.2747/1539-7216.50.2.197\n \n \n \n \n \n \n \n\n", + "items": [ + { + "itemType": "journalArticle", + "title": "The Chinese Hukou System at 50", + "creators": [ + { + "creatorType": "author", + "firstName": "Kam Wing", + "lastName": "Chan" + } + ], + "date": "03/2009", + "DOI": "10.2747/1539-7216.50.2.197", + "ISSN": "1538-7216, 1938-2863", + "issue": "2", + "journalAbbreviation": "Eurasian Geography and Economics", + "language": "en", + "pages": "197-221", + "publicationTitle": "Eurasian Geography and Economics", + "url": "https://www.tandfonline.com/doi/full/10.2747/1539-7216.50.2.197", + "volume": "50", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "import", + "input": "\n\n \n \n \n \n Joseph Emil\n Kasper\n State University of Iowa\n \n \n Contributions to geomagnetic theory\n \n \n 01\n 1958\n \n \n State University of Iowa\n UIowa\n SUI\n Iowa City, Iowa, USA\n Physics\n \n PhD (Doctor of Philosophy)\n \n 10.17077/etd.xnw0xnau\n https://ir.uiowa.edu/etd/4529\n \n \n \n \n\n", + "items": [ + { + "itemType": "thesis", + "title": "Contributions to geomagnetic theory", + "creators": [ + { + "creatorType": "author", + "firstName": "Joseph Emil", + "lastName": "Kasper" + } + ], + "date": "01/1958", + "extra": "DOI: 10.17077/etd.xnw0xnau", + "language": "en", + "place": "Iowa City, Iowa, USA", + "thesisType": "PhD", + "university": "State University of Iowa", + "url": "https://ir.uiowa.edu/etd/4529", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "import", + "input": "\n\n \n \n \n Open Science Framework\n \n \n Steve\n Haroz\n \n \n \n Open Practices in Visualization Research\n \n \n 07\n 03\n 2018\n \n osf.io/8ag3w\n \n

    Two fundamental tenants of scientific research are that it can be scrutinized and built-upon. Both require that the collected data and supporting materials be shared, so others can examine, reuse, and extend them. Assessing the accessibility of these components and the paper itself can serve as a proxy for the reliability, replicability, and applicability of a field’s research. In this paper, I describe the current state of openness in visualization research and provide suggestions for authors, reviewers, and editors to improve open practices in the field. A free copy of this paper, the collected data, and the source code are available at https://osf.io/qf9na/

    \n
    \n \n https://creativecommons.org/licenses/by/4.0/legalcode\n \n \n 10.31219/osf.io/8ag3w\n https://osf.io/8ag3w\n \n
    \n
    \n
    \n
    \n", + "items": [ + { + "itemType": "preprint", + "title": "Open Practices in Visualization Research", + "creators": [ + { + "creatorType": "author", + "firstName": "Steve", + "lastName": "Haroz" + } + ], + "date": "2018-07-03", + "DOI": "10.31219/osf.io/8ag3w", + "abstractNote": "Two fundamental tenants of scientific research are that it can be scrutinized and built-upon. Both require that the collected data and supporting materials be shared, so others can examine, reuse, and extend them. Assessing the accessibility of these components and the paper itself can serve as a proxy for the reliability, replicability, and applicability of a field’s research. In this paper, I describe the current state of openness in visualization research and provide suggestions for authors, reviewers, and editors to improve open practices in the field. A free copy of this paper, the collected data, and the source code are available at https://osf.io/qf9na/", + "repository": "Open Science Framework", + "rights": "https://creativecommons.org/licenses/by/4.0/legalcode", + "url": "https://osf.io/8ag3w", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "import", + "input": "\n\n \n \n \n \n \n \n \n Report on 1607.01285v1\n \n \n 09\n 08\n 2016\n \n \n \n Report on 1607.01285v1\n 10.21468/SciPostPhys.1.1.010\n \n \n \n 10.21468/SciPost.Report.10\n https://scipost.org/SciPost.Report.10\n \n \n \n \n\n", + "items": [ + { + "itemType": "manuscript", + "title": "Report on 1607.01285v1", + "creators": [ + { + "lastName": "Anonymous Reviewer", + "fieldMode": 1, + "creatorType": "author" + } + ], + "extra": "DOI: 10.21468/SciPost.Report.10", + "manuscriptType": "peer review", + "url": "https://scipost.org/SciPost.Report.10", + "attachments": [], + "tags": [], + "notes": [ + "Review of https://doi.org/10.21468/SciPostPhys.1.1.010" + ], + "seeAlso": [] + } + ] + }, + { + "type": "import", + "input": " Chicago Journal of Theoretical Computer Science Chicago J. of Theoretical Comp. Sci. CJTCS 1073-0486 CJTCS 10.4086/cjtcs http://cjtcs.cs.uchicago.edu/ 2012 18 1 10.4086/cjtcs.2012.v018 http://cjtcs.cs.uchicago.edu/articles/2012/contents.html </titles> <contributors> <person_name sequence=\"first\" contributor_role=\"author\"> <given_name>Michael</given_name> <surname>Hoffman</surname> </person_name> <person_name sequence=\"additional\" contributor_role=\"author\"> <given_name>Jiri</given_name> <surname>Matousek</surname> </person_name> <person_name sequence=\"additional\" contributor_role=\"author\"> <given_name>Yoshio</given_name> <surname>Okamoto</surname> </person_name> <person_name sequence=\"additional\" contributor_role=\"author\"> <given_name>Phillipp</given_name> <surname>Zumstein</surname> </person_name> </contributors> <publication_date media_type=\"online\"> <year>2012</year> </publication_date> <pages> <first_page>1</first_page> <last_page>10</last_page> </pages> <doi_data> <doi>10.4086/cjtcs.2012.002</doi> <resource>http://cjtcs.cs.uchicago.edu/articles/2012/2/contents.html</resource> </doi_data> </journal_article> </journal> </crossref> </doi_record> </doi_records>", + "items": [ + { + "itemType": "journalArticle", + "title": "[No title found]", + "creators": [ + { + "creatorType": "author", + "firstName": "Michael", + "lastName": "Hoffman" + }, + { + "creatorType": "author", + "firstName": "Jiri", + "lastName": "Matousek" + }, + { + "creatorType": "author", + "firstName": "Yoshio", + "lastName": "Okamoto" + }, + { + "creatorType": "author", + "firstName": "Phillipp", + "lastName": "Zumstein" + } + ], + "date": "2012", + "DOI": "10.4086/cjtcs.2012.002", + "ISSN": "1073-0486", + "issue": "1", + "journalAbbreviation": "Chicago J. of Theoretical Comp. Sci.", + "language": "en", + "pages": "1-10", + "publicationTitle": "Chicago Journal of Theoretical Computer Science", + "url": "http://cjtcs.cs.uchicago.edu/articles/2012/2/contents.html", + "volume": "18", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "import", + "input": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<doi_records>\n <doi_record owner=\"10.1002\" timestamp=\"2020-10-06 16:52:28\">\n <crossref>\n <book book_type=\"reference\">\n <book_metadata language=\"en\">\n <contributors>\n <person_name contributor_role=\"editor\" sequence=\"first\">\n <given_name>Jan</given_name>\n <surname>Bulck</surname>\n </person_name>\n </contributors>\n <titles>\n <title>The International Encyclopedia of Media Psychology\n \n 1\n \n 09\n 08\n 2020\n \n 9781119011071\n \n Wiley\n \n \n 10.1002/9781119011071\n \n \n http://doi.wiley.com/10.1002/tdm_license_1.1\n \n \n 10.1002/9781119011071\n 2020100613475700320\n https://onlinelibrary.wiley.com/doi/book/10.1002/9781119011071\n \n \n \n \n \n Allison\n Eden\n \n \n \n Appreciation and Eudaimonic Reactions to Media\n \n \n 09\n 09\n 2020\n \n \n 1\n 9\n \n \n 10.1002/9781119011071.iemp0172\n \n \n \n \n \n http://doi.wiley.com/10.1002/tdm_license_1.1\n \n \n 10.1002/9781119011071.iemp0172\n 2020100613475700320\n https://onlinelibrary.wiley.com/doi/10.1002/9781119011071.iemp0172\n \n \n https://onlinelibrary.wiley.com/doi/pdf/10.1002/9781119011071.iemp0172\n \n \n \n \n https://onlinelibrary.wiley.com/doi/pdf/10.1002/9781119011071.iemp0172\n \n \n https://onlinelibrary.wiley.com/doi/full-xml/10.1002/9781119011071.iemp0172\n \n \n \n \n \n 10.1080/15213269.2016.1182030\n \n \n 10.1080/23736992.2017.1329019\n \n \n 10.1111/jcom.12228\n \n \n 10.1080/10510974.2017.1340903\n \n \n 10.1111/jcom.12101\n \n \n 10.1080/15205436.2013.872277\n \n \n 10.1111/j.1468-2958.2009.01368.x\n \n \n 10.1027/1864-1105/a000029\n \n \n 10.1037/ppm0000066\n \n \n 10.1111/j.1460-2466.2011.01585.x\n \n \n The role of intuition accessibility on the appraisal and selection of media content\n Prabhu S.\n 2014\n \n \n 10.1080/15213269.2013.773494\n \n \n 10.1111/j.1460-2466.2012.01649.x\n \n \n 10.1111/jcom.12099\n \n \n 10.1111/jcom.12097\n \n \n 10.1111/jcom.12100\n \n \n 10.1027/1864-1105/a000031\n \n \n Sage handbook of media processes and effects\n Vorderer P.\n 455\n 2009\n \n \n 10.1111/j.1468-2958.2012.01434.x\n \n \n 10.1177/000276488031003005\n \n \n 10.1080/15213260701813447\n \n \n Thinking, fast and slow\n Kahneman D.\n 2011\n \n \n 10.1093/joc/jqx020\n \n \n \n \n \n \n", + "items": [ + { + "itemType": "bookSection", + "title": "Appreciation and Eudaimonic Reactions to Media", + "creators": [ + { + "creatorType": "editor", + "firstName": "Jan", + "lastName": "Bulck" + }, + { + "creatorType": "author", + "firstName": "Allison", + "lastName": "Eden" + } + ], + "date": "2020-09-09", + "ISBN": "9781119011071", + "bookTitle": "The International Encyclopedia of Media Psychology", + "edition": "1", + "extra": "DOI: 10.1002/9781119011071.iemp0172", + "language": "en", + "pages": "1-9", + "publisher": "Wiley", + "rights": "http://doi.wiley.com/10.1002/tdm_license_1.1", + "url": "https://onlinelibrary.wiley.com/doi/10.1002/9781119011071.iemp0172", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "import", + "input": "\n\n \n \n \n \n D-Lib Magazine\n D-Lib Magazine\n 1082-9873\n \n 10.1045/dlib.magazine\n http://www.dlib.org/\n \n \n \n \n 05\n 2016\n \n \n 22\n \n 5/6\n \n 10.1045/may2016-contents\n http://www.dlib.org/dlib/may16/05contents.html\n \n \n \n \n Scientific Stewardship in the Open Data and Big Data Era — Roles and Responsibilities of Stewards and Other Major Product Stakeholders\n \n \n \n Ge\n Peng\n \n \n Nancy A.\n Ritchey\n \n \n Kenneth S.\n Casey\n \n \n Edward J.\n Kearns\n \n \n Jeffrey L.\n Prevette\n \n \n Drew\n Saunders\n \n \n Philip\n Jones\n \n \n Tom\n Maycock\n \n \n Steve\n Ansari\n \n \n \n 05\n 2016\n \n \n 10.1045/may2016-peng\n http://www.dlib.org/dlib/may16/peng/05peng.html\n \n \n \n \n \n", + "items": [ + { + "itemType": "journalArticle", + "title": "Scientific Stewardship in the Open Data and Big Data Era Roles and Responsibilities of Stewards and Other Major Product Stakeholders", + "creators": [ + { + "creatorType": "author", + "firstName": "Ge", + "lastName": "Peng" + }, + { + "creatorType": "author", + "firstName": "Nancy A.", + "lastName": "Ritchey" + }, + { + "creatorType": "author", + "firstName": "Kenneth S.", + "lastName": "Casey" + }, + { + "creatorType": "author", + "firstName": "Edward J.", + "lastName": "Kearns" + }, + { + "creatorType": "author", + "firstName": "Jeffrey L.", + "lastName": "Prevette" + }, + { + "creatorType": "author", + "firstName": "Drew", + "lastName": "Saunders" + }, + { + "creatorType": "author", + "firstName": "Philip", + "lastName": "Jones" + }, + { + "creatorType": "author", + "firstName": "Tom", + "lastName": "Maycock" + }, + { + "creatorType": "author", + "firstName": "Steve", + "lastName": "Ansari" + } + ], + "date": "05/2016", + "DOI": "10.1045/may2016-peng", + "ISSN": "1082-9873", + "issue": "5/6", + "journalAbbreviation": "D-Lib Magazine", + "language": "en", + "publicationTitle": "D-Lib Magazine", + "url": "http://www.dlib.org/dlib/may16/peng/05peng.html", + "volume": "22", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "import", + "input": "\n\n\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\tJournal of Hospitality & Leisure Marketing\n\t\t\t\t\tJournal of Hospitality & Leisure Marketing\n\t\t\t\t\t1050-7051\n\t\t\t\t\t1541-0897\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t10\n\t\t\t\t\t\t25\n\t\t\t\t\t\t2008\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t05\n\t\t\t\t\t\t10\n\t\t\t\t\t\t1996\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t3\n\t\t\t\t\t\n\t\t\t\t\t4\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\tService Value Determination:\n\t\t\t\t\t\tAn Integrative Perspective\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tRama K.\n\t\t\t\t\t\t\tJayanti\n\t\t\t\t\t\t\ta Department of Marketing, James J. Nance College of Business, Cleveland State\n\t\t\t\t\t\t\t\tUniversity, Cleveland, OH, 44115\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tAmit K.\n\t\t\t\t\t\t\tGhosh\n\t\t\t\t\t\t\ta Department of Marketing, James J. Nance College of Business, Cleveland State\n\t\t\t\t\t\t\t\tUniversity, Cleveland, OH, 44115\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t10\n\t\t\t\t\t\t25\n\t\t\t\t\t\t2008\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t05\n\t\t\t\t\t\t10\n\t\t\t\t\t\t1996\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t5\n\t\t\t\t\t\t25\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t2\n\t\t\t\t\t\t10.1300/J150v03n04_02\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t10.1300/J150v03n04_02\n\t\t\t\t\t\thttps://www.tandfonline.com/doi/full/10.1300/J150v03n04_02\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\thttps://www.tandfonline.com/doi/pdf/10.1300/J150v03n04_02\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t\n", + "items": [ + { + "itemType": "journalArticle", + "title": "Service Value Determination: An Integrative Perspective", + "creators": [ + { + "creatorType": "author", + "firstName": "Rama K.", + "lastName": "Jayanti" + }, + { + "creatorType": "author", + "firstName": "Amit K.", + "lastName": "Ghosh" + } + ], + "date": "1996-05-10", + "DOI": "10.1300/J150v03n04_02", + "ISSN": "1050-7051, 1541-0897", + "issue": "4", + "journalAbbreviation": "Journal of Hospitality & Leisure Marketing", + "language": "en", + "pages": "5-25", + "publicationTitle": "Journal of Hospitality & Leisure Marketing", + "url": "https://www.tandfonline.com/doi/full/10.1300/J150v03n04_02", + "volume": "3", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "import", + "input": "\r\n \r\n \r\n \r\n Social sciences\r\n \r\n \r\n Sebastian\r\n Karcher\r\n \r\n \r\n \r\n QDR Creates New Course on Data Management for CITI\r\n \r\n \r\n 3\r\n 31\r\n 2023\r\n \r\n \r\n QDR Blog\r\n \r\n e1574118b63a40b0b56a605bf5e99c48\r\n \r\n https://creativecommons.org/licenses/by/4.0/legalcode\r\n https://creativecommons.org/licenses/by/4.0/legalcode\r\n \r\n \r\n 10.59350/5znft-x4j11\r\n https://qdr.syr.edu/qdr-blog/qdr-creates-new-course-data-management-citi\r\n \r\n \r\n https://qdr.syr.edu/qdr-blog/qdr-creates-new-course-data-management-citi\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", + "items": [ + { + "itemType": "blogPost", + "title": "QDR Creates New Course on Data Management for CITI", + "creators": [ + { + "creatorType": "author", + "firstName": "Sebastian", + "lastName": "Karcher" + } + ], + "date": "2023-3-31", + "blogTitle": "QDR Blog", + "extra": "DOI: 10.59350/5znft-x4j11", + "language": "en", + "rights": "https://creativecommons.org/licenses/by/4.0/legalcode", + "url": "https://qdr.syr.edu/qdr-blog/qdr-creates-new-course-data-management-citi", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "import", + "input": "\n\n \n \n \n \n Industrial & Engineering Chemistry Research\n Ind. Eng. Chem. Res.\n 0888-5885\n 1520-5045\n \n \n \n \n Investigation of CO\n <sub>2</sub>\n Reduction to Formate in an Industrial-Scale Electrochemical Cell through Transient Numerical Modeling\n \n \n \n \n Mohammad\n Bahreini\n Department of Chemical Engineering and Biotechnological Engineering, Université de Sherbrooke, 2500 Boulevard de L’Université, Sherbrooke, QC J1K 2R1, Canada\n https://orcid.org/0009-0006-7234-5157\n \n \n Martin\n Désilets\n Department of Chemical Engineering and Biotechnological Engineering, Université de Sherbrooke, 2500 Boulevard de L’Université, Sherbrooke, QC J1K 2R1, Canada\n \n \n Ergys\n Pahija\n Department of Chemical Engineering and Biotechnological Engineering, Université de Sherbrooke, 2500 Boulevard de L’Université, Sherbrooke, QC J1K 2R1, Canada\n https://orcid.org/0000-0003-0859-6489\n \n \n Ulrich\n Legrand\n Electro Carbon, 3275 Chemin de l’Industrie, St-Mathieu-de-Beloeil, QC J3G 0M8, Canada\n Department of Chemical Engineering, Polytechnique Montreal, 2500 Chem. de Polytechnique, Montréal, QC H3T 1J4 ,Canada\n \n \n Jiaxun\n Guo\n Electro Carbon, 3275 Chemin de l’Industrie, St-Mathieu-de-Beloeil, QC J3G 0M8, Canada\n \n \n Arthur G.\n Fink\n Electro Carbon, 3275 Chemin de l’Industrie, St-Mathieu-de-Beloeil, QC J3G 0M8, Canada\n \n \n \n 10\n 14\n 2024\n \n \n acs.iecr.4c03239\n 10.1021/acs.iecr.4c03239\n \n \n \n \n Natural Sciences and Engineering Research Council of Canada\n http://dx.doi.org/10.13039/501100000038\n \n ALLRP 580893 - 22\n \n \n \n Mitacs\n http://dx.doi.org/10.13039/501100004489\n \n \n \n electro carbon Inc\n \n \n \n https://doi.org/10.15223/policy-029\n https://doi.org/10.15223/policy-037\n https://doi.org/10.15223/policy-045\n \n \n 10.1021/acs.iecr.4c03239\n https://pubs.acs.org/doi/10.1021/acs.iecr.4c03239\n \n \n https://pubs.acs.org/doi/pdf/10.1021/acs.iecr.4c03239\n \n \n \n \n https://pubs.acs.org/doi/pdf/10.1021/acs.iecr.4c03239\n \n \n \n \n \n 10.1021/acs.iecr.1c01316\n \n \n Advances in carbon capture\n Yoro K. O.\n 3\n 2020\n 10.1016/B978-0-12-819657-1.00001-3\n \n \n 10.1016/j.apcatb.2015.04.055\n \n \n 10.1039/C8EE00097B\n \n \n 10.1002/cssc.201600394\n \n \n 10.1016/j.cej.2022.139663\n \n \n 10.1016/B978-0-12-820244-9.00001-9\n \n Reichle, D. E.\n The global carbon cycle and climate change\n ; Elsevier, 2019, 1, 388.\n \n \n \n 10.1149/2.0741713jes\n \n \n 10.1016/j.apcatb.2021.120447\n \n \n 10.1016/j.jcat.2015.11.014\n \n \n 10.1021/acsenergylett.3c00489\n \n \n 10.1016/j.seppur.2023.123811\n \n \n 10.1021/acssuschemeng.0c05215\n \n \n 10.1002/cctc.202300977\n \n \n 10.1016/j.cej.2024.148972\n \n \n 10.1038/s41560-021-00973-9\n \n \n 10.1016/j.joule.2020.03.013\n \n \n 10.1039/D2TA02086F\n \n \n 10.1039/C8CP01319E\n \n \n 10.1039/D0CS00230E\n \n \n 10.1021/acscatal.1c02783\n \n \n 10.1016/S0022-0728(01)00729-X\n \n \n 10.1021/acs.accounts.8b00010\n \n \n 10.1016/j.jcou.2019.02.007\n \n \n 10.1021/acssuschemeng.2c06129\n \n \n 10.1016/j.isci.2022.104011\n \n \n 10.1021/accountsmr.1c00004\n \n \n 10.1016/j.matre.2023.100177\n \n \n 10.1016/j.joule.2019.07.009\n \n \n 10.1016/j.renene.2022.01.085\n \n \n 10.1016/j.matre.2023.100177\n \n \n 10.1016/j.xpro.2021.100889\n \n \n 10.3389/fenrg.2020.00005\n \n \n 10.1002/elsa.202100160\n \n \n 10.1016/j.joule.2019.07.021\n \n \n 10.1016/j.xcrp.2021.100522\n \n \n 10.1021/acs.iecr.0c02358\n \n \n 10.1021/acssuschemeng.0c07694\n \n \n 10.1021/acssuschemeng.0c07387\n \n \n 10.1016/j.ijhydene.2011.12.148\n \n \n 10.1021/acsenergylett.0c02184\n \n \n 10.1016/j.electacta.2018.02.100\n \n \n 10.1016/j.jpowsour.2016.02.043\n \n \n 10.1016/j.jpowsour.2022.230998\n \n \n 10.1016/j.matre.2023.100194\n \n \n Legrand, U. Electrochemical cell for carbon dioxide reduction towards liquid chemicals. Google Patents: 2023.\n \n \n 10.1016/j.electacta.2021.138987\n \n \n 10.1073/pnas.1713164114\n \n \n 10.1016/j.marchem.2005.11.001\n \n \n Elements of chemical reaction engineering\n Fogler H. S.\n 2020\n \n \n Chemical kinetics and reaction dynamics\n Houston P. L.\n 2012\n \n \n 10.1017/S0022112067001375\n \n \n 10.1016/j.coche.2016.02.006\n \n \n Multicomponent mass transfer\n Taylor R.\n 1993\n \n \n Chemically reacting flow: theory, modeling, and simulation\n Kee R. J.\n 2017\n 10.1002/9781119186304\n \n \n Fundamentals of momentum, heat, and mass transfer\n Welty J.\n 2020\n \n \n 10.1039/D1SC05743J\n \n \n 10.1002/cssc.201600693\n \n \n \n \n \n Investigation of CO2 Reduction to Formate in an Industrial-Scale Electrochemical Cell through Transient Numerical Modeling\n \n Supplemental Information for 10.1021/acs.iecr.4c03239\n \n \n 10.1021/acs.iecr.4c03239.s001\n https://pubs.acs.org/doi/suppl/10.1021/acs.iecr.4c03239/suppl_file/ie4c03239_si_001.pdf\n \n \n \n \n \n \n \n", + "items": [ + { + "itemType": "journalArticle", + "title": "Investigation of CO2 Reduction to Formate in an Industrial-Scale Electrochemical Cell through Transient Numerical Modeling", + "creators": [ + { + "creatorType": "author", + "firstName": "Mohammad", + "lastName": "Bahreini" + }, + { + "creatorType": "author", + "firstName": "Martin", + "lastName": "Désilets" + }, + { + "creatorType": "author", + "firstName": "Ergys", + "lastName": "Pahija" + }, + { + "creatorType": "author", + "firstName": "Ulrich", + "lastName": "Legrand" + }, + { + "creatorType": "author", + "firstName": "Jiaxun", + "lastName": "Guo" + }, + { + "creatorType": "author", + "firstName": "Arthur G.", + "lastName": "Fink" + } + ], + "date": "2024-10-14", + "DOI": "10.1021/acs.iecr.4c03239", + "ISSN": "0888-5885, 1520-5045", + "journalAbbreviation": "Ind. Eng. Chem. Res.", + "language": "en", + "pages": "acs.iecr.4c03239", + "publicationTitle": "Industrial & Engineering Chemistry Research", + "rights": "https://doi.org/10.15223/policy-029", + "url": "https://pubs.acs.org/doi/10.1021/acs.iecr.4c03239", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/Current Affairs.js b/translators/Current Affairs.js new file mode 100644 index 0000000..0766f4a --- /dev/null +++ b/translators/Current Affairs.js @@ -0,0 +1,160 @@ +{ + "translatorID": "f16f8542-9038-492d-8669-7ffe40869294", + "label": "Current Affairs", + "creator": "Abe Jellinek", + "target": "^https?://www\\.currentaffairs\\.org/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-08-07 00:42:35" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (doc.querySelector('h1.title') && doc.querySelector('.primary')) { + return "magazineArticle"; + } + // search just redirects to DuckDuckGo + return false; +} + +function doWeb(doc, url) { + scrape(doc, url); +} + +function scrape(doc, url) { + let item = new Zotero.Item('magazineArticle'); + + item.title = text(doc, 'h1.title'); + item.abstractNote = ZU.cleanTags(attr(doc, 'meta[name="description"]', 'content')); + item.publicationTitle = 'Current Affairs'; + item.issue = attr(doc, '#wpIssueName', 'value'); + item.date = ZU.strToISO(text(doc, '.dateline span')); + item.language = 'en'; + item.ISSN = '2471-2647'; + item.url = url.replace(/[#?].*$/, ''); + + for (let byline of doc.querySelectorAll('.primary .bylines li')) { + item.creators.push(ZU.cleanAuthor(byline.innerText, 'author')); + } + + item.attachments.push({ + title: 'Snapshot', + document: doc + }); + + item.complete(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.currentaffairs.org/2021/08/taming-the-greedocracy", + "items": [ + { + "itemType": "magazineArticle", + "title": "Taming The Greedocracy", + "creators": [ + { + "firstName": "Jag", + "lastName": "Bhalla", + "creatorType": "author" + } + ], + "date": "2021-08-04", + "ISSN": "2471-2647", + "abstractNote": "American elites want magical technological fixes to climate change because they refuse to confront the truth that seriously addressing the problem would require limits to their own power and luxury.", + "issue": "July/Aug 2021", + "language": "en", + "libraryCatalog": "Current Affairs", + "publicationTitle": "Current Affairs", + "url": "https://www.currentaffairs.org/2021/08/taming-the-greedocracy", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.currentaffairs.org/2021/08/tenant-organizing-in-washington-d-c-and-beyond", + "items": [ + { + "itemType": "magazineArticle", + "title": "Tenant Organizing in Washington D.C. and Beyond", + "creators": [ + { + "firstName": "Amanda", + "lastName": "Huron", + "creatorType": "author" + }, + { + "firstName": "Amanda", + "lastName": "Korber", + "creatorType": "author" + }, + { + "firstName": "Rob", + "lastName": "Wohl", + "creatorType": "author" + }, + { + "firstName": "Vanessa A.", + "lastName": "Bee", + "creatorType": "author" + } + ], + "date": "2021-08-05", + "ISSN": "2471-2647", + "abstractNote": "Despite the eviction moratorium, the housing crisis is still severe. This interview, originally from August 2019, explains several ways that tenants can successfully fight their landlords.", + "language": "en", + "libraryCatalog": "Current Affairs", + "publicationTitle": "Current Affairs", + "url": "https://www.currentaffairs.org/2021/08/tenant-organizing-in-washington-d-c-and-beyond", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/DABI.js b/translators/DABI.js new file mode 100644 index 0000000..b6198e7 --- /dev/null +++ b/translators/DABI.js @@ -0,0 +1,476 @@ +{ + "translatorID": "5cf8bb21-e350-444f-b9b4-f46d9fab7827", + "label": "DABI", + "creator": "Jens Mittelbach", + "target": "^https?://dabi\\.ib\\.hu-berlin\\.de/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-09-10 18:58:10" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2018 Jens Mittelbach + Contact: mail@jensmittelbach.de + + 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) { + if (url.includes("/vollanzeige.pl?")) { + return "journalArticle"; + } + else if (url.includes("/suche.pl?") && getSearchResults(doc, true)) { + return 'multiple'; + } + return false; +} + + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Z.selectItems(getSearchResults(doc, false), function (data) { + if (!data) return; + ZU.processDocuments(Object.keys(data), scrape); + }); + } + else if (detectWeb(doc, url) == "journalArticle") { + scrape(doc, url); + } +} + + +function getSearchResults(doc, checkOnly) { + var trs = doc.getElementsByTagName("tr"), + data = {}, + found = false; + + for (var i = 1; i < trs.length; i++) { + var tds = trs[i].getElementsByTagName("td"); + var url = ZU.xpathText(tds, './a/@href'), + author = tds[1].textContent, + title = tds[2].textContent.replace(/
    /g, '. '); + var item; + if (author) { + item = title + " (" + author.replace(/;.*/, ' et al.') + ")"; + } + else { + item = title; + } + if (!item || !url) continue; + + if (checkOnly) return true; + found = true; + + data[url] = item; + } + return found ? data : false; +} + +function scrape(doc, _url) { + var newItem = new Zotero.Item('journalArticle'); + var trs = doc.getElementsByTagName("tr"), + data = {}; + + for (var i = 0; i < trs.length; i++) { + var headers = trs[i].getElementsByTagName("th")[0].textContent; + var contents = trs[i].getElementsByTagName("td")[0].innerHTML; + + data[headers.replace(/\s+/g, '')] = contents.trim(); + } + + // set url to fulltext resource, if present + if (data.URL) { + newItem.url = data.URL.replace(/ 0) { + newItem.pages = data.Anfangsseite + (data.Endseite > data.Anfangsseite ? "-" + data.Endseite : ""); + } + + // Saving the tags to Zotero + if (data["Schlagwörter"]) { + newItem.tags = data["Schlagwörter"].split("; "); + } + + // Making the publication title orthographic + if (data.Zeitschrift) { + newItem.publicationTitle = data.Zeitschrift.replace(/ : /g, ": "); + } + + // Associating and saving the well formatted data to Zotero + newItem.date = data.Jahr; + newItem.issue = data.Heft; + newItem.volume = data.Band; + newItem.abstractNote = data.Abstract; + + // Scrape is COMPLETE! + newItem.complete(); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://dabi.ib.hu-berlin.de/cgi-bin/dabi/vollanzeige.pl?artikel_id=13028&modus=html", + "items": [ + { + "itemType": "journalArticle", + "title": "\"Mich interessierten kostengünstige Alternativen zu Citavi\": Über den Fortbildungsworkshop \"Literaturverwaltung im Fokus\" im Rahmen der AGMB-Tagung 2012", + "creators": [ + { + "firstName": "Matti", + "lastName": "Stöhr", + "creatorType": "author" + } + ], + "date": "2012", + "abstractNote": "Zum Programm der AGMB-Tagung 2012 in Aachen gehörte u.a. der zweistündige Fortbildungsworkshop \"Literaturverwaltung im Fokus - Softwaretypen, bibliothekarische Services und mehr\". Im Beitrag werden weniger die referierten Workshopinhalte beschrieben, als vielmehr die Perspektive der Teilnehmerinnen und Teilnehmer anhand einer eMail-basierten Umfrage vorgestellt. Die Kernfrage lautet hierbei: War der Workshop für sie gewinnbringend?", + "issue": "3", + "libraryCatalog": "DABI", + "publicationTitle": "GMS Medizin, Bibliothek, Information", + "shortTitle": "\"Mich interessierten kostengünstige Alternativen zu Citavi\"", + "url": "http://www.egms.de/static/de/journals/mbi/2012-12/mbi000261.shtml", + "volume": "12", + "attachments": [], + "tags": [ + { + "tag": "Arbeitsgemeinschaft für Medizinisches Bibliothekswesen (AGMB)" + }, + { + "tag": "Citavi" + }, + { + "tag": "Literaturverwaltung" + }, + { + "tag": "Literaturverwaltungssoftware" + }, + { + "tag": "Tagung" + }, + { + "tag": "Teilnehmerumfrage" + }, + { + "tag": "Veranstaltungsbericht" + }, + { + "tag": "Workshop" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://dabi.ib.hu-berlin.de/cgi-bin/dabi/suche.pl?titel=&autor=st%F6hr&schlagwort=&styp=¬ation=&zeitschrift=&jahr=&heft=&andor=AND&ordnung=titel&modus=html", + "items": "multiple" + }, + { + "type": "web", + "url": "http://dabi.ib.hu-berlin.de/cgi-bin/dabi/vollanzeige.pl?artikel_id=16013&modus=html", + "items": [ + { + "itemType": "journalArticle", + "title": "\"Frage stellen, Antwort bekommen, weiterarbeiten!\" - Umfrage zur Benutzung von UpToDate an den Universitäten Freiburg, Leipzig, Münster und Regensburg", + "creators": [ + { + "firstName": "Oliver", + "lastName": "Obst", + "creatorType": "author" + }, + { + "firstName": "Helge", + "lastName": "Knüttel", + "creatorType": "author" + }, + { + "firstName": "Christiane", + "lastName": "Hofmann", + "creatorType": "author" + }, + { + "firstName": "Petra", + "lastName": "Zöller", + "creatorType": "author" + } + ], + "date": "2013", + "abstractNote": "UpToDate ist eine evidenzbasierte, von Ärzten erstellte Ressource zur Unterstützung der klinischen Entscheidungsfindung mit weitem Verbreitungsgrad in Deutschland. In einer Multicenter-Studie wurden Mediziner, Studierende, Wissenschaftler und sonstiges medizinisches Fachpersonal an vier deutschen Universitäten nach ihrer Nutzung und Beurteilung von UpToDate befragt. Insgesamt wurde die Umfrage 1.083-mal beantwortet, darunter von 540 Ärzten. 76% aller befragten Ärzte (aber nur 54% der Chefärzte) nutzten UpToDate. Die Unkenntnis über UpToDate betrug je nach Benutzergruppe zwischen 10 und 41%. 90 bis 95% aller klinisch tätigen Personen nannten als Hauptvorteil von UpToDate die schnelle, allgemeine Übersicht über Diagnose und Therapie von Erkrankungen. Jeder vierte Oberarzt wies auf verringerte Liegezeiten als Folge von UpToDate hin, (fast) jeder vierte Chefarzt gab an, dass UpToDate Kosten einspare. UpToDate ist eine wichtige, aber auch kostspielige Ressource in der Patientenbehandlung und sollte - angesichts der vorhandenen Unkenntnis über die Existenz dieser Ressource - stärker von den Bibliotheken beworben werden.", + "issue": "3", + "libraryCatalog": "DABI", + "publicationTitle": "GMS Medizin, Bibliothek, Information", + "url": "http://www.egms.de/static/de/journals/mbi/2013-13/mbi000290.shtml", + "volume": "13", + "attachments": [], + "tags": [ + { + "tag": "Freiburg" + }, + { + "tag": "Krankenversorgung" + }, + { + "tag": "Leipzig" + }, + { + "tag": "Medizin" + }, + { + "tag": "Medizinbibliothek" + }, + { + "tag": "Multicenter-Studie" + }, + { + "tag": "Münster" + }, + { + "tag": "Regensburg" + }, + { + "tag": "Umfrage" + }, + { + "tag": "Universität Freiburg" + }, + { + "tag": "Universität Leipzig" + }, + { + "tag": "Universität Münster" + }, + { + "tag": "Universität Regensburg" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://dabi.ib.hu-berlin.de/cgi-bin/dabi/vollanzeige.pl?artikel_id=21283&modus=html", + "items": [ + { + "itemType": "journalArticle", + "title": "\"Was ihr wollt!\" Nutzungsgesteuerter Einkauf von Medien an der Staatsbibliothek zu Berlin", + "creators": [ + { + "firstName": "Janin", + "lastName": "Taubert", + "creatorType": "author" + } + ], + "date": "2014", + "issue": "3", + "libraryCatalog": "DABI", + "pages": "79-81", + "publicationTitle": "Bibliotheks-Magazin", + "volume": "9", + "attachments": [ + { + "title": "DABI Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Benutzerorientierter Bestandsaufbau" + }, + { + "tag": "Benutzerorientierung" + }, + { + "tag": "Berlin" + }, + { + "tag": "Bestand" + }, + { + "tag": "Bestandsaufbau" + }, + { + "tag": "Bibliothekswesen" + }, + { + "tag": "Demand Driven Acquisition (DDA)" + }, + { + "tag": "E-Book" + }, + { + "tag": "Evidence Based Selection (EBS)" + }, + { + "tag": "Kundenorientierter Bestandsaufbau" + }, + { + "tag": "Patron Driven Acquisition (PDA)" + }, + { + "tag": "Purchase On Demand (POD)" + }, + { + "tag": "Staatsbibliothek zu Berlin - Preußischer Kulturbesitz (SBB PK)" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://dabi.ib.hu-berlin.de/cgi-bin/dabi/vollanzeige.pl?artikel_id=5676&modus=html", + "items": [ + { + "itemType": "journalArticle", + "title": "Anpassung der Personalstruktur der Fachhochschulbibliotheken in Nordrhein-Westfalen an die Erfordernisse der neunziger Jahre", + "creators": [], + "date": "1992", + "issue": "1", + "libraryCatalog": "DABI", + "pages": "364-372", + "publicationTitle": "Mitteilungsblatt des Verbandes der Bibliotheken des Landes Nordrhein-Westfalen", + "volume": "4", + "attachments": [], + "tags": [ + { + "tag": "Nordrhein-Westfalen" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://dabi.ib.hu-berlin.de/cgi-bin/dabi/vollanzeige.pl?artikel_id=9481&modus=html", + "items": [ + { + "itemType": "journalArticle", + "title": "\"Das bibliophile Flaggschiff Bayerns\": Auszug aus der Rede des damaligen Ministerpräsidenten Dr. Günther Beckstein", + "creators": [ + { + "firstName": "Günther", + "lastName": "Beckstein", + "creatorType": "author" + } + ], + "date": "2009", + "issue": "1", + "libraryCatalog": "DABI", + "pages": "46", + "publicationTitle": "Bibliotheksforum Bayern", + "shortTitle": "\"Das bibliophile Flaggschiff Bayerns\"", + "volume": "3", + "attachments": [ + { + "title": "DABI Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "Altes Buch" + }, + { + "tag": "Ausstellung" + }, + { + "tag": "Bayerische Staatsbibliothek (BSB) München" + }, + { + "tag": "Bibel" + }, + { + "tag": "Buchkunst" + }, + { + "tag": "Buchmalerei" + }, + { + "tag": "Handschrift" + }, + { + "tag": "Illustration" + }, + { + "tag": "Neues Testament" + }, + { + "tag": "Ottheinrich-Bibel" + } + ], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/DAI-Zenon.js b/translators/DAI-Zenon.js new file mode 100644 index 0000000..53092ee --- /dev/null +++ b/translators/DAI-Zenon.js @@ -0,0 +1,392 @@ +{ + "translatorID": "16199bf0-a365-4aad-baeb-225019ae32dc", + "label": "DAI-Zenon", + "creator": "Philipp Zumstein, Sebastian Karcher", + "target": "^https?://zenon\\.dainst\\.org/(Record/|Search/)", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2020-10-13 15:24:32" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2014-2020 Philipp Zumstein and Sebastian Karcher + + 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) { + // return "bookSection"; // activate for testing + // return "journalArticle"; // activate for testing + if (url.includes("/Record")) { // book, journalArticle or bookSection --> will be improved during scraping + return "book"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = ZU.xpath(doc, '//div[contains(@class, "row")]//a[contains(@class, "title")]'); + for (let i = 0; i < rows.length; i++) { + var href = rows[i].href; + var title = ZU.trimInternal(rows[i].textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (!items) { + return; + } + var articles = []; + for (var i in items) { + articles.push(i); + } + ZU.processDocuments(articles, scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + // e.g. url = "http://zenon.dainst.org/Record/000300287" + // remove anchor so this doesn't break https://zenon.dainst.org/Record/001275808#usercomments + var urlParts = url.replace(/#.*/, "").split("/"); + var id = urlParts[urlParts.length - 1]; + + // call MARC translator + ZU.doGet('/Record/' + id + '/Details', function (text) { + var parser = new DOMParser(); + var xml = parser.parseFromString(text, "text/html"); + + var translator = Zotero.loadTranslator("import"); + + translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); + translator.getTranslatorObject(function (marc) { + var details = ZU.xpath(xml, '//tr'); + var record = new marc.record(); + var newItem = new Zotero.Item(); + + for (let i = 0; i < details.length; i++) { + var fieldTag = ZU.xpathText(details[i], './th'); + // skip empty lines + if (!fieldTag) continue; + + var values = ZU.xpath(details[i], './td'); + if (values.length == 1) { + if (fieldTag == "LEADER") { + record.leader = ZU.xpathText(details[i], './td'); + } + // the control fields are not anyhow used in MARC translator, thus we do not import them + } + if (values.length == 3) { + var ind1 = ZU.xpathText(details[i], './td[1]'); + var ind2 = ZU.xpathText(details[i], './td[2]'); + var fieldContent = ZU.xpathText(details[i], './td[3]', null, '').replace(/[\r\n\s]*\|/g, marc.subfieldDelimiter); + record.addField(fieldTag, ind1 + ind2, fieldContent); + } + } + + record.translate(newItem); + + // import tags from the 999 fields and filter out dublicate tags + // leaving this here in case it ever comes back, but doesn't exist as of October 2020 + record._associateTags(newItem, 999, "a"); + newItem.tags = newItem.tags.filter(function (item, index, inputArray) { + return inputArray.indexOf(item) == index; + }); + + // get container title from 773 + record._associateDBField(newItem, 773, "t", "bookTitle"); + // This used to be in 995 - not seeing this anymore in October 202 but + // leaving to make sure it doesn't break. + if (!newItem.bookTitle) { + record._associateDBField(newItem, 995, "n", "bookTitle"); + } + if (newItem.bookTitle) { + if (record.leader.substr(6, 2) == "as") { // This seems to work good, but I don't know if is always working. + newItem.itemType = "journalArticle"; + var regularExpression1 = /^(.*),\s?(\d+),\s?(\d+)\s?\(\d\d\d\d\)/; // e.g. Bulletin du Cercle d'Études Numismatiques, 44,2 (2007) + var regularExpression2 = /^(.*),\s?(\d+)\s?\(\d\d\d\d\)/; // e.g Mannheimer Geschichtsblätter, Neue Folge, 16 (2008) + var m; + if ((m = newItem.bookTitle.match(regularExpression1))) { + newItem.publicationTitle = m[1]; + newItem.volume = m[2]; + newItem.issue = m[3]; + } + else if ((m = newItem.bookTitle.match(regularExpression2))) { + newItem.publicationTitle = m[1]; + newItem.volume = m[2]; + } + } + else { + newItem.itemType = "bookSection"; + } + record._associateDBField(newItem, 300, "a", "pages"); + delete newItem.numPages; + } + + newItem.attachments.push({ + url: url, + title: "DAI Zenon Entry", + mimeType: 'text/html', + snapshot: false + }); + + newItem.complete(); + }); + }); +}/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://zenon.dainst.org/Record/000269027", + "items": [ + { + "itemType": "book", + "title": "Die Aufnahme fremder Kultureinflüsse in Etrurien und das Problem des Retardierens in der etruskischen Kunst: Referate vom Symposion des Deutschen Archäologen-Verbandes: Mannheim 8.-10.2. 1980", + "creators": [ + { + "lastName": "Deutscher Archäologen-Verband", + "creatorType": "editor", + "fieldMode": true + }, + { + "lastName": "Universität Mannheim", + "creatorType": "editor", + "fieldMode": true + } + ], + "date": "1981", + "callNumber": "DG223  .A8 1981", + "libraryCatalog": "DAI-Zenon", + "numPages": "197", + "place": "Mannheim", + "publisher": "Deutscher Archäologen-Verband", + "series": "Schriften des Deutschen Archäologen-Verbandes", + "seriesNumber": "5", + "shortTitle": "Die Aufnahme fremder Kultureinflüsse in Etrurien und das Problem des Retardierens in der etruskischen Kunst", + "attachments": [ + { + "title": "DAI Zenon Entry", + "mimeType": "text/html", + "snapshot": false + } + ], + "tags": [ + { + "tag": "Etrusker" + }, + { + "tag": "Kongreßschrift" + }, + { + "tag": "Mannheim 1980" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://zenon.dainst.org/Record/000300287", + "items": [ + { + "itemType": "bookSection", + "title": "Kulturbeziehungen zwischen dem eisenzeitlichen Etrurien und dem Ostalpenraum", + "creators": [ + { + "firstName": "Luciana", + "lastName": "Aigner-Foresti", + "creatorType": "author" + } + ], + "bookTitle": "Die Aufnahme fremder Kultureinflüsse in Etrurien und das Problem des Retardierens in der etruskischen Kunst, Mannheim 8.-10.2.1980", + "libraryCatalog": "DAI-Zenon", + "pages": "46-52, Abb", + "attachments": [ + { + "title": "DAI Zenon Entry", + "mimeType": "text/html", + "snapshot": false + } + ], + "tags": [ + { + "tag": "Alpenländer (bis 1997)" + }, + { + "tag": "Beziehungen" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://zenon.dainst.org/Record/001286369", + "items": [ + { + "itemType": "journalArticle", + "title": "Zwischen Diesseits und Jenseits, fünf etruskische Urnen aus den Sammlungen der rem als Zeugen einer untergeganenen Kultur", + "creators": [ + { + "firstName": "Alexandra", + "lastName": "Berend", + "creatorType": "author" + } + ], + "date": "2008", + "libraryCatalog": "DAI-Zenon", + "pages": "100-107", + "publicationTitle": "Mannheimer Geschichtsblätter, Neue Folge", + "volume": "16", + "attachments": [ + { + "title": "DAI Zenon Entry", + "mimeType": "text/html", + "snapshot": false + } + ], + "tags": [ + "Etrusker", + "Ikonographie", + "Impasto-Keramik", + "Mannheim, Reiss-Engelhorn-Museum", + "Urnenbestattungen", + "Villanova" + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "http://zenon.dainst.org/Record/001279328", + "items": [ + { + "itemType": "journalArticle", + "title": "Un bronze d'Elaia (Eolide) aux noms de Caius et Lucius César", + "creators": [ + { + "firstName": "Jean-Marc", + "lastName": "Doyen", + "creatorType": "author" + } + ], + "date": "2007", + "issue": "2", + "libraryCatalog": "DAI-Zenon", + "pages": "329-330", + "publicationTitle": "Bulletin du Cercle d'Études Numismatiques", + "volume": "44", + "attachments": [ + { + "title": "DAI Zenon Entry", + "mimeType": "text/html", + "snapshot": false + } + ], + "tags": [ + "Caesar, Gaius Iulius <20 v. Chr.-4>", + "Caesar, Lucius Iulius", + "Elaia", + "Römische Münzen" + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://zenon.dainst.org/Record/000251127", + "items": [ + { + "itemType": "book", + "title": "Das Bild des Augustus auf den frühen Reichsprägungen: Studien zur Vergöttlichung des ersten Prinzeps", + "creators": [ + { + "firstName": "Rainer", + "lastName": "Albert", + "creatorType": "author" + } + ], + "date": "1981", + "language": "ger", + "libraryCatalog": "DAI-Zenon", + "numPages": "248", + "place": "Speyer", + "publisher": "Numismatische Gesellschaft", + "series": "Schriftenreihe der Numismatischen Gesellschaft Speyer", + "seriesNumber": "21", + "shortTitle": "Das Bild des Augustus auf den frühen Reichsprägungen", + "attachments": [ + { + "title": "DAI Zenon Entry", + "mimeType": "text/html", + "snapshot": false + } + ], + "tags": [ + { + "tag": "Augustus" + }, + { + "tag": "Herrscherkult" + }, + { + "tag": "Münzen als Zeugnis" + } + ], + "notes": [ + { + "note": "Thesis (doctoral)--Universität Mannheim, 1980" + } + ], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/DART-Europe.js b/translators/DART-Europe.js new file mode 100644 index 0000000..e5bd416 --- /dev/null +++ b/translators/DART-Europe.js @@ -0,0 +1,176 @@ +{ + "translatorID": "658f2707-bb46-44eb-af0a-e73a5387fc90", + "label": "DART-Europe", + "creator": "Sebastian Karcher", + "target": "^https?://www\\.dart-europe\\.org", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2022-05-04 03:09:28" +} + +/** + Copyright (c) 2013 Sebastian Karcher + + This program 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. + + This program 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 this program. If not, see + . +*/ + + + + +function detectWeb(doc, url) { + if (url.indexOf("full.php?") != -1) return "thesis"; + if (url.indexOf("results.php?") != -1) return "multiple"; + +} + + +function scrape(doc, url) { + var newItem = new Zotero.Item("thesis"); + var title = ZU.xpathText(doc, '//tr[contains(@class, "result")]/th[@class="field-name" and contains(text(), "Title")]/following-sibling::td'); + var thesisType = ZU.xpathText(doc, '//tr[contains(@class, "result")]/th[@class="field-name" and contains(text(), "Type")]/following-sibling::td'); + var date = ZU.xpathText(doc, '//tr[contains(@class, "result")]/th[@class="field-name" and contains(text(), "Date")]/following-sibling::td'); + var language = ZU.xpathText(doc, '//tr[contains(@class, "result")]/th[@class="field-name" and contains(text(), "Language")]/following-sibling::td'); + var abstract = ZU.xpathText(doc, '//tr[contains(@class, "result")]/th[@class="field-name" and contains(text(), "Abstract")]/following-sibling::td'); + var publisherinfo = ZU.xpathText(doc, '//tr[contains(@class, "result")]/th[@class="field-name" and contains(text(), "Publisher")]/following-sibling::td'); + var fulltext = ZU.xpathText(doc, '//tr[th[@class="field-name" and contains(text(), "Identifier")]][1]/th[@class="field-name" and contains(text(), "Identifier")]/following-sibling::td'); + + //Publisher field may have place + var place; + if (publisherinfo && publisherinfo.indexOf(":") !=-1){ + var publisher = publisherinfo.match(/:\s*(.+)/)[1] + var place =publisherinfo.match(/(.+):/)[1] + } + else var publisher = publisherinfo; + + //Authors and Tags can have multiple rows. In that case the td[1] remains empty we loop through them until that's no longer the case + + var author = ZU.xpathText(doc, '//tr[contains(@class, "result")]/th[@class="field-name" and contains(text(), "Author")]/following-sibling::td'); + if (author) newItem.creators.push(ZU.cleanAuthor(author, "author", true)) + + + var tags = ZU.xpathText(doc, '//tr[contains(@class, "result")]/th[@class="field-name" and contains(text(), "Subject(s)")]/following-sibling::td'); + if (tags) { + tags = tags.split(/\s*,\s*/); + for (var i in tags) { + newItem.tags.push(tags[i]) + } + } + + if (fulltext) { + fulltext = fulltext.trim(); + if (fulltext.search(/\.pdf/) != -1) { + newItem.attachments.push({ + url: fulltext, + title: "Dart-Europe Full Text PDF", + mimeType: "application/pdf" + }) + } else if (fulltext.search(/http\:\/\//) != -1){ + newItem.attachments.push({ + url: fulltext, + title: "DART-Europe Thesis Page", + mimeType: "text/html" + }) + } + } + newItem.attachments.push({ + document: doc, + title: "DART-Europe Record Snapshot", + mimeType: "text/html" + }) + newItem.title = title; + newItem.thesisType = thesisType; + newItem.date = date; + newItem.abstractNote = abstract; + newItem.language = language; + newItem.publisher = publisher; + newItem.place = place; + newItem.complete(); +} + + +function doWeb(doc, url) { + + var articles = new Array(); + var items = {}; + if (detectWeb(doc, url) == "multiple") { + //this currently doesn't do anything as multiple detect is disabled + var titles = doc.evaluate('//table[@id="search-results"]//a[contains(@href, "full.php?")]', doc, null, XPathResult.ANY_TYPE, null); + var next_title; + while (next_title = titles.iterateNext()) { + items[next_title.href] = next_title.textContent; + } + + Zotero.selectItems(items, function (items) { + if (!items) { + return true; + } + for (var i in items) { + articles.push(i); + } + Z.debug(articles) + Zotero.Utilities.processDocuments(articles, scrape); + }) + } else { + scrape(doc, url); + } +} +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "http://www.dart-europe.org/basic-results.php?kw[]=labor&f=n&hist=y", + "items": "multiple" + }, + { + "type": "web", + "url": "http://www.dart-europe.org/full.php?id=284332", + "items": [ + { + "itemType": "thesis", + "creators": [ + { + "firstName": "Charles Edmund Richard", + "lastName": "Pennell", + "creatorType": "author" + } + ], + "notes": [], + "tags": [], + "seeAlso": [], + "attachments": [ + { + "title": "Dart-Europe Full Text PDF", + "mimeType": "application/pdf" + }, + { + "title": "DART-Europe Record Snapshot", + "mimeType": "text/html" + } + ], + "title": "A critical investigation of the opposition of the Rifi confederation led by Muhammed bin 'Abd al-Karim al-Khattabi to Spanish colonial expansion in northern Morocco, 1920-1925, and its political and social background", + "thesisType": "Thesis, NonPeerReviewed", + "date": "1979", + "abstractNote": "This thesis examines the course and political\naction of the war in the Rif mountains in northern Morocco\nbetween 1921 and 1926.\n\nAfter the declaration of a joint Franco-Spanish\nProtectorate over Morocco in 1912, the Spanish army\nattempted to impose its authority over the part of north\nMorocco which was included in its zone. After the end of\nthe First World War the Spanish were opposed in their\nefforts by a slowly growing coalition of tribes in the\ncentral Rif mountains. After the emergence of Mubammad\nbin 'Abd al-Karim al-Khattdbl as leader of the coalition,\nit was able to inflict a series of military defeats on the\nSpanish in the summer of 1921, a success which led to the'\nexpansion of the coalition and, in 1923, to the announcement\nof an independent state in the Rif under the leadership of\nbin 'Abd al-Karim.\n\nThis state was able to defeat another Spanish army\nin 1924 and, in 1925, to inflict a series of defeats upon\nthe French army in that, country's zone of Protectorate,\nbefore an alliance between France and Spain crushed the new\nstate in 1926.\n\nPrevious work has concentrated more on the\nmilitary aspects of the conflict from a European point of\nview, and examination of the Moroccan side has dwelt almost\nexclusively on the personality of the Rifi leader, bin 'Abd\nal-Karim. This thesis, however, is concerned with the\npolitical and social aspects of the war from the Moroccan\npoint of view. While it recognises the importance of bin\n'Abd al-Karim, it tries to explain his role in terms of his\npolitical position in Rifi society as'a whole. It examines\nhis political, social. and religious reforms'l not only from\nthe point of view of their importance in the overall--\nmovement for Islamic reform, but also from that of their\npractical necessity and effects.", + "publisher": "University of Leeds", + "libraryCatalog": "DART-Europe" + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/DBLP Computer Science Bibliography.js b/translators/DBLP Computer Science Bibliography.js new file mode 100644 index 0000000..132e559 --- /dev/null +++ b/translators/DBLP Computer Science Bibliography.js @@ -0,0 +1,462 @@ +{ + "translatorID": "625c6435-e235-4402-a48f-3095a9c1a09c", + "label": "DBLP Computer Science Bibliography", + "creator": "Sebastian Karcher, Philipp Zumstein, and Abe Jellinek", + "target": "^https?://(www\\.)?(dblp\\d?(\\.org|\\.uni-trier\\.de/|\\.dagstuhl\\.de/))", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2023-04-20 13:37:43" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2011-2021 Sebastian Karcher, Philipp Zumstein, and Abe Jellinek + + 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) { + if (doc.querySelector('#bibtex-section')) { + if (url.includes('journals')) { + return "journalArticle"; + } + else if (url.includes('conf')) { + return "conferencePaper"; + } + else if (url.includes('series') || url.includes('reference')) { + return "bookSection"; + } + else if (url.includes('books')) { + return "book"; + } + else if (url.includes('phd')) { + return "thesis"; + } + else { // generic fallback + return "journalArticle"; + } + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + + +function scrape(doc, _url) { + let allData = doc.querySelectorAll('#bibtex-section > pre'); + let firstData = allData[0]; + var firstDataText = firstData.textContent.replace(/ ee\s*=/, " url ="); // e.g. ee = {http://dx.doi.org/10.1007/978-3-319-00035-0_37}, + + // conferencePapers and bookSections are linked in DBLP + // with the crossref field to the second BibTeX entry + // for the proceeding or book. In these cases the following + // lines (if-part) are handling the second entry and extracting + // relevant fields and save it (later) to the main entry. + var secondData = allData[1]; + if (secondData) { + var secondDataText = secondData.textContent; + + var trans = Zotero.loadTranslator('import'); + trans.setTranslator('9cb70025-a888-4a29-a210-93ec52da40d4');// https://github.com/zotero/translators/blob/master/BibTeX.js + trans.setString(secondDataText); + + trans.setHandler('itemDone', function (obj, item) { + scrapeMainPart(firstDataText, item); + }); + + trans.translate(); + } + else { // if there are no secondData: scrape without additional data + scrapeMainPart(firstDataText, null); + } +} + + +function scrapeMainPart(firstDataText, secondDataItem) { + // scrape from the firstDataText and if secondDataItem + // is not null, add/update these information + var trans = Zotero.loadTranslator('import'); + trans.setTranslator('9cb70025-a888-4a29-a210-93ec52da40d4');// https://github.com/zotero/translators/blob/master/BibTeX.js + trans.setString(firstDataText); + + trans.setHandler('itemDone', function (obj, item) { + if (secondDataItem) { + if (secondDataItem.title && item.itemType == "conferencePaper") item.proceedingsTitle = secondDataItem.title; + if (secondDataItem.title && item.itemType == "bookSection") item.bookTitle = secondDataItem.title; + if (secondDataItem.creators && secondDataItem.creators.length > 0) item.creators = item.creators.concat(secondDataItem.creators); + if (secondDataItem.publisher && !item.publisher) item.publisher = secondDataItem.publisher; + if (secondDataItem.series && !item.series) item.series = secondDataItem.series; + if (secondDataItem.volume && !item.volume) item.volume = secondDataItem.volume; + if (secondDataItem.ISBN && !item.ISBN) item.ISBN = secondDataItem.ISBN; + } + + // Assume that the url contains an doi. If the item does not + // yet contain a doi, then save the doi and delete the url. + // If the item contains the doi corresponding to the url + // then just delete the url and keep the doi. + if (item.url && /^https?:\/\/(?:dx\.)?doi\.org\/10\./i.test(item.url)) { + var doi = ZU.cleanDOI(item.url); + if (doi && (!item.DOI || item.DOI == doi)) { + item.DOI = doi; + delete item.url; + } + } + + item.complete(); + }); + + trans.translate(); +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('.entry'); + for (let row of rows) { + let href = attr(row, 'a[href*="view=bibtex"]', 'href'); + let title = text(row, '.title'); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://dblp.org/rec/journals/cssc/XuY12.html?view=bibtex", + "items": [ + { + "itemType": "journalArticle", + "title": "On the Preliminary Test Backfitting and Speckman Estimators in Partially Linear Models and Numerical Comparisons", + "creators": [ + { + "firstName": "Jianwen", + "lastName": "Xu", + "creatorType": "author" + }, + { + "firstName": "Hu", + "lastName": "Yang", + "creatorType": "author" + } + ], + "date": "2012", + "DOI": "10.1080/03610918.2011.588356", + "issue": "3", + "itemID": "DBLP:journals/cssc/XuY12", + "libraryCatalog": "DBLP Computer Science Bibliography", + "pages": "327–341", + "publicationTitle": "Commun. Stat. Simul. Comput.", + "volume": "41", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://dblp.org/rec/conf/ats/KochteZBIWHCP10.html?view=bibtex", + "items": [ + { + "itemType": "conferencePaper", + "title": "Efficient Simulation of Structural Faults for the Reliability Evaluation at System-Level", + "creators": [ + { + "firstName": "Michael A.", + "lastName": "Kochte", + "creatorType": "author" + }, + { + "firstName": "Christian G.", + "lastName": "Zoellin", + "creatorType": "author" + }, + { + "firstName": "Rafal", + "lastName": "Baranowski", + "creatorType": "author" + }, + { + "firstName": "Michael E.", + "lastName": "Imhof", + "creatorType": "author" + }, + { + "firstName": "Hans-Joachim", + "lastName": "Wunderlich", + "creatorType": "author" + }, + { + "firstName": "Nadereh", + "lastName": "Hatami", + "creatorType": "author" + }, + { + "firstName": "Stefano Di", + "lastName": "Carlo", + "creatorType": "author" + }, + { + "firstName": "Paolo", + "lastName": "Prinetto", + "creatorType": "author" + } + ], + "date": "2010", + "DOI": "10.1109/ATS.2010.10", + "itemID": "DBLP:conf/ats/KochteZBIWHCP10", + "libraryCatalog": "DBLP Computer Science Bibliography", + "pages": "3–8", + "proceedingsTitle": "Proceedings of the 19th IEEE Asian Test Symposium, ATS 2010, 1-4 December 2010, Shanghai, China", + "publisher": "IEEE Computer Society", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://dblp1.uni-trier.de/db/journals/tois/tois25.html", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dblp.uni-trier.de/db/journals/tods/tods31.html", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dblp.dagstuhl.de/pid/k/DonaldEKnuth.html", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dblp.uni-trier.de/rec/conf/approx/SchederT13.html?view=bibtex", + "items": [ + { + "itemType": "conferencePaper", + "title": "On the Average Sensitivity and Density of k-CNF Formulas", + "creators": [ + { + "firstName": "Dominik", + "lastName": "Scheder", + "creatorType": "author" + }, + { + "firstName": "Li-Yang", + "lastName": "Tan", + "creatorType": "author" + }, + { + "firstName": "Prasad", + "lastName": "Raghavendra", + "creatorType": "editor" + }, + { + "firstName": "Sofya", + "lastName": "Raskhodnikova", + "creatorType": "editor" + }, + { + "firstName": "Klaus", + "lastName": "Jansen", + "creatorType": "editor" + }, + { + "firstName": "José D. P.", + "lastName": "Rolim", + "creatorType": "editor" + } + ], + "date": "2013", + "DOI": "10.1007/978-3-642-40328-6_47", + "itemID": "DBLP:conf/approx/SchederT13", + "libraryCatalog": "DBLP Computer Science Bibliography", + "pages": "683–698", + "proceedingsTitle": "Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques - 16th International Workshop, APPROX 2013, and 17th International Workshop, RANDOM 2013, Berkeley, CA, USA, August 21-23, 2013. Proceedings", + "publisher": "Springer", + "series": "Lecture Notes in Computer Science", + "url": "https://doi.org/10.1007/978-3-642-40328-6\\_47", + "volume": "8096", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://dblp.org/rec/conf/iclr/DasMYTM19.html", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dblp.org/search?q=zotero", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dblp.org/db/series/ceurws/ceurws2600-2699.html", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dblp.org/db/conf/ircdl/viperc2020.html", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dblp.org/rec/conf/iclr/DasMYTM19.html", + "items": "multiple" + }, + { + "type": "web", + "url": "https://dblp.org/rec/conf/iclr/DasMYTM19.html?view=bibtex", + "items": [ + { + "itemType": "conferencePaper", + "title": "Building Dynamic Knowledge Graphs from Text using Machine Reading Comprehension", + "creators": [ + { + "firstName": "Rajarshi", + "lastName": "Das", + "creatorType": "author" + }, + { + "firstName": "Tsendsuren", + "lastName": "Munkhdalai", + "creatorType": "author" + }, + { + "firstName": "Xingdi", + "lastName": "Yuan", + "creatorType": "author" + }, + { + "firstName": "Adam", + "lastName": "Trischler", + "creatorType": "author" + }, + { + "firstName": "Andrew", + "lastName": "McCallum", + "creatorType": "author" + } + ], + "date": "2019", + "itemID": "DBLP:conf/iclr/DasMYTM19", + "libraryCatalog": "DBLP Computer Science Bibliography", + "proceedingsTitle": "7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019", + "publisher": "OpenReview.net", + "url": "https://openreview.net/forum?id=S1lhbnRqF7", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://dblp.org/rec/reference/choice/LangX16.html?view=bibtex¶m=2", + "detectedItemType": "bookSection", + "items": [ + { + "itemType": "bookSection", + "title": "Voting in Combinatorial Domains", + "creators": [ + { + "firstName": "Jérôme", + "lastName": "Lang", + "creatorType": "author" + }, + { + "firstName": "Lirong", + "lastName": "Xia", + "creatorType": "author" + }, + { + "firstName": "Felix", + "lastName": "Brandt", + "creatorType": "editor" + }, + { + "firstName": "Vincent", + "lastName": "Conitzer", + "creatorType": "editor" + }, + { + "firstName": "Ulle", + "lastName": "Endriss", + "creatorType": "editor" + }, + { + "firstName": "Jérôme", + "lastName": "Lang", + "creatorType": "editor" + }, + { + "firstName": "Ariel D.", + "lastName": "Procaccia", + "creatorType": "editor" + } + ], + "date": "2016", + "ISBN": "9781107446984", + "bookTitle": "Handbook of Computational Social Choice", + "extra": "DOI: 10.1017/CBO9781107446984.010", + "itemID": "DBLP:reference/choice/LangX16", + "libraryCatalog": "DBLP Computer Science Bibliography", + "pages": "197–222", + "publisher": "Cambridge University Press", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/DBpia.js b/translators/DBpia.js new file mode 100644 index 0000000..882e43b --- /dev/null +++ b/translators/DBpia.js @@ -0,0 +1,233 @@ +{ + "translatorID": "0c31f371-e012-4b1c-b793-f89ab1ae2610", + "label": "DBpia", + "creator": "Yunwoo Song, Philipp Zumstein", + "target": "^https?://[^/]+\\.dbpia\\.co\\.kr/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2021-09-14 00:23:40" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + DBpia Translator + Copyright © 2017 Yunwoo Song and Philipp Zumstein + + 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) { + if (url.includes('/journal/articleDetail')) { + return "journalArticle"; + } else if ((url.includes('/search/') || url.includes('/journal/articleList/')) && getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('h5 > a[href*="/journal/articleDetail"]'); + for (let row of rows) { + var href = row.href; + var title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (!items) { + return; + } + ZU.processDocuments(Object.keys(items), scrape); + }); + } else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var translator = Zotero.loadTranslator('web'); + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setHandler('itemDone', function (obj, item) { + let nodeId = encodeURIComponent(url.match(/[?&]nodeId=([^&#]+)/)[1]); + + let downloadDataURL = '/download/downloadData'; + let downloadDataBody = `nodeId=${nodeId}&systemCode=Article&depth=Article&shape=download`; + + ZU.doPost(downloadDataURL, downloadDataBody, function (respText) { + if (!respText || respText[0] != '{') { + item.complete(); + return; + } + + let json = JSON.parse(respText); + if (!json.link) { + item.complete(); + return; + } + + item.attachments.push({ + url: json.link, + title: "Full Text PDF", + mimeType: "application/pdf" + }); + item.complete(); + }); + }); + + translator.getTranslatorObject(function(trans) { + trans.itemType = "journalArticle"; + trans.doWeb(doc, url); + }); +} +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://www.dbpia.co.kr/journal/articleDetail?nodeId=NODE02298184&language=ko_KR", + "items": [ + { + "itemType": "journalArticle", + "title": "공기역학적 성능을 고려한 인간동력항공기 개념 설계", + "creators": [ + { + "firstName": "", + "lastName": "강형민", + "creatorType": "author" + }, + { + "firstName": "", + "lastName": "김철완", + "creatorType": "author" + } + ], + "date": "2013/11", + "ISSN": "1598-4168", + "abstractNote": "본 연구에서는 공기역학적 성능을 고려하여 인간의 힘만으로 이륙할 수 있는 초경량 인간동력 항공기의 개념설계를 수행하였다. 이를 위해 조종사를 포함한 항공기 전체 무게를 결정한 이후 적절한 익형을 선정하여 주날개/보조날개를 설계하였다. 설계된 비행기의 형상을 기초로 3차원 전산해석을 하였으며, 이를 통해 양력/항력 등의 성능계수 및 항공기무게 중심(CG)에 대한 계산을 수행하였다. 그 결과 비행기의 양력 및 추력이 양력 및 추력의 제한 조건을 만족하였다. 또한 비행기의 무게 중심(CG)이 주익의 공력 중심(AC)에 위치함으로써 26%의 정적 안정성이 보장되었다.", + "issue": "2", + "libraryCatalog": "www.dbpia.co.kr", + "pages": "180-185", + "publicationTitle": "항공우주기술", + "url": "https://www.dbpia.co.kr/Journal/articleDetail?nodeId=NODE02298184", + "volume": "12", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + }, + { + "title": "Full Text PDF", + "mimeType": "application/pdf" + } + ], + "tags": [ + { + "tag": "개념설계(Preliminary Design)" + }, + { + "tag": "공기역학적 성능(Aerodynamic Performance)" + }, + { + "tag": "인간동력 항공기(Human Powered Aircraft)" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.dbpia.co.kr/journal/articleDetail?nodeId=NODE06648914&language=ko_KR", + "items": [ + { + "itemType": "journalArticle", + "title": "다문화가족 청소년의 가족유형에 따른 일탈행위의 차이 분석", + "creators": [ + { + "firstName": "", + "lastName": "김현식", + "creatorType": "author" + } + ], + "date": "2016/02", + "DOI": "10.21562/kjs.2016.02.50.1.41", + "ISSN": "1225-0120", + "abstractNote": "이 논문의 목적은 일탈행위의 사회학에 기초하여 한국 청소년의 일탈행위가 다문화가족 유형에 따라 다른지에 관한 이론적 가설을 도출하고, 이를 경험적으로 검증하는 것이다. 분석 자료로 2011년부터 2014년까지 수집된 청소년건강행태온라인조사를 활용하였다. 이 논문에서는 가족유형을 양 부모 한국출생, 어머니만 외국출생, 아버지만 외국출생, 양 부모 외국출생으로 분류하였고, 흡연, 음주, 인터넷 중독, 성관계 경험, 약물남용으로 일탈행위를 측정하였다. 각 일탈행위에 있어서의 차이에 더해 항목응답이론(item response theory)에 근거한 일탈행위성향을 측정한 후 집단별 일탈행위성향의 차이를 분석하였다. 분석결과, 어머니만 외국출생인 청소년은 양 부모가 한국출생인 청소년에 비해 인터넷 중독 위험이 높았으나 다른 일탈행위에 있어서는 다르지 않았고, 음주경험에서는 오히려 낮았다. 아버지만 외국출생인 청소년은 양 부모가 한국출생인 청소년에 비해 성관계 경험이나 약물남용 위험이 높았으나 다른 일탈행위에서는 차이를 보이지 않았다. 양 부모가 외국출생인 청소년은 양 부모가 한국출생인 청소년에 비해 음주를 제외한 모든 일탈행위에서 커다란 위험에 놓여 있었다. 이러한 분석결과는 다문화가족 청소년들이 처한 가족 및 사회적 환경이 하위 유형에 따라 다르기 때문에 각 집단에 알맞은 사회 통합 정책이 고안되어야함을 시사한다.", + "issue": "1", + "libraryCatalog": "www.dbpia.co.kr", + "pages": "41-74", + "publicationTitle": "한국사회학", + "url": "https://www.dbpia.co.kr/Journal/articleDetail?nodeId=NODE06648914", + "volume": "50", + "attachments": [ + { + "title": "Snapshot", + "mimeType": "text/html" + } + ], + "tags": [ + { + "tag": "Adolescents of multi-cultural families" + }, + { + "tag": "juvenile delinquency" + }, + { + "tag": "sociological theories of delinquency" + }, + { + "tag": "다문화가족 청소년" + }, + { + "tag": "사회학적 일탈론" + }, + { + "tag": "일탈" + }, + { + "tag": "일탈행위성향" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://www.dbpia.co.kr/search/topSearch?startCount=0&collection=ALL&range=A&searchField=ALL&sort=RANK&query=flight&srchOption=*&includeAr=false&searchOption=*", + "defer": true, + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/DEPATISnet.js b/translators/DEPATISnet.js new file mode 100644 index 0000000..4924b68 --- /dev/null +++ b/translators/DEPATISnet.js @@ -0,0 +1,373 @@ +{ + "translatorID": "d76fea32-fe20-4c00-b5b9-bea8c688c2b0", + "label": "DEPATISnet", + "creator": "Klaus Flittner", + "target": "^https?://depatisnet\\.dpma\\.de/DepatisNet/depatisnet", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2019-12-07 20:44:27" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + DEPATISnet translator - Copyright © 2014 Klaus Flittner + + This program 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. + + This program 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 this program. If not, see . + + ***** END LICENSE BLOCK ***** +*/ + +function detectWeb(doc, url) { + if (url.includes("action=bibdat")) { + return "patent"; + } + if (url.includes("action=treffer") && Object.keys(getSearchResults(doc)).length) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc) { + var results = {}; + + var rows = ZU.xpath(doc, '//div[@id="inhalt"]/form/table/tbody/tr'); + + for (var i = 0, n = rows.length; i < n; i++) { + var columns = ZU.xpath(rows[i], './td'); + + var href = ZU.xpath(columns[0], './a')[0].href; + var name = ZU.trimInternal(columns[0].textContent); + name = name + " \"" + cleanTitle(columns[1]) + "\""; + + results[href] = name; + } + return results; +} + + +var labelMap = { + AN: "applicationNumber", + AB: "abstractNote", +}; + +function cleanTitle(value) { + var titles = value.textContent.split(/\[[A-Z]{2}\]/); + + if (titles.length < 2) { + return ""; + } + var title = ZU.trimInternal(titles[1]); + if (title == title.toUpperCase()) { + title = ZU.capitalizeTitle(title, true); + } + return title; +} + +function cleanName(name, inventors) { + name = ZU.trimInternal(name); + if (name == "") return ""; + + var parts = name.split(","); + + parts = parts.map( + function (part) { + part = ZU.trimInternal(part); + if (part.toUpperCase() == part) { + part = ZU.capitalizeTitle(part, true); + } + return part; + } + ); + + // Last is always country code, so only return first part if there are only two + // if second part starts with a number it is a postal code and first part is + // either a company name or a name without delimiter between last and given name + if (parts.length <= 2 || parts[1].match(/^[0-9]/)) { + if (inventors) { + name = parts[0].split(/ /); + return name.shift() + ", " + name.join(" "); + } + else { + return parts[0]; + } + } + else { + return parts[0] + ", " + parts[1]; + } +} + +function scrape(doc, url) { + var newItem = new Zotero.Item("patent"); + + var ipcs = []; + + var rows = ZU.xpath(doc, '//table[@class="tab_detail"]/tbody/tr'); + + for (var i = 0, n = rows.length; i < n; i++) { + var columns = ZU.xpath(rows[i], './td'); + + var label; + var value; + if (columns.length == 4) { + label = columns[2].textContent; + value = columns[3]; + } + else if (columns.length == 3) { + label = columns[1].textContent; + value = columns[2]; + } + if (!value) continue; + + // Z.debug("label: " + label); + // Z.debug("value: " + value.textContent); + + switch (label) { + case "TI": + newItem.title = cleanTitle(value); + break; + case "IN": + newItem.creators = []; + var creators = value.textContent.split(";"); + for (let creator of creators) { + creator = cleanName(creator, true); + if (creator != "") { + newItem.creators.push(ZU.cleanAuthor(creator, "inventor", true)); + } + } + break; + case "PA": + var assigneeNames = value.textContent.split(";").map(name => cleanName(name, false)).filter(name => name != ""); + newItem.assignee = assigneeNames.join("; "); + break; + case "ICM": + case "ICS": + var ipc = ZU.xpathText(value, './a').split(","); + for (let name of ipc) { + ipcs.push(ZU.trimInternal(name)); + } + break; + case "PUB": + var date = value.textContent.replace(/\s+/g, '').split("."); + newItem.date = date[2] + "-" + date[1] + "-" + date[0]; + break; + case "AD": + var filingDate = value.textContent.replace(/\s+/g, '').split("."); + newItem.filingDate = filingDate[2] + "-" + filingDate[1] + "-" + filingDate[0]; + break; + default: + if (labelMap[label]) { + newItem[labelMap[label]] = ZU.trimInternal(value.textContent); + } + } + } + + var pn = url.match(/\bdocid=([^&#]*)/)[1]; + + newItem.url = "http://depatisnet.dpma.de/DepatisNet/depatisnet?action=bibdat&docid=" + pn; + + newItem.patentNumber = pn.replace(/^([A-Z]{2})[0]*(.*)$/, "$1$2"); + + // some entries (especially JP and RU patents) have no titles listed in DepatisNet + // use the patentnumber instead for these entries + if (!newItem.title) { + newItem.title = newItem.patentNumber; + } + + newItem.extra = "IPC: " + ipcs.join("; "); + + newItem.attachments.push({ + title: "DEPATISnet patent record", + url: url, + snapshot: false + }); + + var pages = ZU.xpathText(doc, '//div[@id="inhalt"]/h2'); + // e.g. "Dokument DE000004446098C2 (Seiten: 8)" + // but there is no PDF available when we have "Seiten: 0" + if (pages && /(Seiten|Pages):\s*[1-9][0-9]*/.test(pages)) { + var pdfurl = "https://depatisnet.dpma.de/DepatisNet/depatisnet/" + pn + "_all_pages.pdf?window=1&space=menu&content=download_doc_verify&action=download_doc&docid=" + pn; + newItem.attachments.push({ + title: "Fulltext", + url: pdfurl, + mimeType: "application/pdf" + }); + } + + newItem.complete(); +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + var results = getSearchResults(doc); + + Z.selectItems(results, + function (items) { + if (!items) return; + + var urls = []; + for (var j in items) { + urls.push(j); + } + ZU.processDocuments(urls, scrape); + } + ); + } + else { + scrape(doc, url); + } +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://depatisnet.dpma.de/DepatisNet/depatisnet?action=bibdat&docid=DE000004446098C2", + "items": [ + { + "itemType": "patent", + "title": "Elektrischer Verbinder mit Abschirmung", + "creators": [ + { + "firstName": "Jacques", + "lastName": "Longueville", + "creatorType": "inventor" + }, + { + "firstName": "Gerhard", + "lastName": "Meyer", + "creatorType": "inventor" + } + ], + "issueDate": "1998-11-26", + "applicationNumber": "4446098", + "assignee": "Philips Patentverwaltung GmbH; Siemens AG", + "extra": "IPC: H01R 23/68; H01R 4/24; H01R 13/648; H01R 13/652", + "filingDate": "1994-12-22", + "patentNumber": "DE4446098C2", + "url": "http://depatisnet.dpma.de/DepatisNet/depatisnet?action=bibdat&docid=DE000004446098C2", + "attachments": [ + { + "title": "DEPATISnet patent record" + }, + { + "title": "Fulltext", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://depatisnet.dpma.de/DepatisNet/depatisnet?action=bibdat&docid=EP000000871998A1", + "items": [ + { + "itemType": "patent", + "title": "Elektrischer Verbinder Mit Abschirmung", + "creators": [ + { + "firstName": "Jacques", + "lastName": "Longueville", + "creatorType": "inventor" + }, + { + "firstName": "Gerhard", + "lastName": "Meyer", + "creatorType": "inventor" + } + ], + "issueDate": "1998-10-21", + "applicationNumber": "95942705", + "assignee": "Koninkl Philips Electronics Nv; Philips Patentverwaltung; Siemens Ag", + "extra": "IPC: H01R 12/16;", + "filingDate": "1995-12-20", + "patentNumber": "EP871998A1", + "url": "http://depatisnet.dpma.de/DepatisNet/depatisnet?action=bibdat&docid=EP000000871998A1", + "attachments": [ + { + "title": "DEPATISnet patent record" + }, + { + "title": "Fulltext", + "mimeType": "application/pdf" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://depatisnet.dpma.de/DepatisNet/depatisnet?action=bibdat&docid=AR000000047789A1", + "items": [ + { + "itemType": "patent", + "title": "Sistema De Inyeccion De Odorizante En El Gas Natural", + "creators": [], + "issueDate": "2006-02-22", + "abstractNote": "[XX] Un sistema de inyeccion de odorizante en el gas natural, para inyectar odorizante en un conducto de gas natural, que incluye un conducto de derivacion, un tanque de odorizante, un medidor de caudal, una válvula de control y un controlador acoplado para comunicarse con el medidor de caudal y con la válvula de control. El conducto de derivacion incluye una entrada que está en comunicacion fluida con una seccion corriente abajo del conducto de gas, y una salida que está en comunicacion fluida con una seccion corriente abajo del conducto de gas. El tanque de odorizante, la válvula de control y el medidor de caudal están dispuestos en el conducto de derivacion. El medidor de caudal detecta una característica de una corriente de fluido que lo atraviesa y genera una senal de flujo de fluido correspondiente. El controlador está programado para operar la válvula de control en base a la senal de flujo de fluido recibida del medidor de caudal.", + "applicationNumber": "P 050100188", + "assignee": "Fisher Controls Int", + "extra": "IPC: F17D 5/02; F17D 1/04; F17D 3/12; G01M 3/28; F17D 5/00", + "filingDate": "2005-01-19", + "patentNumber": "AR47789A1", + "url": "http://depatisnet.dpma.de/DepatisNet/depatisnet?action=bibdat&docid=AR000000047789A1", + "attachments": [ + { + "title": "DEPATISnet patent record" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://depatisnet.dpma.de/DepatisNet/depatisnet?action=bibdat&docid=JP002007522283A", + "items": [ + { + "itemType": "patent", + "title": "JP2007522283A", + "creators": [], + "issueDate": "2007-08-09", + "applicationNumber": "2006551227", + "extra": "IPC: C10L 3/10;", + "filingDate": "2005-01-18", + "patentNumber": "JP2007522283A", + "url": "http://depatisnet.dpma.de/DepatisNet/depatisnet?action=bibdat&docid=JP002007522283A", + "attachments": [ + { + "title": "DEPATISnet patent record" + } + ], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/DOAJ.js b/translators/DOAJ.js new file mode 100644 index 0000000..63d00ee --- /dev/null +++ b/translators/DOAJ.js @@ -0,0 +1,243 @@ +{ + "translatorID": "53734210-2284-437f-9896-8ad65917c343", + "label": "DOAJ", + "creator": "Abe Jellinek", + "target": "^https?://(www\\.)?doaj\\.org/(article|search)/", + "minVersion": "3.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2025-08-08 16:00:53" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2021 Abe Jellinek + + 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) { + if (doc.querySelector('meta[name="citation_title"]')) { + return "journalArticle"; + } + else if (getSearchResults(doc, true)) { + return "multiple"; + } + return false; +} + +function getSearchResults(doc, checkOnly) { + var items = {}; + var found = false; + var rows = doc.querySelectorAll('h3 > a[href*="/article/"]'); + for (let row of rows) { + let href = row.href; + let title = ZU.trimInternal(row.textContent); + if (!href || !title) continue; + if (checkOnly) return true; + found = true; + items[href] = title; + } + return found ? items : false; +} + +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { + Zotero.selectItems(getSearchResults(doc, false), function (items) { + if (items) ZU.processDocuments(Object.keys(items), scrape); + }); + } + else { + scrape(doc, url); + } +} + +function scrape(doc, url) { + var translator = Zotero.loadTranslator('web'); + // Embedded Metadata + translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); + translator.setDocument(doc); + + translator.setHandler('itemDone', function (obj, item) { + item.abstractNote = text(doc, '.article-details__abstract'); + item.attachments = []; + + for (let button of doc.querySelectorAll('.button')) { + if (button.textContent.toLowerCase().includes('read online')) { + item.url = button.href; + break; + } + } + + item.complete(); + }); + + translator.getTranslatorObject(function (trans) { + trans.doWeb(doc, url); + }); +} + +/** BEGIN TEST CASES **/ +var testCases = [ + { + "type": "web", + "url": "https://doaj.org/article/0006d8f8ca3e4af1b3ec14a07e88bb12", + "items": [ + { + "itemType": "journalArticle", + "title": "MiRNA Profiles in Lymphoblastoid Cell Lines of Finnish Prostate Cancer Families.", + "creators": [ + { + "firstName": "Daniel", + "lastName": "Fischer", + "creatorType": "author" + }, + { + "firstName": "Tiina", + "lastName": "Wahlfors", + "creatorType": "author" + }, + { + "firstName": "Henna", + "lastName": "Mattila", + "creatorType": "author" + }, + { + "firstName": "Hannu", + "lastName": "Oja", + "creatorType": "author" + }, + { + "firstName": "Teuvo L. J.", + "lastName": "Tammela", + "creatorType": "author" + }, + { + "firstName": "Johanna", + "lastName": "Schleutker", + "creatorType": "author" + } + ], + "date": "2015/01/01", + "DOI": "10.1371/journal.pone.0127427", + "ISSN": "1932-6203", + "abstractNote": "BACKGROUND:Heritable factors are evidently involved in prostate cancer (PrCa) carcinogenesis, but currently, genetic markers are not routinely used in screening or diagnostics of the disease. More precise information is needed for making treatment decisions to distinguish aggressive cases from indolent disease, for which heritable factors could be a useful tool. The genetic makeup of PrCa has only recently begun to be unravelled through large-scale genome-wide association studies (GWAS). The thus far identified Single Nucleotide Polymorphisms (SNPs) explain, however, only a fraction of familial clustering. Moreover, the known risk SNPs are not associated with the clinical outcome of the disease, such as aggressive or metastasised disease, and therefore cannot be used to predict the prognosis. Annotating the SNPs with deep clinical data together with miRNA expression profiles can improve the understanding of the underlying mechanisms of different phenotypes of prostate cancer. RESULTS:In this study microRNA (miRNA) profiles were studied as potential biomarkers to predict the disease outcome. The study subjects were from Finnish high risk prostate cancer families. To identify potential biomarkers we combined a novel non-parametrical test with an importance measure provided from a Random Forest classifier. This combination delivered a set of nine miRNAs that was able to separate cases from controls. The detected miRNA expression profiles could predict the development of the disease years before the actual PrCa diagnosis or detect the existence of other cancers in the studied individuals. Furthermore, using an expression Quantitative Trait Loci (eQTL) analysis, regulatory SNPs for miRNA miR-483-3p that were also directly associated with PrCa were found. CONCLUSION:Based on our findings, we suggest that blood-based miRNA expression profiling can be used in the diagnosis and maybe even prognosis of the disease. In the future, miRNA profiling could possibly be used in targeted screening, together with Prostate Specific Antigene (PSA) testing, to identify men with an elevated PrCa risk.", + "issue": "5", + "language": "en", + "libraryCatalog": "doaj.org", + "pages": "e0127427", + "publicationTitle": "PLoS ONE", + "url": "https://doi.org/10.1371/journal.pone.0127427", + "volume": "10", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://doaj.org/article/f36918ccae3243548729f113f8920ba2", + "items": [ + { + "itemType": "journalArticle", + "title": "Making every drop count: reducing wastage of a novel blood component for transfusion of trauma patients", + "creators": [ + { + "firstName": "Nathan", + "lastName": "Proudlove", + "creatorType": "author" + }, + { + "firstName": "Laura", + "lastName": "Green", + "creatorType": "author" + }, + { + "firstName": "Harriet", + "lastName": "Tucker", + "creatorType": "author" + }, + { + "firstName": "Anne", + "lastName": "Weaver", + "creatorType": "author" + }, + { + "firstName": "Ross", + "lastName": "Davenport", + "creatorType": "author" + }, + { + "firstName": "Jane", + "lastName": "Davies", + "creatorType": "author" + }, + { + "firstName": "Josephine", + "lastName": "McCullagh", + "creatorType": "author" + }, + { + "firstName": "Dave", + "lastName": "Edmondson", + "creatorType": "author" + }, + { + "firstName": "Julia", + "lastName": "Lancut", + "creatorType": "author" + }, + { + "firstName": "Angela", + "lastName": "Maddison", + "creatorType": "author" + } + ], + "date": "2021/09/01", + "DOI": "10.1136/bmjoq-2021-001396", + "ISSN": "2399-6641", + "abstractNote": "Recent research demonstrates that transfusing whole blood (WB=red blood cells (RBC)+plasma+platelets) rather than just RBC (which is current National Health Service (NHS) practice) may improve outcomes for major trauma patients. As part of a programme to investigate provision of WB, NHS Blood and Transplant undertook a 2-year feasibility study to supply the Royal London Hospital (RLH) with (group O negative, ‘O neg’) leucodepleted red cell and plasma (LD-RCP) for transfusion of trauma patients with major haemorrhage in prehospital settings.Incidents requiring such prehospital transfusion occur randomly, with very high variation. Availability is critical, but O neg LD-RCP is a scarce resource and has a limited shelf life (14 days) after which it must be disposed of. The consequences of wastage are the opportunity cost of loss of overall treatment capacity across the NHS and reputational damage.The context was this feasibility study, set up to assess deliverability to RLH and subsequent wastage levels. Within this, we conducted a quality improvement project, which aimed to reduce the wastage of LD-RCP to no more than 8% (ie, 1 of the 12 units delivered per week).Over this 2-year period, we reduced wastage from a weekly average of 70%–27%. This was achieved over four improvement cycles. The largest improvement came from moving near-expiry LD-RCP to the emergency department (ED) for use with their trauma patients, with subsequent improvements from embedding use in ED as routine practice, introducing a dedicated LD-RCP delivery schedule (which increased the units ≤2 days old at delivery from 42% to 83%) and aligning this delivery schedule to cover two cycles of peak demand (Fridays and Saturdays).", + "issue": "3", + "language": "en", + "libraryCatalog": "doaj.org", + "publicationTitle": "BMJ Open Quality", + "shortTitle": "Making every drop count", + "url": "https://bmjopenquality.bmj.com/content/10/3/e001396.full", + "volume": "10", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://doaj.org/search/articles?source=%7B%22query%22%3A%7B%22query_string%22%3A%7B%22query%22%3A%22test%22%2C%22default_operator%22%3A%22AND%22%7D%7D%2C%22size%22%3A50%2C%22sort%22%3A%5B%7B%22created_date%22%3A%7B%22order%22%3A%22desc%22%7D%7D%5D%7D", + "defer": true, + "items": "multiple" + } +] +/** END TEST CASES **/ diff --git a/translators/DOI Content Negotiation.js b/translators/DOI Content Negotiation.js new file mode 100644 index 0000000..b014266 --- /dev/null +++ b/translators/DOI Content Negotiation.js @@ -0,0 +1,352 @@ +{ + "translatorID": "b28d0d42-8549-4c6d-83fc-8382874a5cb9", + "label": "DOI Content Negotiation", + "creator": "Sebastian Karcher", + "target": "", + "minVersion": "5.0", + "maxVersion": "", + "priority": 100, + "inRepository": true, + "translatorType": 8, + "lastUpdated": "2025-07-27 04:51:26" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2019 Sebastian Karcher + + 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 detectSearch(items) { + return (filterQuery(items).length > 0); +} + +// return an array of DOIs from the query (items or text) +function filterQuery(items) { + if (!items) return []; + + if (typeof items == 'string' || !items.length) items = [items]; + + // filter out invalid queries + var dois = [], doi; + for (var i = 0, n = items.length; i < n; i++) { + if (items[i].DOI && (doi = ZU.cleanDOI(items[i].DOI))) { + dois.push(doi); + } + else if (typeof items[i] == 'string' && (doi = ZU.cleanDOI(items[i]))) { + dois.push(doi); + } + } + return dois; +} + +async function doSearch(items) { + for (let doi of filterQuery(items)) { + await processDOI(doi); + } +} + +async function processDOI(doi) { + // TEMP: Use Crossref REST for Crossref DOIs during Crossref outage + let currentDate = new Date(); + // Outage: 17 May 2025, 14:00–15:00 UTC + // Start 1 hour before (13:00 UTC) and end 2 hours after (17:00 UTC) + // TEMP for May 22 outage + let startDate = new Date(Date.UTC(2025, 4, 22, 00, 0, 0)); + let endDate = new Date(Date.UTC(2025, 4, 24, 0, 0, 0)); + + // At least for now, always use REST API for Crossref DOIs + // due to better reliability + // TEMP: Except don't, because some REST API requests are really slow + // https://forums.zotero.org/discussion/comment/496121/#Comment_496121 + //if (currentDate >= startDate && currentDate <= endDate) { + if (false) { + try { + let raJSON = await requestJSON( + `https://doi.org/ra/${encodeURIComponent(doi)}` + ); + if (raJSON.length) { + let ra = raJSON[0].RA; + if (ra == 'Crossref') { + let translate = Zotero.loadTranslator('search'); + // Crossref REST + translate.setTranslator("0a61e167-de9a-4f93-a68a-628b48855909"); + let item = { itemType: "journalArticle", DOI: doi }; + translate.setSearch(item); + translate.translate(); + return; + } + } + } + catch (e) { + Z.debug(e); + } + } + + let response = await requestText( + `https://doi.org/${encodeURIComponent(doi)}`, + { headers: { Accept: "application/vnd.datacite.datacite+json, application/vnd.crossref.unixref+xml, application/vnd.citationstyles.csl+json" } } + ); + // by content negotiation we asked for datacite or crossref format, or CSL JSON + if (!response) return; + Z.debug(response); + + let trans = Zotero.loadTranslator('import'); + trans.setString(response); + + if (response.includes("Other\nLe code est accompagné de commentaires de F. A. Vogel, qui signe l'épitre dédicatoire

    Other

    \nReliure 18è siècle

    Other

    \nEx-libris manuscrit \"Ex libris Dufour\"" + } + ], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": { + "DOI": "10.7336/academicus.2014.09.05" + }, + "items": [ + { + "itemType": "journalArticle", + "title": "Second world war, communism and post-communism in Albania, an equilateral triangle of a tragic trans-Adriatic story. The Eftimiadi’s Saga", + "creators": [ + { + "creatorType": "author", + "firstName": "Paolo", + "lastName": "Muner" + } + ], + "date": "01/2014", + "DOI": "10.7336/academicus.2014.09.05", + "ISSN": "20793715, 23091088", + "abstractNote": "The complicated, troubled and tragic events of a wealthy family from Vlorë, Albania, which a century ago expanded its business to Italy, in Brindisi and Trieste, and whose grand land tenures and financial properties in Albania were nationalized by Communism after the Second World War. Hence the life-long solitary and hopeless fight of the last heir of the family to reconquer his patrimony that had been nationalized by Communism. Such properties would have been endowed to a planned foundation, which aims at perpetuating the memory of his brother, who was active in the resistance movement during the war and therefore hung by the Germans. His main institutional purpose is to help students from the Vlorë area to attend the University of Trieste. The paper is a travel in time through history, sociology and the consolidation of a state’s fundamentals, by trying to read the past aiming to understand the presence and save the future. The paper highlights the need to consider past models of social solidarity meanwhile renewing the actual one. This as a re-establishment of rule and understanding, a strategy to cope with pressures to renegotiate the social contract, as a universal need, by considering the past’s experiences as a firm base for successful social interaction. All this, inside a story which in the first look seems to be too personal and narrow, meanwhile it highlights the present and the past in a natural organic connection, dedicated to a nation in continuous struggle for its social reconstruction.", + "libraryCatalog": "DOI.org (Crossref)", + "pages": "69-78", + "publicationTitle": "Academicus International Scientific Journal", + "rights": "https://creativecommons.org/licenses/by-nc-nd/4.0/", + "url": "https://www.medra.org/servlet/MREngine?hdl=10.7336/academicus.2014.09.05", + "volume": "9", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "search", + "input": [ + { + "DOI": "10.5555/12345678" + }, + { + "DOI": "10.1109/TPS.1987.4316723" + }, + { + "DOI": "10.5555/666655554444" + } + ], + "items": [ + { + "itemType": "journalArticle", + "title": "Toward a Unified Theory of High-Energy Metaphysics: Silly String Theory", + "creators": [ + { + "creatorType": "author", + "firstName": "Josiah", + "lastName": "Carberry" + }, + { + "creatorType": "contributor", + "fieldMode": 1, + "lastName": "Friends of Josiah Carberry" + } + ], + "date": "2008-08-14", + "DOI": "10.5555/12345678", + "ISSN": "0264-3561", + "abstractNote": "The characteristic theme of the works of Stone is the bridge between culture and society. Several narratives concerning the fatal !aw, and subsequent dialectic, of semioticist class may be found. Thus, Debord uses the term ‘the subtextual paradigm of consensus’ to denote a cultural paradox. The subject is interpolated into a neocultural discourse that includes sexuality as a totality. But Marx’s critique of prepatriarchialist nihilism states that consciousness is capable of signi\"cance. The main theme of Dietrich’s[1]model of cultural discourse is not construction, but neoconstruction. Thus, any number of narratives concerning the textual paradigm of narrative exist. Pretextual cultural theory suggests that context must come from the collective unconscious.", + "issue": "11", + "journalAbbreviation": "Journal of Psychoceramics", + "language": "en", + "libraryCatalog": "DOI.org (Crossref)", + "pages": "1-3", + "publicationTitle": "Journal of Psychoceramics", + "shortTitle": "Toward a Unified Theory of High-Energy Metaphysics", + "url": "https://ojs33.crossref.publicknowledgeproject.org/index.php/test/article/view/2", + "volume": "5", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + }, + { + "itemType": "journalArticle", + "title": "Bulk and Surface Plasmons in Artificially Structured Materials", + "creators": [ + { + "creatorType": "author", + "firstName": "John J.", + "lastName": "Quinn" + }, + { + "creatorType": "author", + "firstName": "Josiah S.", + "lastName": "Carberry" + } + ], + "date": "1987", + "DOI": "10.1109/TPS.1987.4316723", + "ISSN": "0093-3813", + "issue": "4", + "journalAbbreviation": "IEEE Trans. Plasma Sci.", + "libraryCatalog": "DOI.org (Crossref)", + "pages": "394-410", + "publicationTitle": "IEEE Transactions on Plasma Science", + "rights": "https://ieeexplore.ieee.org/Xplorehelp/downloads/license-information/IEEE.html", + "url": "http://ieeexplore.ieee.org/document/4316723/", + "volume": "15", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + }, + { + "itemType": "journalArticle", + "title": "The Memory Bus Considered Harmful", + "creators": [ + { + "creatorType": "author", + "firstName": "Josiah", + "lastName": "Carberry" + } + ], + "date": "2012-10-11", + "DOI": "10.5555/666655554444", + "ISSN": "0264-3561", + "issue": "11", + "journalAbbreviation": "Journal of Psychoceramics", + "language": "en", + "libraryCatalog": "DOI.org (Crossref)", + "pages": "1-3", + "publicationTitle": "Journal of Psychoceramics", + "url": "https://ojs33.crossref.publicknowledgeproject.org/index.php/test/article/view/8", + "volume": "9", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } +] +/** END TEST CASES **/ diff --git a/translators/DOI.js b/translators/DOI.js new file mode 100644 index 0000000..bd60cdd --- /dev/null +++ b/translators/DOI.js @@ -0,0 +1,322 @@ +{ + "translatorID": "c159dcfe-8a53-4301-a499-30f6549c340d", + "label": "DOI", + "creator": "Simon Kornblith", + "target": "", + "minVersion": "3.0", + "maxVersion": "", + "priority": 400, + "inRepository": true, + "translatorType": 4, + "browserSupport": "gcsibv", + "lastUpdated": "2024-06-04 14:34:03" +} + +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2019 Simon Kornblith + + 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 ***** +*/ + +// TODO Detect DOIs more correctly. +// The actual rules for DOIs are very lax-- but we're more strict. +// Specifically, we should allow space characters, and all Unicode +// characters except for control characters. Here, we're cheating +// by not allowing ampersands, to fix an issue with getting DOIs +// out of URLs. +// Additionally, all content inside