{ "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