2008-09-11 04:40:07 +00:00
|
|
|
{
|
|
|
|
"translatorID":"2c310a37-a4dd-48d2-82c9-bd29c53c1c76",
|
|
|
|
"translatorType":4,
|
2010-10-15 22:58:34 +00:00
|
|
|
"label":"APS",
|
|
|
|
"creator":"Eugeniy Mikhailov and Michael Berkowitz",
|
2010-02-04 02:12:41 +00:00
|
|
|
"target":"https?://(?:www\\.)?(prola|prl|pra|prb|prc|prd|pre|prst-ab|prst-per|rmp)\\.aps\\.org[^/]*/(toc|abstract|forward|showrefs|supplemental)/",
|
2008-09-11 04:40:07 +00:00
|
|
|
"minVersion":"1.0.0b3.r1",
|
2010-01-23 19:35:21 +00:00
|
|
|
"maxVersion":null,
|
2008-09-11 04:40:07 +00:00
|
|
|
"priority":100,
|
|
|
|
"inRepository":true,
|
2011-01-11 04:39:29 +00:00
|
|
|
"lastUpdated":"2011-01-11 04:31:00"
|
2008-09-11 04:40:07 +00:00
|
|
|
}
|
2010-02-04 02:12:41 +00:00
|
|
|
// Works for all APS journals: http://publish.aps.org/
|
2008-09-11 04:40:07 +00:00
|
|
|
|
|
|
|
function detectWeb(doc, url) {
|
2010-01-23 19:35:21 +00:00
|
|
|
// toc indicates table of contents, forward is a "Citing articles" page
|
|
|
|
if (/\/toc\//.test(url) || (/\/forward\//.test(url))){
|
2008-09-11 04:40:07 +00:00
|
|
|
return "multiple";
|
|
|
|
} else {
|
|
|
|
return "journalArticle";
|
|
|
|
}
|
2010-01-23 19:35:21 +00:00
|
|
|
}
|
2008-09-11 04:40:07 +00:00
|
|
|
|
|
|
|
function doWeb(doc, url) {
|
|
|
|
var arts = new Array();
|
|
|
|
if (detectWeb(doc, url) == "multiple") {
|
2010-02-04 02:12:41 +00:00
|
|
|
var items = Zotero.Utilities.getItemArray(doc, doc, "abstract");
|
2008-09-11 04:40:07 +00:00
|
|
|
items = Zotero.selectItems(items);
|
|
|
|
for (var i in items) {
|
|
|
|
arts.push(i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
arts = [url];
|
|
|
|
}
|
|
|
|
|
|
|
|
Zotero.Utilities.processDocuments(arts, function(newDoc) {
|
|
|
|
Zotero.debug(newDoc.title);
|
2010-01-23 19:35:21 +00:00
|
|
|
// Use abstract only if we have one
|
|
|
|
if (newDoc.evaluate('//div[contains(@class, "aps-abstractbox")]/p', newDoc, null, XPathResult.ANY_TYPE, null).iterateNext()) var abs = Zotero.Utilities.trimInternal(newDoc.evaluate('//div[contains(@class, "aps-abstractbox")]/p', newDoc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
2008-09-11 04:40:07 +00:00
|
|
|
var urlRIS = newDoc.location.href;
|
2010-02-04 02:12:41 +00:00
|
|
|
urlRIS = urlRIS.replace(/(abstract|forward|showrefs|supplemental)/,"export");
|
2008-09-11 04:40:07 +00:00
|
|
|
var post = "type=ris";
|
|
|
|
var snapurl = newDoc.location.href;
|
2010-02-04 02:12:41 +00:00
|
|
|
var pdfurl = snapurl.replace(/(abstract|forward|showrefs|supplemental)/, "pdf");
|
2008-09-11 04:40:07 +00:00
|
|
|
Zotero.Utilities.HTTP.doPost(urlRIS, post, function(text) {
|
|
|
|
// load translator for RIS
|
|
|
|
var translator = Zotero.loadTranslator("import");
|
|
|
|
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
|
|
|
|
translator.setString(text);
|
|
|
|
translator.setHandler("itemDone", function(obj, item) {
|
|
|
|
if (item.itemID) {
|
|
|
|
item.DOI = item.itemID;
|
|
|
|
}
|
|
|
|
item.attachments = [
|
2010-02-04 02:12:41 +00:00
|
|
|
{url:snapurl, title:"APS Snapshot", mimeType:"text/html"},
|
|
|
|
{url:pdfurl, title:"APS Full Text PDF", mimeType:"application/pdf"}
|
2008-09-11 04:40:07 +00:00
|
|
|
];
|
2010-01-23 19:35:21 +00:00
|
|
|
if (abs) item.abstractNote = abs;
|
2008-09-11 04:40:07 +00:00
|
|
|
item.complete();
|
|
|
|
});
|
|
|
|
translator.translate();
|
2010-02-04 02:12:41 +00:00
|
|
|
}, null, 'UTF-8');
|
2009-01-08 08:28:59 +00:00
|
|
|
}, function() {Zotero.done();});
|
2008-09-11 04:40:07 +00:00
|
|
|
Zotero.wait();
|
|
|
|
}
|