{ "translatorID": "6871e8c5-f935-4ba1-8305-0ba563ce3941", "label": "PEI Archival Information Network", "creator": "Adam Crymble, Sebastian Karcher", "target": "^https?://www\\.archives\\.pe\\.ca", "minVersion": "1.0.0b4.r5", "maxVersion": "", "priority": 100, "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", "lastUpdated": "2012-07-02 23:13:31" } function detectWeb(doc, url) { if (url.match(/dosearch\.php/)) { return "multiple"; } else if (url.match(/fondsdetail\.php/)){ return "book"; } } //PEI Archival Information Network translator: Code by Adam Crymble var authors; function associateData (newItem, dataTags, field, zoteroField) { if (dataTags[field]) { newItem[zoteroField] = dataTags[field]; } } function authors1() { for (var k = 0; k< authors.length; k++) { if (authors[k].match(", ")) { var author = authors[k].split(", "); authors[k] = (author[1] + (" ") + author[0].replace(/^\s*|\s*$/g, '')); newItem.creators.push(Zotero.Utilities.cleanAuthor(authors[k], "author")); } else { newItem.creators.push({lastName: authors[k], creatorType: "creator"}); } } } function scrape(doc, url) { var dataTags = new Object(); var fieldTitle; var contents; var tagsContent = new Array(); newItem = new Zotero.Item("book"); var xPathHeadings = doc.evaluate('//strong/small', doc, null, XPathResult.ANY_TYPE, null); var xPathContents = doc.evaluate('//td/ul|//td/pre/ul', doc, null, XPathResult.ANY_TYPE, null); var xPathCount = doc.evaluate('count(//strong/small)', doc, null, XPathResult.ANY_TYPE, null); for (i=0; i