From c6491fa6a2b842b4f94ca16f4b1db0357c0f9cbe Mon Sep 17 00:00:00 2001 From: Matt Burton Date: Mon, 15 Dec 2008 02:42:40 +0000 Subject: [PATCH] Fixes #1226, error in the xpath that determined if page was single or multiple --- translators/ERIC.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/translators/ERIC.js b/translators/ERIC.js index bcc3119525..a7a7e419da 100644 --- a/translators/ERIC.js +++ b/translators/ERIC.js @@ -8,7 +8,7 @@ "maxVersion":"", "priority":100, "inRepository":true, - "lastUpdated":"2008-06-03 19:40:00" + "lastUpdated":"2008-12-14 21:40:00" } function detectWeb(doc, url) { @@ -19,9 +19,10 @@ function detectWeb(doc, url) { var searchpath='//form[@name="searchResultsForm"][@id="searchResultsForm"]'; if(doc.evaluate(searchpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) return "multiple"; - var singpath='//tr/td[@class="primaryHeader"][contains(text(), "Result Details")]'; - if(doc.evaluate(singpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { - var typepath='//tr[td/strong/text()="Pub Types:"]/td[2]/text()'; + //var singpath='//tr/td[@class="primaryHeader"][contains(text(), "Record Details")]'; + var singpath='contains(//div[@id="titleBarBlue"]/text(), "Record Details")'; + if(doc.evaluate(singpath, doc, nsResolver, XPathResult.ANY_TYPE, null).booleanValue) { + var typepath='//tr[td/span/strong/text()="Pub Types:"]/td[2]/text()'; var typestr=doc.evaluate(typepath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue; var typereg=new RegExp("([^;/\-]+)"); var typearr=typereg.exec(typestr); @@ -83,8 +84,8 @@ function doWeb(doc, url) { }); Zotero.wait(); } - var singpath='//tr/td[@class="primaryHeader"][contains(text(), "Result Details")]'; - if(doc.evaluate(singpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { + var singpath='contains(//div[@id="titleBarBlue"]/text(), "Record Details")'; + if(doc.evaluate(singpath, doc, nsResolver, XPathResult.ANY_TYPE, null).booleanValue) { var idpath='//input[@type="hidden"][@name="accno"]/@value'; var idpath2='//meta[@name="eric #"]/@content'; var id = url.match(/accno=([^&]+)/)[1];