commit 40ce69590ee4d5c574c3c39ab78b49c06b58657c
parent 744d6a5a0a4beaef285d19c4ec826905814718d2
Author: Matt Burton <mcburton@gmail.com>
Date: Sun, 22 Feb 2009 19:05:15 +0000
Addresses #1305, fixes fail on single items, fail on search is result of funky URL handling, needs some thorough investigation
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/translators/Library Catalog (Dynix).js b/translators/Library Catalog (Dynix).js
@@ -33,7 +33,7 @@ function doWeb(doc, url) {
if(detailsRe.test(uri)) {
uris.push(uri+'&fullmarc=true');
} else {
- var items = Zotero.Utilities.getItemArray(doc, doc, "ipac\.jsp\?.*uri=(?:full|link)=[0-9]|^javascript:buildNewList\\('.*uri%3Dfull%3D[0-9]");
+ var items = Zotero.Utilities.getItemArray(doc, doc, "ipac\.jsp\?.*uri=(?:full|link)=[0-9]|^javascript:buildNewList\\('.*uri%3Dfull%3D[0-9]", "Show details");
items = Zotero.selectItems(items);
if(!items) {
@@ -76,7 +76,14 @@ function doWeb(doc, url) {
var record = new marc.record();
while(elmt = elmts.iterateNext()) {
var field = Zotero.Utilities.superCleanString(newDoc.evaluate('./TD[1]/A[1]/text()[1]', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue);
- var value = newDoc.evaluate('./TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/A[1]', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
+ var value = newDoc.evaluate('./TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/A[1]', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
+
+ // value = null for non-marc table entries w/ that xpath
+ if (!value) {
+ value = '';
+ } else {
+ value = value.textContent;
+ }
if(field == "LDR") {
record.leader = value;