Adding the contributed PROMED translator to the repo

This commit is contained in:
Matt Burton 2009-03-15 00:25:13 +00:00
parent e2fb31dfc5
commit ddc028ecb2

51
translators/ProMED.js Normal file
View file

@ -0,0 +1,51 @@
{
"translatorID":"3e9dbe21-10f2-40be-a921-f6ec82760927",
"translatorType":4,
"label":"ProMED",
"creator":"Brandon Minich",
"target":"http://www.promedmail.org",
"minVersion":"1.0.0b4.r5",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2009-02-26 11:27:31"
}
function detectWeb(doc, url) {
if (url.toLowerCase().indexOf("f2400_p") != -1) {
return "email";
}
}
function doWeb(doc, url) {
Zotero.debug(doc.title);
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
var newItem = new Zotero.Item('email');
if (doc.evaluate('//span[@id="F2400_P1001_SUBJECT"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
newItem.title= doc.evaluate('//span[@id="F2400_P1001_SUBJECT"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
} else if (doc.evaluate('//span[@id="F2400_P1202_SUBJECT"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
newItem.title = doc.evaluate('//span[@id="F2400_P1202_SUBJECT"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
}
if (doc.evaluate('//span[@id="F2400_P1001_PUBLISHED_DATE"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
newItem.date = doc.evaluate('//span[@id="F2400_P1001_PUBLISHED_DATE"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
} else if (doc.evaluate('//span[@id="F2400_P1202_PUBLISHED_DATE"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
newItem.date = doc.evaluate('//span[@id="F2400_P1202_PUBLISHED_DATE"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
}
if (doc.evaluate('//span[@id="F2400_P1001_ARCHIVE_NUMBER"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
newItem.extra = "Archive Number: " + doc.evaluate('//span[@id="F2400_P1001_ARCHIVE_NUMBER"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
} else if (doc.evaluate('//span[@id="F2400_P1202_ARCHIVE_NUMBER"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
newItem.extra = "Archive Number: " + doc.evaluate('//span[@id="F2400_P1202_ARCHIVE_NUMBER"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
}
newItem.url = doc.location.href;
newItem.complete();
}