Adding Rintze's PLoS fixes. PLoS has consolidating everything to one platform.
This commit is contained in:
parent
fb743dfd3c
commit
3777004652
|
@ -2,57 +2,82 @@
|
||||||
"translatorID":"9575e804-219e-4cd6-813d-9b690cbfc0fc",
|
"translatorID":"9575e804-219e-4cd6-813d-9b690cbfc0fc",
|
||||||
"translatorType":4,
|
"translatorType":4,
|
||||||
"label":"PLoS Journals",
|
"label":"PLoS Journals",
|
||||||
"creator":"Michael Berkowitz",
|
"creator":"Michael Berkowitz And Rintze Zelle",
|
||||||
"target":"http://www\\.plos(one|ntds|compbiol|pathogens|genetics)\\.org/(search|article)/",
|
"target":"http://www\\.plos(one|ntds|compbiol|pathogens|genetics|medicine|biology)\\.org/(search|article)/",
|
||||||
"minVersion":"1.0.0b4.r5",
|
"minVersion":"1.0.0b4.r5",
|
||||||
"maxVersion":"",
|
"maxVersion":"",
|
||||||
"priority":100,
|
"priority":100,
|
||||||
"inRepository":true,
|
"inRepository":true,
|
||||||
"lastUpdated":"2009-01-08 08:19:07"
|
"lastUpdated":"2009-05-31 20:57:07"
|
||||||
}
|
}
|
||||||
|
|
||||||
function detectWeb(doc, url) {
|
function detectWeb(doc, url) {
|
||||||
if (url.indexOf("Search.action") != -1 || url.indexOf("browse.action") != -1) {
|
if (url.indexOf("Search.action") != -1 || url.indexOf("browse.action") != -1 || url.indexOf("browseIssue.action") != -1) {
|
||||||
return "multiple";
|
return "multiple";
|
||||||
} else if (url.indexOf("article") != -1) {
|
} else if (url.indexOf("article/info") != -1) {
|
||||||
return "journalArticle";
|
return "journalArticle";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function doWeb(doc, url) {
|
|
||||||
|
function getSelectedItems(doc, articleRegEx) {
|
||||||
var items = new Object();
|
var items = new Object();
|
||||||
var texts = new Array();
|
var texts = new Array();
|
||||||
|
var articles = doc.evaluate(articleRegEx, doc, null, XPathResult.ANY_TYPE, null);
|
||||||
|
var next_art = articles.iterateNext();
|
||||||
|
while (next_art) {
|
||||||
|
items[next_art.href] = next_art.textContent;
|
||||||
|
next_art = articles.iterateNext();
|
||||||
|
}
|
||||||
|
items = Zotero.selectItems(items);
|
||||||
|
for (var i in items) {
|
||||||
|
texts.push(i);
|
||||||
|
}
|
||||||
|
return(texts);
|
||||||
|
}
|
||||||
|
|
||||||
|
function doWeb(doc, url) {
|
||||||
if (url.indexOf("Search.action") != -1 || url.indexOf("browse.action") != -1) {
|
if (url.indexOf("Search.action") != -1 || url.indexOf("browse.action") != -1) {
|
||||||
var articlex = '//span[@class="article"]/a';
|
var articlex = '//span[@class="article"]/a';
|
||||||
var articles = doc.evaluate(articlex, doc, null, XPathResult.ANY_TYPE, null);
|
var texts = getSelectedItems(doc, articlex);
|
||||||
var next_art = articles.iterateNext();
|
} else if (url.indexOf("browseIssue.action") != -1) {
|
||||||
while (next_art) {
|
var articlex = '//div[@class="article"]/h3/a';
|
||||||
items[next_art.href] = next_art.textContent;
|
var texts = getSelectedItems(doc, articlex);
|
||||||
next_art = articles.iterateNext();
|
|
||||||
}
|
|
||||||
items = Zotero.selectItems(items);
|
|
||||||
for (var i in items) {
|
|
||||||
texts.push(i);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
texts.push(url);
|
var texts = new Array(url);
|
||||||
}
|
}
|
||||||
Zotero.Utilities.processDocuments(texts, function(newDoc, url) {
|
|
||||||
var doi = newDoc.location.href.match(/doi(\/|%2F)(.*)$/)[2];
|
var risLinks = new Array();
|
||||||
var newURL = newDoc.location.href.replace("info", "getRisCitation.action?articleURI=info");
|
for (var i in texts) {
|
||||||
var pdfURL = newDoc.location.href.replace("info", "fetchObjectAttachment.action?uri=info") + '&representation=PDF';
|
texts[i]=texts[i].replace(/;jsessionid[^;]+/, "");//Strip sessionID string
|
||||||
Zotero.Utilities.HTTP.doGet(newURL, function(text) {
|
var risLink = texts[i].replace("info", "getRisCitation.action?articleURI=info");
|
||||||
var translator = Zotero.loadTranslator("import");
|
risLinks.push(risLink);
|
||||||
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
|
}
|
||||||
translator.setString(text);
|
|
||||||
translator.setHandler("itemDone", function(obj, item) {
|
Zotero.Utilities.HTTP.doGet(risLinks, function(text) {
|
||||||
item.attachments.push({url:pdfURL, title:"PLoS One Full Text PDF", mimeType:"application/pdf"});
|
var risLink = texts.shift();
|
||||||
item.DOI = doi;
|
var pdfURL = risLink.replace("info", "fetchObjectAttachment.action?uri=info") + '&representation=PDF';
|
||||||
item.repository = item.publicationTitle;
|
var doi = risLink.match(/doi(\/|%2F)(.*)$/)[2];
|
||||||
item.complete();
|
text = text.replace(text.match(/(ER[^\n]*)([^\0]*)/)[2],"");//Remove stray M3-tag at the end of the RIS record
|
||||||
});
|
text = text.replace("%2F","/");//Replace %2F characters by forward slashes in url
|
||||||
translator.translate();
|
doi = doi.replace("%2F","/");//Replace %2F characters by forward slashes in doi
|
||||||
|
|
||||||
|
// grab the UR link for a snapshot then blow it away
|
||||||
|
var snapshot = text.match(/UR\s+\-\s+(.*)/)[1];
|
||||||
|
text = text.replace(/UR\s+\-(.*)/, "");
|
||||||
|
|
||||||
|
var translator = Zotero.loadTranslator("import");
|
||||||
|
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
|
||||||
|
translator.setString(text);
|
||||||
|
translator.setHandler("itemDone", function(obj, item) {
|
||||||
|
//item.attachments[0]=({url:pdfURL, title:"PLoS Full Text PDF", mimeType:"application/pdf"});
|
||||||
|
item.attachments.push({url:pdfURL, title:"PLoS Full Text PDF", mimeType:"application/pdf"});
|
||||||
|
item.attachments.push({url:snapshot, title:"PLoS Snapshot", mimeType:"text/html", snapshot:true});
|
||||||
|
item.DOI = doi;
|
||||||
|
item.repository = item.publicationTitle;
|
||||||
|
item.complete();
|
||||||
});
|
});
|
||||||
|
translator.translate();
|
||||||
}, function() {Zotero.done();});
|
}, function() {Zotero.done();});
|
||||||
Zotero.wait();
|
Zotero.wait();
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user