{ "translatorID": "446764bf-7da6-49ec-b7a7-fefcbafe317f", "label": "Library Catalog (Encore)", "creator": "Sebastian Karcher", "target": "/iii/encore/(record|search)", "minVersion": "1.0", "maxVersion": "", "priority": 270, "inRepository": true, "translatorType": 4, "browserSupport": "gcsb", "lastUpdated": "2014-08-26 03:59:48" } /* Encore Library Catalog Translator Copyright (C) 2011 Sebastian Karcher and CHNM This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ function detectWeb(doc, url){ var bibIdRe = new RegExp("encore/record"); if (bibIdRe.test(url)){ return "book"; } var bibIdSearch = new RegExp("encore/search"); if (bibIdSearch.test(url)){ return "multiple"; } } function doWeb(doc, url) { var uri = doc.location.href; var newUri; // load translator for MARC var translator = Zotero.loadTranslator("import"); translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); translator.getTranslatorObject(function(marc) { if (detectWeb(doc, url) == "book") { newUri = uri.replace(/\?/, "?marcData=Y&"); pageByPage(marc, [newUri]); } else { // Search results page // Require link to match this var tagRegexp = new RegExp(); tagRegexp.compile('^https?://[^/]+/search\\??/[^/]+/[^/]+/[0-9]+\%2C[^/]+/frameset'); var urls = new Array(); var availableItems = {}; var firstURL = false; var tableRows = doc.evaluate('//td[@class="browseResultContent" or @class="itemTitleCell"]|//div[contains(@class,"searchResult") and contains(@class, "Browse")] ', doc, null, XPathResult.ANY_TYPE, null); // Go through table rows var i = 0; while(tableRow = tableRows.iterateNext()) { // get link var links = ZU.xpath(tableRow, './/*[@class="dpBibTitle"]/span/a'); if (links.length==0) links = ZU.xpath(tableRow, './/*[@class="dpBibTitle"]/a'); for (var i=0; i