forked from zotero/translators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Annual Reviews.js
216 lines (195 loc) · 6.87 KB
/
Annual Reviews.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
{
"translatorID": "5f22bd25-5b70-11e1-bb1d-c4f24aa18c1e",
"label": "Annual Reviews",
"creator": "Aurimas Vinckevicius",
"target": "https?://[^/]*annualreviews\\.org(:[\\d]+)?(?=/)[^?]*(/(toc|journal|doi)/|showMost(Read|Cited)Articles|doSearch)",
"minVersion": "3.0",
"maxVersion": "",
"priority": 200,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsib",
"lastUpdated": "2012-04-10 00:10:21"
}
/**
Copyright (c) 2012 Aurimas Vinckevicius
This program is free software: you can redistribute it and/or
modify it under the terms of the GNU Affero General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public
License along with this program. If not, see
<http://www.gnu.org/licenses/>.
*/
//add using BibTex
function addByBibTex(doi, tags) {
var baseUrl = 'http://www.annualreviews.org';
var risRequest = baseUrl + '/action/downloadCitation';
var articleUrl = baseUrl + '/doi/abs/' + doi;
var pdfUrl = baseUrl + '/doi/pdf/' + doi;
var postData = 'include=abs&direct=on&submit=Download+chapter+metadata&downloadFileName=citation' +
'&format=bibtex' + //bibtex
'&doi=' + encodeURIComponent(doi);
Zotero.Utilities.HTTP.doPost(risRequest, postData, function(text) {
var translator = Zotero.loadTranslator('import');
translator.setTranslator('9cb70025-a888-4a29-a210-93ec52da40d4'); //bibtex
translator.setString(text);
translator.setHandler('itemDone', function(obj, item) {
//title is sometimes in all caps
if(item.title == item.title.toUpperCase())
item.title = ZU.capitalizeTitle(item.title, true);
//add tags
if(tags) {
item.tags = tags;
}
//set PDF file
item.attachments = [{
url: pdfUrl,
title: 'Full Text PDF',
mimeType: 'application/pdf'
}];
item.complete();
});
translator.translate();
});
}
function detectWeb(doc, url) {
var title = doc.title.toLowerCase();
if( url.match(/\/doi\/(abs|full|pdf)\//) ) {
return 'journalArticle';
} else if( title.match('- table of contents -') ||
title.match('- most downloaded reviews') ||
title.match('- most cited reviews') ||
title.match('- forthcoming -') ||
title.match('search results') ||
url.match('/journal/') ) { //individual journal home page
return 'multiple';
}
}
function doWeb(doc, url) {
if( detectWeb(doc, url) == 'multiple' ) {
var articles = Zotero.Utilities.xpath(doc, '//div[@class="articleBoxWrapper"]');
var selectList = new Object();
var doi, title, article;
for( var i in articles ) {
article = articles[i];
doi = Zotero.Utilities.xpath(article, './div[@class="articleCheck"]/input');
title = Zotero.Utilities.xpathText(article, './div[@class="articleBoxMeta"]/h2/a');
if( doi && doi[0].value && title) {
selectList[doi[0].value] = title;
}
}
Zotero.selectItems(selectList, function(selectedItems) {
if(selectedItems == null) return true;
for(var item in selectedItems) {
addByBibTex(item);
}
});
} else {
var match = url.match(/\/(?:abs|full|pdf)\/([^?]+)/);
if(match) {
//get keywords before we leave
var tags, keywords = ZU.xpath(doc,
'//form[@id="frmQuickSearch"]\
/div[@class="pageTitle" and contains(text(), "KEYWORD")]\
/following-sibling::div/span[@class="data"]');
if(keywords) {
tags = new Array();
for(var i=0, n=keywords.length; i<n; i++) {
tags.push(keywords[i].textContent.trim());
}
}
addByBibTex(match[1], tags);
}
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://www.annualreviews.org/action/doSearch?pageSize=20&searchText=something&type=thisJournal&publication=1449&&",
"items": "multiple"
},
{
"type": "web",
"url": "http://www.annualreviews.org/journal/biophys",
"items": "multiple"
},
{
"type": "web",
"url": "http://www.annualreviews.org/toc/biophys/forthcoming",
"items": "multiple"
},
{
"type": "web",
"url": "http://www.annualreviews.org/toc/biophys/40/1",
"items": "multiple"
},
{
"type": "web",
"url": "http://www.annualreviews.org/action/showMostCitedArticles?topArticlesType=sinceInception&journalCode=biophys",
"items": "multiple"
},
{
"type": "web",
"url": "http://www.annualreviews.org/action/showMostReadArticles?topArticlesType=sinceInception&journalCode=biophys",
"items": "multiple"
},
{
"type": "web",
"url": "http://www.annualreviews.org/doi/abs/10.1146/annurev.biophys.29.1.545?prevSearch=&searchHistoryKey=",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"firstName": "Thomas D.",
"lastName": "Pollard",
"creatorType": "author"
},
{
"firstName": "Laurent",
"lastName": "Blanchoin",
"creatorType": "author"
},
{
"firstName": "R. Dyche",
"lastName": "Mullins",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"cell motility",
"WASp",
"Arp2/3 complex",
"ADF/cofilins",
"profilin"
],
"seeAlso": [],
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"title": "Molecular Mechanisms Controlling Actin Filament Dynamics in Nonmuscle Cells",
"publicationTitle": "Annual Review of Biophysics and Biomolecular Structure",
"volume": "29",
"issue": "1",
"pages": "545-576",
"date": "2000",
"DOI": "10.1146/annurev.biophys.29.1.545",
"url": "http://www.annualreviews.org/doi/abs/10.1146/annurev.biophys.29.1.545",
"abstractNote": "▪ Abstract We review how motile cells regulate actin filament assembly at their leading edge. Activation of cell surface receptors generates signals (including activated Rho family GTPases) that converge on integrating proteins of the WASp family (WASp, N-WASP, and Scar/WAVE). WASP family proteins stimulate Arp2/3 complex to nucleate actin filaments, which grow at a fixed 70° angle from the side of pre-existing actin filaments. These filaments push the membrane forward as they grow at their barbed ends. Arp2/3 complex is incorporated into the network, and new filaments are capped rapidly, so that activated Arp2/3 complex must be supplied continuously to keep the network growing. Hydrolysis of ATP bound to polymerized actin followed by phosphate dissociation marks older filaments for depolymerization by ADF/cofilins. Profilin catalyzes exchange of ADP for ATP, recycling actin back to a pool of unpolymerized monomers bound to profilin and thymosin-β4 that is poised for rapid elongation of new barbed ends.",
"libraryCatalog": "Annual Reviews",
"accessDate": "CURRENT_TIMESTAMP"
}
]
}
]
/** END TEST CASES **/