{ "translatorID": "176948f7-9df8-4afc-ace7-4c1c7318d426", "label": "ESpacenet", "creator": "Sebastian Karcher and Aurimas Vinckevicius", "target": "^https?://worldwide\\.espacenet\\.com/", "minVersion": "3.0", "maxVersion": "", "priority": 100, "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", "lastUpdated": "2014-08-15 02:07:20" } /* ***** BEGIN LICENSE BLOCK ***** ESpacenet translator - Copyright © 2011 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("searchResults?") !== -1 && getSearchResults(doc).length) { return "multiple"; } if (url.indexOf("biblio") !== -1 && getTitle(doc)) { return "patent"; } } function getSearchResults(doc) { return ZU.xpath(doc,'//span[@class="resNumber"]/a[starts-with(@id,"publicationId")]'); } function getTitle(doc) { var title = ZU.xpathText(doc, '//div[@id="pagebody"]/h3[1]'); if(title) { if(title.toUpperCase() == title) { title = ZU.capitalizeTitle(title, true); } return title.trim(); } } //locale labels from URL var i18n = { /** German **/ de_EP: { "Erfinder:": "Inventor(s):", "Anmelder:": "Applicant(s):", "Klassifikation:": "Classification:", "Internationale": "international", "Europäische": "Euro", "Anmeldenummer:": "Application number:", "Prioritätsnummer(n):": "Priority number(s):", "Bookmark zur Seite": "Page bookmark" }, /** French **/ fr_EP: { "Inventeur(s)": "Inventor(s):", "Demandeur(s)": "Applicant(s):", "Classification:": "Classification:", "internationale": "international", "européenne": "Euro", "Numéro de demande": "Application number:", "Numéro(s) de priorité:": "Priority number(s):", "Signet": "Page bookmark" } } function initLocale(url) { var m = url.match(/[?&]locale=([^&]+)/); if(m && i18n[m[1]]) { i18n = i18n[m[1]]; } else { i18n = {}; //English } } function L(label, fromEN) { if(fromEN) { for(var l in i18n) { if(i18n[l] == label) { return l; } } return label; } return i18n[label] || label; } var labelMap = { "Application number:": "applicationNumber", "Priority number(s):": "priorityNumbers", "Page bookmark": "url" }; function applyValue(newItem, label, value) { if (value && labelMap[label]) { newItem[labelMap[label]] = value; } } //clean up names list and call callback with a clean name function cleanNames(names, callback) { if(names) { names = names.replace(/[()]/g, "").trim(); if(names == names.toUpperCase()) { names = ZU.capitalizeTitle(names, true); } names = names.split(/\s*;\s*/); for(var j=0, m=names.length; j