forked from zotero/translators
-
Notifications
You must be signed in to change notification settings - Fork 4
/
APS.js
466 lines (449 loc) · 15.2 KB
/
APS.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
{
"translatorID": "2c310a37-a4dd-48d2-82c9-bd29c53c1c76",
"label": "APS",
"creator": "Aurimas Vinckevicius",
"target": "^https?://journals\\.aps\\.org/([^/]+/(abstract|supplemental|references|cited-by|issues)/|search(\\?|/))",
"minVersion": "3.0.12",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2017-01-14 21:44:41"
}
function detectWeb(doc, url) {
var title = doc.getElementById('title');
if (title && ZU.xpath(title, './/a[@id="export-article-link"]').length) {
return "journalArticle";
} else if (getSearchResults(doc, true)){
return "multiple";
}
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = ZU.xpath(doc, '//div[contains(@class, "search-results")]//div[contains(@class, "row")]//h5/a');
for (var i=0; i<rows.length; i++) {
var href = rows[i].href;
var title = ZU.trimInternal(cleanMath(rows[i].textContent));
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (!items) {
return true;
}
var articles = [];
for (var i in items) {
articles.push(i);
}
ZU.processDocuments(articles, scrape);
});
} else {
scrape(doc, url);
}
}
// Extension to mimeType mapping
var suppTypeMap = {
'pdf': 'application/pdf',
'zip': 'application/zip',
'doc': 'application/msword',
'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'xls': 'application/vnd.ms-excel',
'xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'mov': 'video/quicktime'
};
var dontDownload = [
'application/zip',
'video/quicktime'
];
function scrape(doc, url) {
url = url.replace(/[?#].*/, '');
if (url.indexOf('/abstract/') == -1) {
// Go to Abstract page first so we can scrape the abstract
url = url.replace(/\/(?:supplemental|references|cited-by)\//, '/abstract/');
if (url.indexOf('/abstract/') == -1) {
Zotero.debug('Unrecognized URL ' + url);
return;
}
ZU.processDocuments(url, function(doc, url) {
if (url.indexOf('/abstract/') == -1) {
Zotero.debug('Redirected when trying to go to abstract page. ' + url);
return;
}
scrape(doc, url)
});
return;
}
url = url.replace(/\/abstract\//, '/{REPLACE}/');
// fetch RIS
var risUrl = url.replace('{REPLACE}', 'export')
+ '?type=ris&download=true';
ZU.doGet(risUrl, function(text) {
text = text.replace(/^ID\s+-\s+/mg, 'DO - ');
var trans = Zotero.loadTranslator('import');
trans.setTranslator('32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7'); //RIS
trans.setString(text);
trans.setHandler('itemDone', function(obj, item) {
// scrape abstract from page
item.abstractNote = ZU.trimInternal(cleanMath(
ZU.xpathText(doc, '//section[contains(@class,"abstract")]/div[@class="content"]/p[1]')
));
// attach PDF
if (ZU.xpath(doc, '//div[@class="article-nav-actions"]/a[contains(text(), "PDF")]').length) {
item.attachments.push({
title: 'Full Text PDF',
url: url.replace('{REPLACE}', 'pdf'),
mimeType: 'application/pdf'
});
}
item.attachments.push({
title: "APS Snapshot",
document: doc
});
if (Z.getHiddenPref && Z.getHiddenPref('attachSupplementary')) {
ZU.processDocuments(url.replace('{REPLACE}', 'supplemental'), function(doc) {
try {
var asLink = Z.getHiddenPref('supplementaryAsLink');
var suppFiles = doc.getElementsByClassName('supplemental-file');
for (var i=0; i<suppFiles.length; i++) {
var link = suppFiles[i].getElementsByTagName('a')[0];
if (!link || !link.href) continue;
var title = link.getAttribute('data-id') || 'Supplementary Data';
var type = suppTypeMap[link.href.split('.').pop()];
if (asLink || dontDownload.indexOf(type) != -1) {
item.attachments.push({
title: title,
url: link.href,
mimeType: type || 'text/html',
snapshot: false
});
} else {
item.attachments.push({
title: title,
url: link.href,
mimeType: type
});
}
}
} catch (e) {
Z.debug('Could not attach supplemental data');
Z.debug(e);
}
}, function() { item.complete() });
} else {
item.complete();
}
});
trans.translate();
});
}
function cleanMath(str) {
//math tags appear to have duplicate content and are somehow left in even after textContent
return str.replace(/<(math|mi)[^<>]*>.*?<\/\1>/g, '');
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://journals.aps.org/prd/abstract/10.1103/PhysRevD.84.077701",
"items": [
{
"itemType": "journalArticle",
"title": "Hints for a nonstandard Higgs boson from the LHC",
"creators": [
{
"lastName": "Raidal",
"firstName": "Martti",
"creatorType": "author"
},
{
"lastName": "Strumia",
"firstName": "Alessandro",
"creatorType": "author"
}
],
"date": "October 21, 2011",
"DOI": "10.1103/PhysRevD.84.077701",
"abstractNote": "We reconsider Higgs boson invisible decays into Dark Matter in the light of recent Higgs searches at the LHC. Present hints in the Compact Muon Solenoid and ATLAS data favor a nonstandard Higgs boson with approximately 50% invisible branching ratio, and mass around 143 GeV. This situation can be realized within the simplest thermal scalar singlet Dark Matter model, predicting a Dark Matter mass around 50 GeV and direct detection cross section just below present bound. The present runs of the Xenon100 and LHC experiments can test this possibility.",
"issue": "7",
"journalAbbreviation": "Phys. Rev. D",
"libraryCatalog": "APS",
"pages": "077701",
"publicationTitle": "Physical Review D",
"url": "https://link.aps.org/doi/10.1103/PhysRevD.84.077701",
"volume": "84",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "APS Snapshot"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://journals.aps.org/prd/issues/84/7",
"items": "multiple"
},
{
"type": "web",
"url": "https://journals.aps.org/search/results?sort=relevance&clauses=%5B%7B%22operator%22:%22AND%22,%22field%22:%22all%22,%22value%22:%22test%22%7D%5D",
"items": "multiple"
},
{
"type": "web",
"url": "https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.114.098105",
"items": [
{
"itemType": "journalArticle",
"title": "Magnetic Flattening of Stem-Cell Spheroids Indicates a Size-Dependent Elastocapillary Transition",
"creators": [
{
"lastName": "Mazuel",
"firstName": "Francois",
"creatorType": "author"
},
{
"lastName": "Reffay",
"firstName": "Myriam",
"creatorType": "author"
},
{
"lastName": "Du",
"firstName": "Vicard",
"creatorType": "author"
},
{
"lastName": "Bacri",
"firstName": "Jean-Claude",
"creatorType": "author"
},
{
"lastName": "Rieu",
"firstName": "Jean-Paul",
"creatorType": "author"
},
{
"lastName": "Wilhelm",
"firstName": "Claire",
"creatorType": "author"
}
],
"date": "March 4, 2015",
"DOI": "10.1103/PhysRevLett.114.098105",
"abstractNote": "Cellular aggregates (spheroids) are widely used in biophysics and tissue engineering as model systems for biological tissues. In this Letter we propose novel methods for molding stem-cell spheroids, deforming them, and measuring their interfacial and elastic properties with a single method based on cell tagging with magnetic nanoparticles and application of a magnetic field gradient. Magnetic molding yields spheroids of unprecedented sizes (up to a few mm in diameter) and preserves tissue integrity. On subjecting these spheroids to magnetic flattening (over 150g), we observed a size-dependent elastocapillary transition with two modes of deformation: liquid-drop-like behavior for small spheroids, and elastic-sphere-like behavior for larger spheroids, followed by relaxation to a liquidlike drop.",
"issue": "9",
"journalAbbreviation": "Phys. Rev. Lett.",
"libraryCatalog": "APS",
"pages": "098105",
"publicationTitle": "Physical Review Letters",
"url": "https://link.aps.org/doi/10.1103/PhysRevLett.114.098105",
"volume": "114",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "APS Snapshot"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://journals.aps.org/prx/supplemental/10.1103/PhysRevX.5.011029",
"items": [
{
"itemType": "journalArticle",
"title": "Weyl Semimetal Phase in Noncentrosymmetric Transition-Metal Monophosphides",
"creators": [
{
"lastName": "Weng",
"firstName": "Hongming",
"creatorType": "author"
},
{
"lastName": "Fang",
"firstName": "Chen",
"creatorType": "author"
},
{
"lastName": "Fang",
"firstName": "Zhong",
"creatorType": "author"
},
{
"lastName": "Bernevig",
"firstName": "B. Andrei",
"creatorType": "author"
},
{
"lastName": "Dai",
"firstName": "Xi",
"creatorType": "author"
}
],
"date": "March 17, 2015",
"DOI": "10.1103/PhysRevX.5.011029",
"abstractNote": "Based on first-principle calculations, we show that a family of nonmagnetic materials including TaAs, TaP, NbAs, and NbP are Weyl semimetals (WSM) without inversion centers. We find twelve pairs of Weyl points in the whole Brillouin zone (BZ) for each of them. In the absence of spin-orbit coupling (SOC), band inversions in mirror-invariant planes lead to gapless nodal rings in the energy-momentum dispersion. The strong SOC in these materials then opens full gaps in the mirror planes, generating nonzero mirror Chern numbers and Weyl points off the mirror planes. The resulting surface-state Fermi arc structures on both (001) and (100) surfaces are also obtained, and they show interesting shapes, pointing to fascinating playgrounds for future experimental studies.",
"issue": "1",
"journalAbbreviation": "Phys. Rev. X",
"libraryCatalog": "APS",
"pages": "011029",
"publicationTitle": "Physical Review X",
"url": "https://link.aps.org/doi/10.1103/PhysRevX.5.011029",
"volume": "5",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "APS Snapshot"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://journals.aps.org/prx/references/10.1103/PhysRevX.5.011029",
"items": [
{
"itemType": "journalArticle",
"title": "Weyl Semimetal Phase in Noncentrosymmetric Transition-Metal Monophosphides",
"creators": [
{
"lastName": "Weng",
"firstName": "Hongming",
"creatorType": "author"
},
{
"lastName": "Fang",
"firstName": "Chen",
"creatorType": "author"
},
{
"lastName": "Fang",
"firstName": "Zhong",
"creatorType": "author"
},
{
"lastName": "Bernevig",
"firstName": "B. Andrei",
"creatorType": "author"
},
{
"lastName": "Dai",
"firstName": "Xi",
"creatorType": "author"
}
],
"date": "March 17, 2015",
"DOI": "10.1103/PhysRevX.5.011029",
"abstractNote": "Based on first-principle calculations, we show that a family of nonmagnetic materials including TaAs, TaP, NbAs, and NbP are Weyl semimetals (WSM) without inversion centers. We find twelve pairs of Weyl points in the whole Brillouin zone (BZ) for each of them. In the absence of spin-orbit coupling (SOC), band inversions in mirror-invariant planes lead to gapless nodal rings in the energy-momentum dispersion. The strong SOC in these materials then opens full gaps in the mirror planes, generating nonzero mirror Chern numbers and Weyl points off the mirror planes. The resulting surface-state Fermi arc structures on both (001) and (100) surfaces are also obtained, and they show interesting shapes, pointing to fascinating playgrounds for future experimental studies.",
"issue": "1",
"journalAbbreviation": "Phys. Rev. X",
"libraryCatalog": "APS",
"pages": "011029",
"publicationTitle": "Physical Review X",
"url": "https://link.aps.org/doi/10.1103/PhysRevX.5.011029",
"volume": "5",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "APS Snapshot"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://journals.aps.org/prx/cited-by/10.1103/PhysRevX.5.011003",
"items": [
{
"itemType": "journalArticle",
"title": "Ideal Negative Measurements in Quantum Walks Disprove Theories Based on Classical Trajectories",
"creators": [
{
"lastName": "Robens",
"firstName": "Carsten",
"creatorType": "author"
},
{
"lastName": "Alt",
"firstName": "Wolfgang",
"creatorType": "author"
},
{
"lastName": "Meschede",
"firstName": "Dieter",
"creatorType": "author"
},
{
"lastName": "Emary",
"firstName": "Clive",
"creatorType": "author"
},
{
"lastName": "Alberti",
"firstName": "Andrea",
"creatorType": "author"
}
],
"date": "January 20, 2015",
"DOI": "10.1103/PhysRevX.5.011003",
"abstractNote": "We report on a stringent test of the nonclassicality of the motion of a massive quantum particle, which propagates on a discrete lattice. Measuring temporal correlations of the position of single atoms performing a quantum walk, we observe a 6σ violation of the Leggett-Garg inequality. Our results rigorously excludes (i.e., falsifies) any explanation of quantum transport based on classical, well-defined trajectories. We use so-called ideal negative measurements—an essential requisite for any genuine Leggett-Garg test—to acquire information about the atom’s position, yet avoiding any direct interaction with it. The interaction-free measurement is based on a novel atom transport system, which allows us to directly probe the absence rather than the presence of atoms at a chosen lattice site. Beyond the fundamental aspect of this test, we demonstrate the application of the Leggett-Garg correlation function as a witness of quantum superposition. Here, we employ the witness to discriminate different types of walks spanning from merely classical to wholly quantum dynamics.",
"issue": "1",
"journalAbbreviation": "Phys. Rev. X",
"libraryCatalog": "APS",
"pages": "011003",
"publicationTitle": "Physical Review X",
"url": "https://link.aps.org/doi/10.1103/PhysRevX.5.011003",
"volume": "5",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "APS Snapshot"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/