{ "translatorID": "1e1e35be-6264-45a0-ad2e-7212040eb984", "label": "APA PsycNET", "creator": "Michael Berkowitz and Aurimas Vinckevicius", "target": "^https?://psycnet\\.apa\\.org/", "minVersion": "3.0", "maxVersion": "", "priority": 100, "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", "lastUpdated": "2013-09-21 18:25:29" } function detectWeb(doc, url) { var type; url = url.toLowerCase(); if (url.indexOf('search.searchresults') != -1) { //permission error (still relevant?) //return false; return "multiple"; } if(url.indexOf('search.displayrecord') != -1) { type = doc.getElementById('rdcPubType'); if(!type) return false; type = type.textContent.replace(/[\s\[\]]/g,'').split(';'); switch(type[0].toLowerCase()) { case 'book': return 'book'; case 'chapter': return 'bookSection'; case 'journalarticle': case 'editorial': return 'journalArticle'; default: return false; } } if(url.search(/journals\/\S+\/\d+\/\d+\/\d+\//) != -1) { return "journalArticle"; } if(url.search(/\/books\/\d+/) != -1) { fields.title = '(//h3[@id="bwcBookTitle"])[1]'; fields.authors = '(//div[@id="bwcBookAuthors"])[1]'; fields.voliss = '(//div[@id="bwcBookSource"])[1]'; fields.abstract = '(//div[@id="bwcAbstract"])[1]'; return "book"; } if(url.indexOf('buy.optiontobuy') != -1 && url.indexOf('id=') != -1 && (type = doc.getElementById('obArticleHeaderText')) ) { fields.title = '(//div[@id="obArticleTitleHighlighted"])[1]'; fields.authors = '(//div[@id="obAuthor"])[1]'; fields.voliss = '(//div[@id="obSource"])[1]'; fields.abstract = '(//div[@id="obAbstract"])[1]'; if(type.textContent.toLowerCase().indexOf('article') != -1) { return 'journalArticle'; } if(type.textContent.toLowerCase().indexOf('chapter') != -1) { return 'bookSection'; } } /**for the book database - item IDs ending in 000 are books * everything else chapters */ if (url.search(/psycinfo\/[0-9]{4}-[0-9]+-000/) != -1){ return "book"; } if (url.search(/psycinfo\/[0-9]{4}-[0-9]+-[0-9]{3}/) != -1){ return "bookSection"; } } //default field xpath var fields = { title: '(//div[@id="rdcTitle"])[1]', authors: '(//div[@id="rdcAuthors"])[1]', voliss: '(//div[@id="rdcSource"])[1]', abstract: '//div[@id="rdRecord"]/div[@class="rdRecordSection"][2]' } function getField(field, doc) { var val = ZU.xpathText(doc, field); if(val) val = ZU.trimInternal(val); return val; } //for scraping publication information directly from pages var volissRe = { journalArticle: /^(.+?)(?:,\sVol\s(\d+)\((\d+)\))?,\s(\w+\s(?:\d+\s*,\s)?\d{4}),\s(?:(\d+-\d+)|No Pagination Specified).(?:\sdoi:\s(.+))?$/i, bookSection: /^(.+?),\s\((\d{4})\)\.\s(.+?),\s\(pp\.\s(\d+-\d+)\)\.\s(.+?):\s(.+?),\s(?:(\w+))?,\s(\d+)\spp\.(?:\sdoi:\s(.+))?/i, book: /^(.+?):\s(.+?)(?:\.\s\((\d{4})\)\.\s(\w+)\s(\d+)\spp\.\sdoi:\s(.+))?$/i }; var creatorMap = { Ed: 'editor' }; function doWeb(doc, url) { var type = detectWeb(doc, url); if (type == "multiple") { var items = new Object(); var titles = ZU.xpath(doc, '//div[@class="srhcTitle"]/a'); for(var i=0, n=titles.length; i