-
Notifications
You must be signed in to change notification settings - Fork 785
/
Copy pathRePEc - IDEAS.js
337 lines (320 loc) · 9.48 KB
/
RePEc - IDEAS.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
{
"translatorID": "bd2e6136-d8e5-4f76-906b-0fbcd888dd63",
"label": "RePEc - IDEAS",
"creator": "Philipp Zumstein",
"target": "^https?://ideas\\.repec\\.org/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2017-06-05 07:38:26"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2017 Philipp Zumstein
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 (typeByUrl(url)) {
return typeByUrl(url)
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
}
function typeByUrl (url) {
if (url.indexOf('/p/')>-1) {
return "report";
}
else if (url.indexOf('/a/')>-1) {
return "journalArticle";
}
else if (url.indexOf('/c/')>-1) {
return "computerProgram";
}
else if (url.indexOf('/b/')>-1) {
return "book";
}
else if (url.indexOf('/h/')>-1) {
return "bookSection";
}
else return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = ZU.xpath(doc, '//table[contains(@class, "res")]//span[contains(@class, "title")]/a|//ul[contains(@class, "paperlist")]//a');
for (var i=0; i<rows.length; i++) {
var href = rows[i].href;
var title = ZU.trimInternal(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);
}
}
function scrape(doc, url) {
var type = typeByUrl(url);
var translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
//translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) {
if (type=="report" && item.publicationTitle) {
item.seriesTitle = item.publicationTitle;
}
var pdfurl = ZU.xpathText(doc, '//form/input[@type="radio" and contains(@value, ".pdf")]/@value');
if (pdfurl) {
item.attachments.push({
url: pdfurl,
title: "Fullext PDF",
type: "application/pdf"
})
}
item.complete();
});
translator.getTranslatorObject(function(trans) {
trans.itemType = type;
trans.doWeb(doc, url);
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://ideas.repec.org/cgi-bin/htsearch?q=informal+economy",
"items": "multiple"
},
{
"type": "web",
"url": "https://ideas.repec.org/c/boc/bocode/s457392.html",
"items": [
{
"itemType": "computerProgram",
"title": "MCMCLINEAR: Stata module for MCMC sampling of linear models",
"creators": [
{
"firstName": "Sam",
"lastName": "Schulhofer-Wohl",
"creatorType": "author"
}
],
"date": "2012/01/05",
"abstractNote": "This package provides commands for Markov chain Monte Carlo (MCMC) sampling from the posterior distribution of linear models. Two models are provided in this version: a normal linear regression model (the Bayesian equivalent of regress), and a normal linear mixed model (the Bayesian equivalent of xtmixed).",
"company": "Boston College Department of Economics",
"libraryCatalog": "ideas.repec.org",
"shortTitle": "MCMCLINEAR",
"url": "https://ideas.repec.org/c/boc/bocode/s457392.html",
"attachments": [
{
"title": "Snapshot"
}
],
"tags": [
"MCMC",
"Markov Chain Monte Carlo",
"linear models",
"mixed models",
"posterior distribution",
"regression"
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://ideas.repec.org/a/rjr/romjef/vy2003i1p86-97.html#statistics",
"items": [
{
"itemType": "journalArticle",
"title": "Causes And Size Of Informal Economy In Romania",
"creators": [
{
"firstName": "Elena",
"lastName": "Pelinescu",
"creatorType": "author"
}
],
"date": "2003",
"abstractNote": "The paper aims to analyze the causes or the motivations of the households’ informal economy activities and to estimate the size of the Romanian informal economy. Using data for Romania, it was found that people perceived high taxes as the main cause of the informal activities. The data suggested that the subsistence motive represented the main reason for the households’ decision to operate in the informal economy. It was found that 36.1% of the interviewed households had incomes from a secondary job in 1996. The size of informal economy appears as different because of the method used for computation.",
"issue": "1",
"libraryCatalog": "ideas.repec.org",
"pages": "86-97",
"publicationTitle": "Journal for Economic Forecasting",
"url": "https://ideas.repec.org/a/rjr/romjef/vy2003i1p86-97.html",
"attachments": [
{
"title": "Snapshot"
}
],
"tags": [
"decent income",
"informal economy",
"taxation"
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://ideas.repec.org/p/iza/izadps/dp6212.html",
"items": [
{
"itemType": "report",
"title": "How Immigrant Children Affect the Academic Achievement of Native Dutch Children",
"creators": [
{
"firstName": "Asako",
"lastName": "Ohinata",
"creatorType": "author"
},
{
"firstName": "Jan C.",
"lastName": "van Ours",
"creatorType": "author"
}
],
"date": "2011/12",
"abstractNote": "In this paper, we analyze how the share of immigrant children in the classroom affects the educational attainment of native Dutch children. Our analysis uses data from various sources, which allow us to characterize educational attainment in terms of reading literacy, mathematical skills and science skills. We do not find strong evidence of negative spill-over effects from immigrant children to native Dutch children. Immigrant children themselves experience negative language spill-over effects from a high share of immigrant children in the classroom but no spill-over effects on maths and science skills.",
"institution": "Institute for the Study of Labor (IZA)",
"libraryCatalog": "ideas.repec.org",
"reportNumber": "6212",
"seriesTitle": "IZA Discussion Papers",
"url": "https://ideas.repec.org/p/iza/izadps/dp6212.html",
"attachments": [
{
"title": "Snapshot"
},
{
"title": "Fullext PDF",
"type": "application/pdf"
}
],
"tags": [
"educational attainment",
"immigrant children",
"peer effects"
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://ideas.repec.org/s/wbk/wbrwps.html",
"items": "multiple"
},
{
"type": "web",
"url": "https://ideas.repec.org/h/cdp/diam02/200203.html",
"items": [
{
"itemType": "bookSection",
"title": "O banco de dados relativo ao acervo da freguesia de N. Sra. do Pilar de Ouro Preto: registros paroquiais e as possibilidades da pesquisa",
"creators": [
{
"firstName": "Adalgisa Arantes",
"lastName": "Campos",
"creatorType": "author"
},
{
"firstName": "Betânia G.",
"lastName": "Figueiredo",
"creatorType": "author"
},
{
"firstName": "Francisco L. Teixeira",
"lastName": "Vinhosa",
"creatorType": "author"
},
{
"firstName": "Jeaneth Xavier de",
"lastName": "Araújo",
"creatorType": "author"
},
{
"firstName": "Marcos Aurélio de",
"lastName": "Paula",
"creatorType": "author"
},
{
"firstName": "Miriam Moura",
"lastName": "Lott",
"creatorType": "author"
},
{
"firstName": "Patrícia Porto de",
"lastName": "Oliveira",
"creatorType": "author"
},
{
"firstName": "Flávia Cristiny de",
"lastName": "Moura",
"creatorType": "author"
},
{
"firstName": "Tânia Mara Silva",
"lastName": "Alves",
"creatorType": "author"
},
{
"firstName": "Gilson Brandão",
"lastName": "Cheble",
"creatorType": "author"
}
],
"date": "2002",
"abstractNote": "No abstract is available for this item.",
"bookTitle": "Anais do X Seminário sobre a Economia Mineira [Proceedings of the 10th Seminar on the Economy of Minas Gerais]",
"libraryCatalog": "ideas.repec.org",
"publisher": "Cedeplar, Universidade Federal de Minas Gerais",
"shortTitle": "O banco de dados relativo ao acervo da freguesia de N. Sra. do Pilar de Ouro Preto",
"url": "https://ideas.repec.org/h/cdp/diam02/200203.html",
"attachments": [
{
"title": "Snapshot"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/