Trans: Attach PDFs to ScienceDirect items

This commit is contained in:
Avram Lyon 2010-09-28 15:55:08 +00:00
parent 80f243db23
commit fbd744bd54

View file

@ -1,14 +1,14 @@
{ {
"translatorID":"b6d0a7a-d076-48ae-b2f0-b6de28b194e", "translatorID":"b6d0a7a-d076-48ae-b2f0-b6de28b194e",
"translatorType":4, "label":"ScienceDirect",
"label":"ScienceDirect", "creator":"Michael Berkowitz",
"creator":"Michael Berkowitz", "target":"https?://[^/]*science-?direct\\.com[^/]*/science(\\/article)?(\\?(?:.+\\&|)ob=(?:ArticleURL|ArticleListURL|PublicationURL))?",
"target":"https?://[^/]*science-?direct\\.com[^/]*/science(\\/article)?(\\?(?:.+\\&|)ob=(?:ArticleURL|ArticleListURL|PublicationURL))?", "minVersion":"1.0.0b3.r1",
"minVersion":"1.0.0b3.r1", "maxVersion":"",
"maxVersion":null, "priority":100,
"priority":100, "inRepository":true,
"inRepository":true, "translatorType":4,
"lastUpdated":"2010-01-25 08:05:00" "lastUpdated":"2010-09-28 19:51:15"
} }
function detectWeb(doc, url) { function detectWeb(doc, url) {
@ -74,7 +74,7 @@ function doWeb(doc, url) {
var scrape = function(newDoc, set) { var scrape = function(newDoc, set) {
var PDF; var PDF;
var tempPDF = newDoc.evaluate('//a[contains(@class, "noul") and contains(@class, "icon_pdf")]', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); var tempPDF = newDoc.evaluate('//a[contains(@class, "icon_pdf")]', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (!tempPDF) { // PDF xpath failed, lets try another if (!tempPDF) { // PDF xpath failed, lets try another
// TODO: others? // TODO: others?
//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();