summaryrefslogtreecommitdiff
path: root/ProMED.js
blob: b837a71690133735b5abbb0c0408644ed9204012 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
	"translatorID": "3e9dbe21-10f2-40be-a921-f6ec82760927",
	"label": "ProMED",
	"creator": "Brandon Minich",
	"target": "^https?://www\\.promedmail\\.org",
	"minVersion": "3.0",
	"maxVersion": "",
	"priority": 100,
	"inRepository": true,
	"translatorType": 4,
	"browserSupport": "gcsibv",
	"lastUpdated": "2013-11-19 00:12:31"
}

function detectWeb(doc, url)  {
	if (url.toLowerCase().indexOf("direct.php?id=") != -1)  {
		return "email";
	}
} 
function doWeb(doc, url) {
		var newItem = new Zotero.Item('email');
		var info = ZU.xpathText(doc, '//div[@id="content_container"]//div/p[1]');
		Z.debug(info)
		var infos = info.replace(/Published Date:/, "").split(/Subject:|Archive Number:/)
		newItem.title = infos[1];
		newItem.date =infos[0];
		newItem.extra = "Archive Number: " + infos[2];
		newItem.url = doc.location.href;
		newItem.attachments = [{document:doc, title:"ProMED Email Snapshot", mimeType: "text/html"}]
		newItem.creators = [{lastName:"Internataional Society for Infection Diseases", fieldMode:true}]
	newItem.complete();
}/** BEGIN TEST CASES **/
var testCases = [
	{
		"type": "web",
		"url": "http://www.promedmail.org/direct.php?id=20130307.1574810",
		"items": [
			{
				"itemType": "email",
				"creators": [
					{
						"lastName": "Internataional Society for Infection Diseases",
						"fieldMode": true
					}
				],
				"notes": [],
				"tags": [],
				"seeAlso": [],
				"attachments": [
					{
						"title": "ProMED Email Snapshot",
						"mimeType": "text/html"
					}
				],
				"title": "PRO/AH/EDR> Chronic wasting disease, cervid - USA (03): (PA), 2012",
				"date": "2013-03-07 15:18:20",
				"extra": "Archive Number:  20130307.1574810",
				"url": "http://www.promedmail.org/direct.php?id=20130307.1574810",
				"libraryCatalog": "ProMED",
				"accessDate": "CURRENT_TIMESTAMP",
				"shortTitle": "PRO/AH/EDR> Chronic wasting disease, cervid - USA (03)"
			}
		]
	}
]
/** END TEST CASES **/