Fixes Project Muse PDF download.
This commit is contained in:
parent
107c1bdf4b
commit
2c8e8670f3
1 changed files with 7 additions and 6 deletions
|
@ -8,7 +8,7 @@
|
||||||
"maxVersion":"",
|
"maxVersion":"",
|
||||||
"priority":100,
|
"priority":100,
|
||||||
"inRepository":true,
|
"inRepository":true,
|
||||||
"lastUpdated":"2008-08-21 15:45:00"
|
"lastUpdated":"2008-12-22 19:36:35"
|
||||||
}
|
}
|
||||||
|
|
||||||
function detectWeb(doc, url) {
|
function detectWeb(doc, url) {
|
||||||
|
@ -30,8 +30,8 @@ function doWeb(doc, url) {
|
||||||
if(detectWeb(doc, url) == "multiple") {
|
if(detectWeb(doc, url) == "multiple") {
|
||||||
var items = new Array();
|
var items = new Array();
|
||||||
var attachments = new Array();
|
var attachments = new Array();
|
||||||
var pdfRe = /\.pdf$/i;
|
var pdfRe = /PDF/;
|
||||||
var htmlRe = /\.html$/i;
|
var htmlRe = /HTML/;
|
||||||
|
|
||||||
var tableRows = doc.evaluate('//div[@id="advancedsearch"]/save_form/table//tr',
|
var tableRows = doc.evaluate('//div[@id="advancedsearch"]/save_form/table//tr',
|
||||||
doc, nsResolver, XPathResult.ANY_TYPE, null);
|
doc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||||
|
@ -49,11 +49,12 @@ function doWeb(doc, url) {
|
||||||
// get attachments
|
// get attachments
|
||||||
attachments[input.value] = new Array();
|
attachments[input.value] = new Array();
|
||||||
for(var i=0; i<aTags.length; i++) {
|
for(var i=0; i<aTags.length; i++) {
|
||||||
if(pdfRe.test(aTags[i].href)) {
|
var linkText = aTags[i].textContent;
|
||||||
|
if(pdfRe.test(linkText)) {
|
||||||
attachments[input.value].push({url:aTags[i].href,
|
attachments[input.value].push({url:aTags[i].href,
|
||||||
title:"Project MUSE Full Text PDF",
|
title:"Project MUSE Full Text PDF",
|
||||||
mimeType:"application/pdf"});
|
mimeType:"application/pdf"});
|
||||||
} else if(htmlRe.test(aTags[i].href)) {
|
} else if(htmlRe.test(linkText)) {
|
||||||
attachments[input.value].push({url:aTags[i].href,
|
attachments[input.value].push({url:aTags[i].href,
|
||||||
title:"Project MUSE Snapshot",
|
title:"Project MUSE Snapshot",
|
||||||
mimeType:"text/html"});
|
mimeType:"text/html"});
|
||||||
|
@ -97,7 +98,7 @@ function doWeb(doc, url) {
|
||||||
var m = hostRe.exec(url);
|
var m = hostRe.exec(url);
|
||||||
var host = m[1];
|
var host = m[1];
|
||||||
|
|
||||||
var getPDF = doc.evaluate('//a[text() = "[Access article in PDF]"]', doc,
|
var getPDF = doc.evaluate('//a[text() = "PDF Version"]', doc,
|
||||||
nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
||||||
|
|
||||||
var newUrl = url.replace(host, host+"/metadata/zotero");
|
var newUrl = url.replace(host, host+"/metadata/zotero");
|
||||||
|
|
Loading…
Add table
Reference in a new issue