www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 553d419192b6617b6c34391f4a8f7fa648d6b765
parent b9430a5fb1a6626bc207efa9aee469ddfc3c34d6
Author: Sean Takats <sean@takats.org>
Date:   Tue, 28 Oct 2008 02:42:17 +0000

Fixes InnoPAC for Central Michigan University


Diffstat:
Mtranslators/Library Catalog (InnoPAC).js | 28++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/translators/Library Catalog (InnoPAC).js b/translators/Library Catalog (InnoPAC).js @@ -8,26 +8,34 @@ "maxVersion":"", "priority":200, "inRepository":true, - "lastUpdated":"2008-05-28 18:30:00" + "lastUpdated":"2008-10-28 02:41:28" } function detectWeb(doc, url) { + var namespace = doc.documentElement.namespaceURI; + var nsResolver = namespace ? function(prefix) { + if (prefix == 'x') return namespace; else return null; + } : null; + +// Central Michigan University fix + var xpath = '//div[@class="bibRecordLink"]'; + var elmt = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); + if(elmt) { + return "book"; + } + +// possibly disastrous edit to regular expression below if (!url.match(/SEARCH=/) && !url.match(/searchargs?=/) && !url.match(/&FF/)) return false; // First, check to see if the URL alone reveals InnoPAC, since some sites don't reveal the MARC button - var matchRegexp = new RegExp('^https?://[^/]+/search[^/]*\\??/[^/]+/[^/]+/[0-9]+\%2C[^/]+/frameset(.+)$'); + var matchRegexp = new RegExp('^https?://[^/]+/search[^/]*\\??/[^/]+/[^/]+/[^/]+\%2C[^/]+/frameset(.+)$'); if(matchRegexp.test(doc.location.href)) { if (!url.match("SEARCH") && !url.match("searchtype")) { return "book"; } } - // Next, look for the MARC button - var namespace = doc.documentElement.namespaceURI; - var nsResolver = namespace ? function(prefix) { - if (prefix == 'x') return namespace; else return null; - } : null; - - var xpath = '//a[img[@src="/screens/marcdisp.gif" or starts-with(@alt, "MARC ") or @src="/screens/regdisp.gif" or @alt="REGULAR RECORD DISPLAY"]]'; - var elmt = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); + // Next, look for the MARC button + xpath = '//a[img[@src="/screens/marcdisp.gif" or starts-with(@alt, "MARC ") or @src="/screens/regdisp.gif" or @alt="REGULAR RECORD DISPLAY"]]'; + elmt = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(elmt) { return "book"; }