{ "translatorID": "12541207-ed80-4b59-9d46-fafa3aa61f7f", "label": "Library Catalog (Polaris)", "creator": "Aurimas Vinckevicius", "target": "/polaris/search/(searchresults|title)\\.aspx\\?", "minVersion": "3.0", "maxVersion": "", "priority": 250, "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", "lastUpdated": "2015-02-19 04:55:29" } /* ***** BEGIN LICENSE BLOCK ***** Polaris Library Catalog Translator Copyright © 2015 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 ***** */ /** Sample catalogs * http://pac.kings.edu/polaris/ * http://librarycatalog.eugene-or.gov/Polaris/ * http://www.clan.lib.nv.us/polaris/ */ function detectWeb(doc, url) { if (url.indexOf('title.aspx') != -1 && getPos(url) !== null) { return getItemType(doc); } if (url.indexOf('searchresults.aspx') != -1 && getSearchResults(doc, true)) { return 'multiple' } } /** * Extract pos value from URL */ function getPos(url) { var m = url.match(/[?&]pos=(\d+)/); if (!m) return null; return m[1]; } function getItemType(doc) { var type = ZU.xpath(doc, '//td[@class="nsm-full-label" and starts-with(text(),"Format")]/following-sibling::td'); if (!type.length) return false; if (type.length != 1) { Zotero.debug("Item type detection matched multiple nodes!!"); } type = type[0].textContent.toLowerCase(); if (/\b(?:book|printed music)\b/.test(type)) { return 'book'; } if (/\b(?:sound recording|music)\b/.test(type)) { return 'audioRecording'; } if (/\b(?:dvd|videorecording)\b/.test(type)) { return 'film'; } if (/\b(?:map)\b/.test(type)) { return 'map'; } return 'document'; } function getSearchResults(doc, checkOnly) { var titles = doc.getElementsByClassName('nsm-brief-primary-title-group'); var items = {}, found = false; for (var i=0; i