@@ -22,123 +22,6 @@ $( document ).ready(function(){
22
22
$ ( this ) . removeClass ( "subhover" ) ; //On hover out, remove class "subhover"
23
23
} ) ;
24
24
25
- //creating Astropy roles table & roles lists using roles.json
26
- var request = new XMLHttpRequest ( ) ;
27
- var dataURL = "roles.json" ;
28
- request . open ( 'GET' , dataURL ) ;
29
- request . responseType = 'json' ;
30
- request . send ( ) ;
31
-
32
- //log error when request gets failed
33
- request . onerror = function ( ) {
34
- console . log ( "XHR error" ) ;
35
- } ;
36
-
37
- request . onload = function ( ) {
38
- //received json data via XHR
39
- var data = request . response ;
40
- //creating roles table from json data
41
- createRolesTable ( data ) ;
42
- //creating roles lists from json data
43
- createRolesDescription ( data ) ;
44
- } ;
45
-
46
- function createRolesTable ( roles ) {
47
- //roles is an array of objects called "role"
48
- var rows = '' ;
49
- roles . forEach ( function ( role ) {
50
- //role is an object containing information about each team role
51
- //index marks current people
52
- var index = 0 ;
53
-
54
- // for roles where there are no sub-roles, the people are defined
55
- // at the top-level of the JSON role dict - for convenience below we create
56
- // a virtual sub-role with no heading
57
- if ( ! ( 'sub-roles' in role ) ) {
58
- role [ 'sub-roles' ] = [ { 'role' : '' ,
59
- 'people' : role [ 'people' ] } ] ;
60
- }
61
-
62
- //creating each row by iterating over each person in a role
63
- role [ "sub-roles" ] . forEach ( function ( subrole ) {
64
- //rowRole is displayed once for each role
65
- rowRole = index == 0 ? '<a href="#' + role [ "url" ] + '">' + role [ "role" ] + '</a>' : "" ;
66
-
67
- var rowSubRole = subrole [ 'role' ] ;
68
-
69
- if ( subrole [ 'people' ] [ 0 ] == "Unfilled" ) {
70
- rowPeople = '<a href="mailto:[email protected] "><span style="font-style: italic;">Unfilled</span></a>' ;
71
- } else {
72
- rowPeople = subrole [ 'people' ] . join ( ', ' ) ;
73
- }
74
-
75
- //generating rows
76
- if ( index == 0 ) {
77
- rows += '<tr class="border-top">' ;
78
- } else {
79
- rows += '<tr>' ;
80
- }
81
-
82
- rows += '<td>' + rowRole + '</td>' +
83
- '<td>' + rowSubRole + '</td>' +
84
- '<td>' + rowPeople + '</td>' +
85
- '</tr>' ;
86
- index ++ ;
87
- } ) ;
88
- } ) ;
89
-
90
- $ ( "#roles-table" ) . append ( rows ) ;
91
- }
92
-
93
- function createRolesDescription ( roles ) {
94
- //roles is an array of objects called "role"
95
- var blocks = "" ;
96
- roles . forEach ( function ( role ) {
97
- //role is an object containing information about each team role
98
- var list = "" ;
99
- //checking if role["description"] array isn't empty
100
- if ( role [ "responsibilities" ] != null ) {
101
-
102
- // If responsibilities is a dict, wrap inside a list so that all entries have a list
103
- // dicts
104
- if ( role [ 'responsibilities' ] . constructor == Object ) {
105
- role [ 'responsibilities' ] = [ role [ 'responsibilities' ] ] ;
106
- }
107
-
108
- console . log ( role [ 'responsibilities' ] ) ;
109
-
110
- blocks += '<br/>' +
111
- '<h3 id="' + role [ "url" ] + '">' + role [ "role-head" ] + '</h3>' ;
112
-
113
- index = 0 ;
114
-
115
- role [ 'responsibilities' ] . forEach ( function ( resp ) {
116
-
117
- console . log ( resp ) ;
118
-
119
- detail_list = '' ;
120
- resp [ "details" ] . forEach ( function ( detail ) {
121
- detail_list += '<li>' + detail + '</li>' ;
122
- } ) ;
123
-
124
- if ( 'subrole-head' in resp ) {
125
- if ( index > 0 ) {
126
- blocks += '<br>' ;
127
- }
128
- blocks += '<em>' + resp [ "subrole-head" ] + '</em>' ;
129
- }
130
- blocks += '<p>' + resp [ "description" ] + '</p>' +
131
- '<ul>' + detail_list + '</ul>' ;
132
-
133
- index += 1 ;
134
-
135
- } )
136
-
137
- }
138
- } ) ;
139
- $ ( "#roles-description" ) . append ( blocks ) ;
140
- }
141
-
142
25
$ ( '#os-selector ul' ) . each ( function ( ) {
143
26
// For each set of tabs, we want to keep track of
144
27
// which tab is active and it's associated content
@@ -255,6 +138,7 @@ function pypi_translator(pypiname) {
255
138
}
256
139
}
257
140
141
+
258
142
function bool_translator ( stable ) {
259
143
if ( stable ) {
260
144
return 'Yes' ;
@@ -263,6 +147,7 @@ function bool_translator(stable) {
263
147
}
264
148
}
265
149
150
+
266
151
function ghuser_translator ( fullname , ghname ) {
267
152
if ( fullname === undefined || ghname === undefined ) {
268
153
return 'None' ;
@@ -272,6 +157,7 @@ function ghuser_translator(fullname, ghname) {
272
157
}
273
158
}
274
159
160
+
275
161
var _email_regex_str = '[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}' ;
276
162
var _email_regex = new RegExp ( _email_regex_str , 'i' ) ;
277
163
var _email_with_name_regex = new RegExp ( '(.+)<(' + _email_regex_str + ')>' , 'i' ) ;
@@ -292,11 +178,118 @@ function maintainer_translator(maint, pkgnm) {
292
178
}
293
179
294
180
181
+ function createRolesTable ( roles ) {
182
+ //roles is an array of objects called "role"
183
+ var rows = '' ;
184
+ roles . forEach ( function ( role ) {
185
+ //role is an object containing information about each team role
186
+ //index marks current people
187
+ var index = 0 ;
188
+
189
+ // for roles where there are no sub-roles, the people are defined
190
+ // at the top-level of the JSON role dict - for convenience below we create
191
+ // a virtual sub-role with no heading
192
+ if ( ! ( 'sub-roles' in role ) ) {
193
+ role [ 'sub-roles' ] = [ { 'role' : '' ,
194
+ 'people' : role [ 'people' ] } ] ;
195
+ }
196
+
197
+ //creating each row by iterating over each person in a role
198
+ role [ "sub-roles" ] . forEach ( function ( subrole ) {
199
+ //rowRole is displayed once for each role
200
+ rowRole = index == 0 ? '<a href="#' + role [ "url" ] + '">' + role [ "role" ] + '</a>' : "" ;
201
+
202
+ var rowSubRole = subrole [ 'role' ] ;
203
+
204
+ if ( subrole [ 'people' ] [ 0 ] == "Unfilled" ) {
205
+ rowPeople = '<a href="mailto:[email protected] "><span style="font-style: italic;">Unfilled</span></a>' ;
206
+ } else {
207
+ rowPeople = subrole [ 'people' ] . join ( ', ' ) ;
208
+ }
209
+
210
+ //generating rows
211
+ if ( index == 0 ) {
212
+ rows += '<tr class="border-top">' ;
213
+ } else {
214
+ rows += '<tr>' ;
215
+ }
216
+
217
+ rows += '<td>' + rowRole + '</td>' +
218
+ '<td>' + rowSubRole + '</td>' +
219
+ '<td>' + rowPeople + '</td>' +
220
+ '</tr>' ;
221
+ index ++ ;
222
+ } ) ;
223
+ } ) ;
224
+
225
+ $ ( "#roles-table" ) . append ( rows ) ;
226
+ }
227
+
228
+
229
+ function createRolesDescription ( roles ) {
230
+ //roles is an array of objects called "role"
231
+ var blocks = "" ;
232
+ roles . forEach ( function ( role ) {
233
+ //role is an object containing information about each team role
234
+ var list = "" ;
235
+ //checking if role["description"] array isn't empty
236
+ if ( role [ "responsibilities" ] != null ) {
237
+
238
+ // If responsibilities is a dict, wrap inside a list so that all entries have a list
239
+ // dicts
240
+ if ( role [ 'responsibilities' ] . constructor == Object ) {
241
+ role [ 'responsibilities' ] = [ role [ 'responsibilities' ] ] ;
242
+ }
243
+
244
+ //console.log(role['responsibilities']);
245
+
246
+ blocks += '<br/>' +
247
+ '<h3 id="' + role [ "url" ] + '">' + role [ "role-head" ] + '</h3>' ;
248
+
249
+ index = 0 ;
250
+
251
+ role [ 'responsibilities' ] . forEach ( function ( resp ) {
252
+
253
+ //console.log(resp);
254
+
255
+ detail_list = '' ;
256
+ resp [ "details" ] . forEach ( function ( detail ) {
257
+ detail_list += '<li>' + detail + '</li>' ;
258
+ } ) ;
259
+
260
+ if ( 'subrole-head' in resp ) {
261
+ if ( index > 0 ) {
262
+ blocks += '<br>' ;
263
+ }
264
+ blocks += '<em>' + resp [ "subrole-head" ] + '</em>' ;
265
+ }
266
+ blocks += '<p>' + resp [ "description" ] + '</p>' +
267
+ '<ul>' + detail_list + '</ul>' ;
268
+
269
+ index += 1 ;
270
+
271
+ } )
272
+
273
+ }
274
+ } ) ;
275
+ $ ( "#roles-description" ) . append ( blocks ) ;
276
+ }
277
+
278
+
279
+ function populateRoles ( data , tstat , xhr ) {
280
+ //creating roles table from json data
281
+ createRolesTable ( data ) ;
282
+ //creating roles lists from json data
283
+ createRolesDescription ( data ) ;
284
+ }
285
+
286
+
295
287
function populateTables ( data , tstat , xhr ) {
296
288
populatePackageTable ( 'coordinated' , filter_pkg_data ( data , "coordinated" , true ) ) ;
297
289
populatePackageTable ( 'affiliated' , filter_pkg_data ( data , "coordinated" , false ) ) ;
298
290
}
299
291
292
+
300
293
function filter_pkg_data ( data , field , value ) {
301
294
if ( data === null ) {
302
295
return null ;
@@ -401,13 +394,14 @@ var review_color_map = {'Unmaintained': "red",
401
394
"Needs work" : "red"
402
395
} ;
403
396
397
+
404
398
function makeShields ( pkg ) {
405
399
var shield_string = "" ;
406
400
407
401
var key , shield_name , pkgvalue , color , url ;
408
402
409
403
for ( key in review_name_map ) {
410
- console . log ( "K" + key ) ;
404
+ // console.log("K"+key);
411
405
if ( review_name_map . hasOwnProperty ( key ) ) {
412
406
shield_name = review_name_map [ key ] ;
413
407
if ( "review" in pkg && key in pkg . review ) {
@@ -426,6 +420,7 @@ function makeShields(pkg) {
426
420
return shield_string
427
421
}
428
422
423
+
429
424
function guess_os ( ) {
430
425
var OSName = "source" ;
431
426
if ( navigator . appVersion . indexOf ( "Win" ) != - 1 ) OSName = "windows" ;
0 commit comments