-
Notifications
You must be signed in to change notification settings - Fork 785
/
Copy pathOAPEN.js
331 lines (308 loc) · 10.5 KB
/
OAPEN.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
{
"translatorID": "2100cedb-0a7d-4166-ab97-5e84e516cd81",
"label": "OAPEN",
"creator": "Abe Jellinek",
"target": "^https?://library\\.oapen\\.org/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-10-22 00:17:40"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero 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.
Zotero 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 Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, _url) {
if (doc.querySelector('meta[name="citation_title"]')) {
if (attr(doc, 'meta[name="DC.type"]', 'content') == 'chapter') {
return "bookSection";
}
else {
return "book";
}
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('.artifact-description > a');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.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) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
var translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) {
item.title = item.title.replace(' : ', ': ');
delete item.journalAbbreviation;
if (item.attachments.some(at => at.title == 'Full Text PDF')) {
item.attachments = item.attachments.filter(at => at.title != 'Snapshot');
}
for (let creator of item.creators) {
if (creator.firstName) {
creator.firstName = creator.firstName.replace(/\s*\[.*$/, '');
}
}
if (item.itemType == 'bookSection') {
let search = Zotero.loadTranslator('search');
search.setSearch({ DOI: item.DOI });
search.setHandler('translators', function (_, translators) {
search.setTranslator(translators);
search.translate();
});
search.setHandler('itemDone', function (_, doiItem) {
item.title = doiItem.title;
item.bookTitle = doiItem.bookTitle;
item.creators = doiItem.creators;
item.ISBN = doiItem.ISBN;
item.date = doiItem.date;
item.complete();
});
search.getTranslators();
}
else {
item.complete();
}
});
translator.getTranslatorObject(function (trans) {
if (attr(doc, 'meta[name="DC.type"]', 'content') == 'chapter') {
trans.itemType = 'bookSection';
}
trans.doWeb(doc, url);
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://library.oapen.org/handle/20.500.12657/39719",
"items": [
{
"itemType": "book",
"title": "Thou Shalt Forget: Indigenous sovereignty, resistance and the production of cultural oblivion in Canada",
"creators": [
{
"firstName": "Pierrot",
"lastName": "Ross-Tremblay",
"creatorType": "author"
}
],
"date": "2020",
"ISBN": "9781912250097",
"abstractNote": "What is ‘cultural oblivion’ and ‘psychological colonialism’, and how are they affecting the capacity of Indigenous Peoples in Canada to actively resist systematic and territorial oppression by the state? Following a decade-long research project, this new book by Pierrot Ross-Tremblay examines the production of oblivion among his own community, the Essipiunnuat [or, ‘People of the Brook Shells River’] and the relationship between a colonial imperative to forget. The book illustrates how the ‘cultural oblivion’ of vulnerable minority communities is a critical human rights issue but also asks us to reflect upon both the role of the state and the local elite in creating and warping our perception and understanding of history.",
"extra": "DOI: 10.14296/620.9781912250424",
"language": "English",
"libraryCatalog": "library.oapen.org",
"publisher": "University of London Press",
"shortTitle": "Thou Shalt Forget",
"url": "https://library.oapen.org/handle/20.500.12657/39719",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "colonialism"
},
{
"tag": "communities"
},
{
"tag": "indigenous people"
},
{
"tag": "minority"
},
{
"tag": "territory"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://library.oapen.org/handle/20.500.12657/39444",
"items": [
{
"itemType": "book",
"title": "Atlas: Makerspaces in Public Libraries in The Netherlands",
"creators": [
{
"firstName": "Olindo",
"lastName": "Caso",
"creatorType": "author"
},
{
"firstName": "Joran",
"lastName": "Kuijper",
"creatorType": "author"
}
],
"date": "2019",
"ISBN": "9789463661478",
"abstractNote": "Public libraries want to contribute to an inclusive and innovative society and aim to enable their patrons to acquire the necessary 21st century skills. Dutch public libraries are therefore gradually adding more and more activities to their curriculum, teaching these different types of skills, such as ‘invention literacy’. They also often provide a ‘performative space’ (i.e. a makerspace) for their patrons. This means library spaces are no longer dominated by books, but rather reflect the current development in libraries’ core business, moving from collections to connections in order to serve their local communities. The KB, the National Library of The Netherlands, participated in the KIEM1 project Performative Spaces in Dutch Public Libraries. Stepping Stones of Inclusive Innovation, researching the development of performative spaces in libraries. This project, a collaboration with the Faculty of Architecture and the Built Environment at the Delft University of Technology, fits the KBs strategic interests in providing an innovative and socially aware library system.",
"language": "English",
"libraryCatalog": "library.oapen.org",
"publisher": "TU Delft Open",
"shortTitle": "Atlas",
"url": "https://library.oapen.org/handle/20.500.12657/39444",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "AMG"
},
{
"tag": "GL"
},
{
"tag": "The Netherlands"
},
{
"tag": "bic Book Industry Communication::A The arts::AM Architecture::AMG Public buildings: civic"
},
{
"tag": "commercial"
},
{
"tag": "etc"
},
{
"tag": "industrial"
},
{
"tag": "library space"
},
{
"tag": "public libraries"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://library.oapen.org/discover?query=test",
"items": "multiple"
},
{
"type": "web",
"url": "https://library.oapen.org/handle/20.500.12657/49284",
"items": [
{
"itemType": "bookSection",
"title": "MEMS Technologies Enabling the Future Wafer Test Systems",
"creators": [
{
"creatorType": "editor",
"firstName": "Siva",
"lastName": "Yellampalli"
},
{
"creatorType": "author",
"firstName": "Bahadir",
"lastName": "Tunaboylu"
},
{
"creatorType": "author",
"firstName": "Ali M.",
"lastName": "Soydan"
}
],
"date": "2018-07-18",
"ISBN": "9781789233940 9781789233957",
"abstractNote": "As the form factor of microelectronic systems and chips are continuing to shrink, the demand for increased connectivity and functionality shows an unabated rising trend. This is driving the evolution of technologies that requires 3D approaches for the integration of devices and system design. The 3D technology allows higher packing densities as well as shorter chip-to-chip interconnects. Micro-bump technology with through-silicon vias (TSVs) and advances in flip chip technology enable the development and manufacturing of devices at bump pitch of 14 μm or less. Silicon carrier or interposer enabling 3D chip stacking between the chip and the carrier used in packaging may also offer probing solutions by providing a bonding platform or intermediate board for a substrate or a component probe card assembly. Standard vertical probing technologies use microfabrication technologies for probes, templates and substrate-ceramic packages. Fine pitches, below 50 μm bump pitch, pose enormous challenges and microelectromechanical system (MEMS) processes are finding applications in producing springs, probes, carrier or substrate structures. In this chapter, we explore the application of MEMS-based technologies on manufacturing of advanced probe cards for probing dies with various new pad or bump structures.",
"bookTitle": "MEMS Sensors - Design and Application",
"extra": "DOI: 10.5772/intechopen.73144",
"language": "English",
"libraryCatalog": "library.oapen.org",
"publisher": "InTechOpen",
"url": "https://library.oapen.org/handle/20.500.12657/49284",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "MEMS technology"
},
{
"tag": "agriculture::TJ Electronics & communications engineering::TJF Electronics engineering::TJFC Circuits & components"
},
{
"tag": "bic Book Industry Communication::T Technology"
},
{
"tag": "engineering"
},
{
"tag": "interconnects"
},
{
"tag": "interposer"
},
{
"tag": "wafer and package test systems"
},
{
"tag": "wafer probes"
}
],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/