Trans: Fix for ToC parsing in Highwire 2.0, reported http://forums.zotero.org/discussion/15140

This commit is contained in:
Avram Lyon 2010-11-15 21:39:20 +00:00
parent d4550807d8
commit f4f7ab93e9

View file

@ -8,7 +8,7 @@
"priority":100, "priority":100,
"inRepository":"1", "inRepository":"1",
"translatorType":4, "translatorType":4,
"lastUpdated":"2010-11-10 10:20:00" "lastUpdated":"2010-11-11 21:19:55"
} }
/* /*
@ -64,8 +64,10 @@ function doWeb(doc, url) {
var arts = new Array(); var arts = new Array();
if (detectWeb(doc, url) == "multiple") { if (detectWeb(doc, url) == "multiple") {
var items = new Object(); var items = new Object();
if (doc.title.match("Table of Contents") || doc.title.match("Early Edition") || url.match("content/firstcite")) { if (doc.title.match("Table of Contents")
var searchx = '//li[contains(@class, "cit toc-cit") and not(ancestor::div/h2/a/text() = "Correction" or ancestor::div/h2/a/text() = "Corrections")]'; || doc.title.match("Early Edition")
|| url.match("content/firstcite")) {
var searchx = '//li[contains(@class, "toc-cit") and not(ancestor::div/h2/a/text() = "Correction" or ancestor::div/h2/a/text() = "Corrections")]';
var titlex = './/h4'; var titlex = './/h4';
} else if (url.match("content/by/section") || url.match("cgi/collection/.+")) { } else if (url.match("content/by/section") || url.match("cgi/collection/.+")) {
var searchx = '//li[contains(@class, "results-cit cit")]'; var searchx = '//li[contains(@class, "results-cit cit")]';
@ -99,7 +101,6 @@ function doWeb(doc, url) {
return false; return false;
} }
Zotero.Utilities.HTTP.doGet(arts, function(text) { Zotero.Utilities.HTTP.doGet(arts, function(text) {
// FIXME This function should be redone with XPath to speed things up
var id, match, newurl, pdfurl, get; var id, match, newurl, pdfurl, get;
/* Here, we have to use three phrasings because they all occur, depending on /* Here, we have to use three phrasings because they all occur, depending on
the journal.*/ the journal.*/