-
Notifications
You must be signed in to change notification settings - Fork 0
/
A Contra Corriente.js
48 lines (46 loc) · 1.72 KB
/
A Contra Corriente.js
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
{
"translatorID":"bbf1617b-d836-4665-9aae-45f223264460",
"translatorType":4,
"label":"A Contra Corriente",
"creator":"Michael Berkowitz",
"target":"http://www.ncsu.edu/project/acontracorriente",
"minVersion":"1.0.0b4.r5",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2008-06-03 19:40:00"
}
function detectWeb(doc, url) {
if (doc.evaluate('//tr[td[1]//img][td[3]]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
return "multiple";
}
}
function doWeb(doc, url) {
var arts = doc.evaluate('//tr[td[1]//img][td[3]]', doc, null, XPathResult.ANY_TYPE, null);
var art;
var selectList = new Object();
var items = new Object();
while (art = arts.iterateNext()) {
var item = new Object();
var title = doc.evaluate('.//a', art, null, XPathResult.ANY_TYPE, null).iterateNext();
item['title'] = Zotero.Utilities.trimInternal(title.textContent);
item['pdfurl'] = title.href;
item['author'] = doc.evaluate('.//strong', art, null, XPathResult.ANY_TYPE, null).iterateNext().textContent;
selectList[item.title] = item.title;
items[item.title] = item;
}
var selected = Zotero.selectItems(selectList);
var voliss = Zotero.Utilities.trimInternal(doc.evaluate('//td[@class="red01"]/font[2]/strong', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
voliss = voliss.match(/Vol\.\s+(\d+),\s+No\.\s+(\d+)\.\s+([^|]+)|/);
Zotero.debug(voliss);
for each (var title in selected) {
var item = new Zotero.Item("journalArticle");
var olditem = items[title];
item.title = olditem.title;
item.creators = [Zotero.Utilities.cleanAuthor(olditem.author, "author")];
item.volume = voliss[1];
item.issue = voliss[2]
item.date = Zotero.Utilities.trimInternal(voliss[3]);
item.complete();
}
}