forked from zotero/translators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ACS Publications.js
182 lines (177 loc) · 7.95 KB
/
ACS Publications.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
{
"translatorID": "938ebe32-2b2e-4349-a5b3-b3a05d3de627",
"label": "ACS Publications",
"creator": "Sean Takats and Michael Berkowitz and Santawort",
"target": "^https?://[^/]*pubs3?\\.acs\\.org[^/]*/(?:wls/journals/query/(?:subscriberResults|query)\\.html|acs/journals/toc\\.page|cgi-bin/(?:article|abstract|sample|asap)\\.cgi)?",
"minVersion": "1.0.0b3.r1",
"maxVersion": "",
"priority": 100,
"browserSupport": "gcsib",
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2012-01-01 01:42:16"
}
function detectWeb(doc, url) {
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
if(doc.evaluate('//input[@id="articleListHeader_selectAllToc"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
Zotero.debug("multiple");
return "multiple";
} else if (doc.evaluate('//div[@id="articleHead"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
return "journalArticle";
}
return false;
}
function doWeb(doc, url){
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
var host = 'http://' + doc.location.host + "/";
Zotero.debug(host);
var m = url.match(/https?:\/\/[^\/]*\/doi\/(abs|full)\/([^\?]+)/);
var dois = new Array();
if(detectWeb(doc, url) == "multiple") { //search
var doi;
var title;
var availableItems = new Array();
var xpath = '//div[@class="articleBox" or @class="articleBox "]';
if (doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
elmts = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null);
var elmt = elmts.iterateNext();
do {
title = doc.evaluate('.//div[@class="titleAndAuthor"]/h2/a', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
doi = doc.evaluate('.//div[@class="titleAndAuthor"]/h2/a/@href', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent.replace("/doi/abs/","");
if (doi.indexOf("prevSearch") != -1){
doi = doi.substring(0,doi.indexOf("?"));
}
availableItems[doi] = title;
} while (elmt = elmts.iterateNext())
}
var items = Zotero.selectItems(availableItems);
if(!items) {
return true;
}
for(var i in items) {
dois.push(i);
}
} else if (m){ //single article
var doi = m[2];
Zotero.debug('DOI: ' + doi);
if (doi.match("prevSearch")) {
doi = doi.substring(0,doi.indexOf("?"));
}
Zotero.debug("DOI= "+doi);
dois.push(doi);
}
var setupSets = [];
for each (doi in dois) {
var citUrl = host + 'action/showCitFormats?doi=' + doi;
Zotero.debug("citUrl= " + citUrl);
setupSets.push({ doi: doi, citUrl: citUrl });
}
var setupCallback = function () {
//get citation export page's source code;
if (setupSets.length) {
var set = setupSets.shift();
Zotero.Utilities.HTTP.doGet(set.citUrl, function(text){
//get the exported RIS file name;
var downloadFileName = text.match(/name=\"downloadFileName\" value=\"([A-Za-z0-9_]+)\"/)[1];
Zotero.debug("downloadfilename= "+downloadFileName);
processCallback(set.doi,downloadFileName);
});
}
else {
Zotero.done();
}
}
var processCallback = function (doi,downloadFileName) {
var baseurl = "http://pubs.acs.org/action/downloadCitation";
var post = "doi=" + doi + "&downloadFileName=" + downloadFileName + "&include=abs&format=refman&direct=on&submit=Download+article+citation+data";
Zotero.Utilities.HTTP.doPost(baseurl, post,function(text){
// Fix the RIS doi mapping
text = text.replace("N1 - doi:","M3 - ");
Zotero.debug("ris= "+ text);
var translator = Zotero.loadTranslator("import");
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
translator.setString(text);
translator.setHandler("itemDone", function(obj, item) {
var pdfUrl = host + 'doi/pdf/' + doi;
var fullTextUrl = host + 'doi/full/' + doi;
item.attachments.push(
{title:"ACS Full Text PDF",url:pdfUrl, mimeType:"application/pdf"},
{title:"ACS Full Text Snapshot",url:fullTextUrl, mimeType:"text/html"}
);
item.complete();
});
translator.translate();
setupCallback();
});
}
setupCallback();
Zotero.wait();
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://pubs.acs.org/doi/full/10.1021/es103607c",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Majeau-Bettez",
"firstName": "Guillaume",
"creatorType": "author"
},
{
"lastName": "Hawkins",
"firstName": "Troy R.",
"creatorType": "author"
},
{
"lastName": "Strømman",
"firstName": "Anders Hammer",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": "http://dx.doi.org/10.1021/es103607c"
},
{
"title": "ACS Full Text PDF",
"url": "http://pubs.acs.org/doi/pdf/10.1021/es103607c",
"mimeType": "application/pdf"
},
{
"title": "ACS Full Text Snapshot",
"url": "http://pubs.acs.org/doi/full/10.1021/es103607c",
"mimeType": "text/html"
}
],
"title": "Life Cycle Environmental Assessment of Lithium-Ion and Nickel Metal Hydride Batteries for Plug-In Hybrid and Battery Electric Vehicles",
"date": "2011",
"DOI": "10.1021/es103607c",
"publicationTitle": "Environ. Sci. Technol.",
"pages": "4548-4554",
"volume": "45",
"issue": "10",
"publisher": "American Chemical Society",
"abstractNote": "This study presents the life cycle assessment (LCA) of three batteries for plug-in hybrid and full performance battery electric vehicles. A transparent life cycle inventory (LCI) was compiled in a component-wise manner for nickel metal hydride (NiMH), nickel cobalt manganese lithium-ion (NCM), and iron phosphate lithium-ion (LFP) batteries. The battery systems were investigated with a functional unit based on energy storage, and environmental impacts were analyzed using midpoint indicators. On a per-storage basis, the NiMH technology was found to have the highest environmental impact, followed by NCM and then LFP, for all categories considered except ozone depletion potential. We found higher life cycle global warming emissions than have been previously reported. Detailed contribution and structural path analyses allowed for the identification of the different processes and value-chains most directly responsible for these emissions. This article contributes a public and detailed inventory, which can be easily be adapted to any powertrain, along with readily usable environmental performance assessments.\nThis study presents the life cycle assessment (LCA) of three batteries for plug-in hybrid and full performance battery electric vehicles. A transparent life cycle inventory (LCI) was compiled in a component-wise manner for nickel metal hydride (NiMH), nickel cobalt manganese lithium-ion (NCM), and iron phosphate lithium-ion (LFP) batteries. The battery systems were investigated with a functional unit based on energy storage, and environmental impacts were analyzed using midpoint indicators. On a per-storage basis, the NiMH technology was found to have the highest environmental impact, followed by NCM and then LFP, for all categories considered except ozone depletion potential. We found higher life cycle global warming emissions than have been previously reported. Detailed contribution and structural path analyses allowed for the identification of the different processes and value-chains most directly responsible for these emissions. This article contributes a public and detailed inventory, which can be easily be adapted to any powertrain, along with readily usable environmental performance assessments.",
"ISBN": "0013-936X",
"ISSN": "0013-936X",
"url": "http://dx.doi.org/10.1021/es103607c",
"accessDate": "2011/10/19",
"libraryCatalog": "ACS Publications"
}
]
}
]
/** END TEST CASES **/