Adding willsmith's 16Dec09 changes, updated xpaths to be compatible with search results & table of contents

This commit is contained in:
Matt Burton 2009-12-31 20:54:13 +00:00
parent 4f1b82ce90
commit 4c73c7f5b4

View file

@ -12,7 +12,7 @@
}
function detectWeb(doc, url) {
if (doc.title.indexOf("Table of Contents") != -1 || doc.title.indexOf("search result") != -1) {
if (doc.title.indexOf("Table of Contents") != -1 || doc.title.indexOf("Search Result") != -1) {
return "multiple";
} else if (url.indexOf("link?") != -1) {
return "journalArticle";
@ -34,13 +34,15 @@ function doWeb(doc, url) {
var titlesx = '//div[@id="contents"]/dl/dt';
var linksx = '//div[@id="contents"]/dl/dd/a[1]';
} else if (url.match(/jjap/)) {
var xpath = '/html/body/dt/a';
//var xpath = '/html/body/dt/a';
var titlesx = '//div[@id="contents"]//dl/dt/b';
var linksx = '//div[@id="contents"]//dl/dd/a[1]';
} else if (url.match(/jpsj/)) {
var xpath = '/html/body/dl/dt/a[contains(@href, "link")]';
}
} else if (doc.title.toLowerCase().indexOf("search result") != -1) {
var linksx = '/html/body//li/a';
var titlesx = '/html/body//li//b';
var titlesx = '/html/body//li//dt/b';
}
if (xpath) {
var titles = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null);
@ -58,6 +60,8 @@ function doWeb(doc, url) {
}
}
items = Zotero.selectItems(items);
if(!items) return true;
for (var i in items) {
arts.push(i);
}
@ -88,7 +92,7 @@ function doWeb(doc, url) {
voliss = voliss.match(/([^\d]+)(\d+)\s+\((\d+)\)\s+([\d\-]+)/);
var x = 4
} else {
voliss = voliss.match(/([^\d]+)(\d+)\s+\((\d+)\)\s+(pp\.)?\s+([\d\-]+)/);
voliss = voliss.match(/([^\d]+)(\d+)\s+\((\d+)\)\s+(pp\.)?\s+(\S+)/);
var x = 5
}
item.journalAbbreviation = Zotero.Utilities.trimInternal(voliss[1]);
@ -118,4 +122,4 @@ function doWeb(doc, url) {
];
}, function() {Zotero.done();});
Zotero.wait();
}
}