Pushed ScienceDirect and ERIC

This commit is contained in:
Dan Stillman 2008-12-15 05:26:25 +00:00
parent c6491fa6a2
commit 6da81257f6
3 changed files with 10 additions and 11 deletions

View file

@ -1 +1 @@
2008-12-15 00:25:00 2008-12-15 05:30:00

View file

@ -8,7 +8,7 @@
"maxVersion":"", "maxVersion":"",
"priority":100, "priority":100,
"inRepository":true, "inRepository":true,
"lastUpdated":"2008-12-14 21:40:00" "lastUpdated":"2008-12-15 05:30:00"
} }
function detectWeb(doc, url) { function detectWeb(doc, url) {

View file

@ -8,7 +8,7 @@
"maxVersion":null, "maxVersion":null,
"priority":100, "priority":100,
"inRepository":true, "inRepository":true,
"lastUpdated":"2008-12-14 08:06:00" "lastUpdated":"2008-12-15 05:30:00"
} }
function detectWeb(doc, url) { function detectWeb(doc, url) {
@ -60,10 +60,10 @@ function doWeb(doc, url) {
var tempPDF = newDoc.evaluate('//a[@class="noul" and div/div[contains(text(), "PDF")]]', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); var tempPDF = newDoc.evaluate('//a[@class="noul" and div/div[contains(text(), "PDF")]]', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (!tempPDF) { // PDF xpath failed, lets try another if (!tempPDF) { // PDF xpath failed, lets try another
tempPDF = newDoc.evaluate('//a[@class="noul" and contains(text(), "PDF")]', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); tempPDF = newDoc.evaluate('//a[@class="noul" and contains(text(), "PDF")]', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (!tempPDF) { // second PDF xpath failed set PDF to null to avoid item.attachements if (!tempPDF) { // second PDF xpath failed set PDF to null to avoid item.attachments
PDF = null; var PDF = null;
} else { } else {
PDF = tempPDF.href; // second xpath succeeded, use that link var PDF = tempPDF.href; // second xpath succeeded, use that link
} }
} else { } else {
var PDF = tempPDF.href; // first xpath succeeded, use that link var PDF = tempPDF.href; // first xpath succeeded, use that link
@ -73,12 +73,12 @@ function doWeb(doc, url) {
var get = newDoc.evaluate('//a[img[contains(@src, "exportarticle_a.gif")]]', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().href; var get = newDoc.evaluate('//a[img[contains(@src, "exportarticle_a.gif")]]', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().href;
// if the PDF is available make it an attachment otherwise only use snapshot. // if the PDF is available make it an attachment otherwise only use snapshot.
if (PDF) { if (PDF) {
attachements = [ var attachments = [
{url:url, title:"ScienceDirect Snapshot", mimeType:"text/html"}, {url:url, title:"ScienceDirect Snapshot", mimeType:"text/html"},
{url:PDF, title:"ScienceDirect Full Text PDF", mimeType:"application/pdf"} // Sometimes PDF is null...I hope that is ok {url:PDF, title:"ScienceDirect Full Text PDF", mimeType:"application/pdf"} // Sometimes PDF is null...I hope that is ok
]; ];
} else { } else {
attachements = [ var attachments = [
{url:url, title:"ScienceDirect Snapshot", mimeType:"text/html"}, {url:url, title:"ScienceDirect Snapshot", mimeType:"text/html"},
]; ];
} }
@ -102,9 +102,8 @@ function doWeb(doc, url) {
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
translator.setString(text); translator.setString(text);
translator.setHandler("itemDone", function(obj, item) { translator.setHandler("itemDone", function(obj, item) {
item.attachments = attachements; item.attachments = attachments;
if(item.notes[0]) { if(item.notes[0]) {
item.abstractNote = item.notes[0].note; item.abstractNote = item.notes[0].note;
item.notes = new Array(); item.notes = new Array();