-
Notifications
You must be signed in to change notification settings - Fork 767
/
ACS Publications.js
180 lines (175 loc) · 7.85 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
{
"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,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2012-08-05 23:03:28"
}
function detectWeb(doc, url) {
if(doc.evaluate('//input[@id="articleListHeader_selectAllToc"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
Zotero.debug("multiple");
return "multiple";
} else if (doc.evaluate('//div[@id="articleHead"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
return "journalArticle";
}
return false;
}
function doWeb(doc, url){
var host = 'http://' + doc.location.host + "/";
var m = url.match(/https?:\/\/[^\/]*\/doi\/(abs|full)\/([^\?#]+)/);
var dois = new Array();
if(detectWeb(doc, url) == "multiple") { //search
var doi;
var title;
var items = new Array();
var xpath = '//div[@class="articleBox" or @class="articleBox "]';
if (doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
elmts = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null);
var elmt = elmts.iterateNext();
do {
title = doc.evaluate('.//div[@class="titleAndAuthor"]/h2/a', elmt, null, XPathResult.ANY_TYPE, null).iterateNext().textContent;
doi = doc.evaluate('.//div[@class="titleAndAuthor"]/h2/a/@href', elmt, null, XPathResult.ANY_TYPE, null).iterateNext().textContent.replace("/doi/abs/","");
if (doi.indexOf("prevSearch") != -1){
doi = doi.substring(0,doi.indexOf("?"));
}
items[doi] = title;
} while (elmt = elmts.iterateNext())
}
Zotero.selectItems(items, function (items) {
if (!items) {
return true;
}
for (var i in items) {
dois.push(i);
}
var setupSets = setup(dois, host);
scrape(setupSets, function () { });
});
} 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= setup(dois, host);
scrape(setupSets)
}
}
function setup(dois, host){
var setupSets = [];
for each (doi in dois) {
var citUrl = host + 'action/showCitFormats?doi=' + doi;
Zotero.debug("citUrl= " + citUrl);
setupSets.push({ doi: doi, citUrl: citUrl });
}
return setupSets
}
function scrape(setupSets){
//get citation export page's source code;
for (var i in setupSets){
var set = setupSets[i];
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);
var host = set.citUrl.replace(/action\/showCitFormats\?doi=.+/, "")
processCallback(set.doi, host, downloadFileName);
});
}
}
function processCallback(doi, host, 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("\nN1 - doi:", "\nM3 - ");
// Fix the wrong mapping for journal abbreviations
text = text.replace("\nJO -", "\nJA -");
// Use publication date when available
if(text.indexOf("\nDA -") !== -1) {
text = text.replace(/\nY1 - [^\n]*/, "").replace("\nDA -", "\nY1 -");
}
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 = [
{title:"ACS Full Text PDF",url:pdfUrl, mimeType:"application/pdf"},
{title:"ACS Full Text Snapshot",url:fullTextUrl, mimeType:"text/html"}
];
item.complete();
});
translator.translate();
});
}
/** 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": [
{
"title": "ACS Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "ACS Full Text Snapshot",
"mimeType": "text/html"
}
],
"DOI": "10.1021/es103607c",
"journalAbbreviation": "Environ. Sci. Technol.",
"issue": "10",
"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.",
"ISSN": "0013-936X",
"url": "http://dx.doi.org/10.1021/es103607c",
"libraryCatalog": "ACS Publications",
"title": "Life Cycle Environmental Assessment of Lithium-Ion and Nickel Metal Hydride Batteries for Plug-In Hybrid and Battery Electric Vehicles",
"date": "May 15, 2011",
"publicationTitle": "Environmental Science & Technology",
"pages": "4548-4554",
"volume": "45"
}
]
},
{
"type": "web",
"url": "http://pubs.acs.org/toc/nalefd/12/6",
"items": "multiple"
}
]
/** END TEST CASES **/