-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyscripts.js
More file actions
400 lines (369 loc) · 20.7 KB
/
Copy pathmyscripts.js
File metadata and controls
400 lines (369 loc) · 20.7 KB
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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
// Function to load profil from json
$(document).ready(function() {
$.getJSON("jsons/profil.json", function(data){
$("#myname").append(data.name);
$("#mytitle").append(data.title);
$("#img-profil").attr("src", data.image);
$("#abstract").append(data.abstract);
for (var i=0; i<data.keywords.length; i++){
if (i<data.keywords.length-1){
$("#keywords").append(data.keywords[i] + ', ');
}else{
$("#keywords").append(data.keywords[i] + '.');
}
}
});
});
// Function to load news from json
$(document).ready(function() {
$.getJSON("jsons/news.json", function(data){
var numToshow=5;
var newsdict = data.news;
for (var i=0; i< newsdict.length; i++){
if (i<numToshow){
$("#list-news").append( "<li style=\"display: list-item;\"><B>" + newsdict[i].date + ":</B> " + newsdict[i].content + "</li>" );
}else{
$("#list-news").append( "<li style=\"display: none;\"><B>" + newsdict[i].date + ":</B> " + newsdict[i].content + "</li>" );
}
}
// + or -
size_li = $("#list-news li").length;
x = numToshow;
$('#see-more').click(function () {
x= (x+1 <= size_li) ? x+5 : size_li;
$('#list-news li:lt('+x+')').show();
});
$('#see-less').click(function () {
x=(x-5<0) ? 5 : x-5;
x= (x<= 5) ? 5 : x;
$('#list-news li').not(':lt('+x+')').hide();
});
});
});
// Function to load projects from json
$(document).ready(function(){
$.getJSON("jsons/projects.json", function(data){
//current
for (var i=0; i<data.current.length; i++){
partner_string='';
if (data.current[i].partners.length>0){
partner_string = ' In collaboration with ';
for (e=0; e<data.current[i].partners.length; e++){
if (e>0){
if (e==(data.current[i].partners.length-1)){
partner_string = partner_string + ' and ';
}else{
partner_string = partner_string + ', ';
}
}
partner_string = partner_string + '<a href="' + data.current[i].partners_links[e] + '" target="_blank">' + data.current[i].partners[e] + '</a>';
}
partner_string = partner_string + '.';
}
if (data.current[i].link != ''){
projet_string='<B><a href="' + data.current[i].link + '" target="_blank">' + data.current[i].name + '</a> (' + data.current[i].date + '):</B> ' + data.current[i].topic + '. ';
}else{
projet_string='<B><a href="#research">' + data.current[i].name + '</a> (' + data.current[i].date + '):</B> ' + data.current[i].topic + '. ';
}
role_string='';
if (data.current[i].role != ''){
role_string = '<br><B>Role</B>: ' + data.current[i].role + '.';
}
funding_string='';
if (data.current[i].fundings != ''){
funding_string = ' <B>Fundings</B>: ' + data.current[i].fundings + '.';
}
$("#projects-current").append('<li>' + projet_string + role_string + partner_string + funding_string + '</li>');
}
// past
for (var i=0; i<data.past.length; i++){
if (data.past[i].link != ''){
projet_string='<B><a href="' + data.past[i].link + '" target="_blank">' + data.past[i].name + '</a></B> (' + data.past[i].date + ').';
}else{
projet_string='<B><a href="#research">' + data.past[i].name + '</a></B> (' + data.past[i].date + ').';
}
role_string='';
if (data.past[i].role != ''){
role_string = ' <B>Role:</B> ' + data.past[i].role + '.';
}
funding_string='';
if (data.past[i].fundings != ''){
funding_string = ' <B>Fundings:</B> ' + data.past[i].fundings + '.';
}
$("#projects-past").append('<li>' + projet_string + role_string + funding_string + '</li>');
}
});
});
// Function to load collabs from json
$(document).ready(function(){
$.getJSON("jsons/collabs.json", function(data){
//academic
for (var i=0; i<data.academic.length; i++){
if (data.academic[i].link != ''){
collab_string='<B><a href="' + data.academic[i].link + '" target="_blank">' + data.academic[i].name + '</a></B>, ' + data.academic[i].institution + ', ' + data.academic[i].country + '.';
}else{
collab_string='<B><a href="#">' + data.academic[i].name + '</a></B>, ' + data.academic[i].institution + ', ' + data.academic[i].country + '.';
}
$("#collabs-academic").append('<li>' + collab_string + '</li>');
}
// companies
for (var i=0; i<data.companies.length; i++){
if (data.companies[i].link != ''){
collab_string='<B><a href="' + data.companies[i].link + '" target="_blank">' + data.companies[i].name + '</a></B>, ' + data.companies[i].country + '.';
}else{
collab_string='<B><a href="#">' + data.companies[i].name + '</a></B>, ' + data.companies[i].country + '.';
}
$("#collabs-company").append('<li>' + collab_string + '</li>');
}
});
});
// Function to load people from json
$(document).ready(function(){
$.getJSON("jsons/people.json", function(data){
//permanent
var max_cols=6;
content_permanent = '<div class="row">';
for (var i=0; i<data.permanent.length; i++){
row_pic = '<div class="col-md-2" align="center"><img src="' + data.permanent[i].pic_links + '" width="200px" class="img-thumbnail img-responsive img-fluid center-block"><br>';
row_name = '<a href="' + data.permanent[i].link + '" target="_blank">' + data.permanent[i].firstname + '<br>' + data.permanent[i].lastname + '</a>';
row_position = '<br>' + data.permanent[i].position + '</div>';
content_permanent = content_permanent + row_pic + row_name + row_position;
if (((i+1)%max_cols)==0){// create a new row
content_permanent = content_permanent + '</div><div class="row">';
}
}
if ((data.permanent.length%max_cols)==0){
content_permanent = content_permanent + '</div>';
}
$("#permanent").append(content_permanent);
//phd
content_phd = '<div class="row">';
for (var i=0; i<data.student.length; i++){
row_pic_front = '<div class="flip-card-front"><img src="' + data.student[i].pic_links + '" width="200px" class="img-thumbnail img-responsive img-fluid center-block"></div>';
row_pic_back = '<div class="flip-card-back img-thumbnail"><br><br><p>' + data.student[i].position + '</p><p>' + data.student[i].dates + '</p></div>'
row_pic = '<div class="col-md-2" align="center"><div class="flip-card"><div class="flip-card-inner">' + row_pic_front + row_pic_back + '</div></div>'
row_name = '<a href="' + data.student[i].link + '" target="_blank">' + data.student[i].firstname + '<br>' + data.student[i].lastname + '</a></div>';
content_phd = content_phd + row_pic + row_name;
if (((i+1)%max_cols)==0){// create a new row
content_phd = content_phd + '</div><div class="row">';
}
}
if ((data.student.length%max_cols)==0){
content_phd = content_phd + '</div>';
}
$("#students").append(content_phd);
//alumnis
content_alumnis = '<div class="row">';
for (var i=0; i<data.alumni.length; i++){
//row_pic = '<div class="col-md-2" align="center"><img src="' + data.alumni[i].pic_links + '" width="200px" class="img-thumbnail img-responsive img-fluid center-block"><br>';
row_pic_front = '<div class="flip-card-front"><img src="' + data.alumni[i].pic_links + '" width="200px" class="img-thumbnail img-responsive img-fluid center-block"></div>';
row_pic_back = '<div class="flip-card-back img-thumbnail"><br><br><p>' + data.alumni[i].position + '</p><p>' + data.alumni[i].dates + '</p></div>'
row_pic = '<div class="col-md-2" align="center"><div class="flip-card"><div class="flip-card-inner">' + row_pic_front + row_pic_back + '</div></div>'
row_name = '<a href="' + data.alumni[i].link + '" target="_blank">' + data.alumni[i].firstname + '<br>' + data.alumni[i].lastname + '</a></div>';
content_alumnis = content_alumnis + row_pic + row_name;
if (((i+1)%max_cols)==0){// create a new row
content_alumnis = content_alumnis + '</div><div class="row">';
}
}
if ((data.alumni.length%max_cols)==0){
content_alumnis = content_alumnis + '</div>';
}
$("#alumnis").append(content_alumnis);
var hidden_alumnis= true;
$('#alumnis').hide();
$('#see-alumnis').click(function () {
if (hidden_alumnis){
$('#alumnis').show();
$('#see-alumnis').html('<i class="fas fa-search-minus"></i>');
hidden_alumnis = false;
}else{
$('#alumnis').hide();
$('#see-alumnis').html('<i class="fas fa-search-plus"></i>');
hidden_alumnis = true;
}
});
});
});
// Function to read bib and display publications
$(document).ready(function(){
$.get('publis/msd.bib', function(data) {
res = bibtexParse.toJSON(data);
cptIntArticle=0;
cptIntNatArticle=0;
cptIntConf=0;
cptIntWork=0;
cptChapter=0;
cptNatConf=0;
for (i=0; i<res.length; i++){
// authors
authors_string='';
authors = res[i].entryTags.author.split(' and ');
for (a=0; a<authors.length-1; a++){
names = authors[a].split(', ');
authors_string = authors_string + names[1] + ' ' + names[0] + ', ';
}
authors_string = authors_string.substring(0, authors_string.length - 2);
names = authors[authors.length-1].split(', ');
if (authors.length == 1){
authors_string = authors_string + names[1] + ' ' + names[0];
}else{
if (names[1] == undefined){
authors_string = authors_string + ' et. al';
}
else{
authors_string = authors_string + ' and ' + names[1] + ' ' + names[0];
}
}
link_string='<div class="bib">';
if (res[i].entryTags.hasOwnProperty('pdf')){
link_string = link_string + '<a href="' + res[i].entryTags.pdf + '" target="blank_"><i class="fas fa-file-pdf-o"></i></a> ';
}
if (res[i].entryTags.hasOwnProperty('url')){
link_string = link_string + '<a href="' + res[i].entryTags.url + '" target="blank_"><i class="fas fa-link"></i></a> ';
}
link_string += '<a href="javascript: toggleInfos(\'' + res[i].citationKey + '\',\'bibtex\')">[BibTex]</a>';
if (res[i].entryTags.hasOwnProperty('code')){
link_string += ' <a href="' + res[i].entryTags.code + '" target="blank_"><i class="fab fa-github-square"></i></a>';
}
if (res[i].entryTags.hasOwnProperty('slides')){
link_string += ' <a href="' + res[i].entryTags.slides + '" target="blank_"><i class="fab fa-slideshare"></i></a>';
}
if (res[i].entryTags.hasOwnProperty('webpage')){
link_string += ' [<a href="' + res[i].entryTags.webpage + '" target="blank_"></i>webpage</a>]';
}
link_string += '</div>'
if (res[i].entryType == "article"){
if ((res[i].entryTags.hasOwnProperty('language')) && (res[i].entryTags.language == 'french')){
// national article
cptIntNatArticle++;
num_string = '';
if (res[i].entryTags.hasOwnProperty('number')){
num_string = '(' + res[i].entryTags.number + ') ';
}
pages_string=""
if (res[i].entryTags.hasOwnProperty('pages')){
res[i].entryTags.pages = res[i].entryTags.pages.replace("--", "-");
if (res[i].entryTags.pages.length > 0){
pages_string = ', pp. ' + res[i].entryTags.pages;
}
}
publi_string = authors_string + '.<br>' + res[i].entryTags.title + '.<br><i>' + res[i].entryTags.journal + ', Vol. ' + res[i].entryTags.volume + num_string + pages_string + ', ' + res[i].entryTags.year +'.</i><br>' + link_string;
$("#nat_journals").append('<tr id="' + res[i].citationKey + '" class="entry"><td style="width:40px;padding-right:1em;">[' + cptIntNatArticle + ']</td><td>' + publi_string + '</td></tr>');
if (res[i].entryTags.hasOwnProperty('number')){
$("#nat_journals").append('<tr id="bib_' + res[i].citationKey + '" class="bibtex noshown"><td style="width:40px"></td><td class="bibtex-col"><pre>\n@article{' + res[i].citationKey + ',\n author = {' + res[i].entryTags.author + '},\n title = {' + res[i].entryTags.title + '},\n journal = {' + res[i].entryTags.journal + '},\n volume = {' + res[i].entryTags.volume + '},\n number = {' + res[i].entryTags.number + '},\n pages = {' + res[i].entryTags.pages + '},\n url = {' + res[i].entryTags.url + '},\n year = {'+ res[i].entryTags.year + '}\n}' + '</td></tr>');
}else{
$("#nat_journals").append('<tr id="bib_' + res[i].citationKey + '" class="bibtex noshown"><td style="width:40px"></td><td class="bibtex-col"><pre>\n@article{' + res[i].citationKey + ',\n author = {' + res[i].entryTags.author + '},\n title = {' + res[i].entryTags.title + '},\n journal = {' + res[i].entryTags.journal + '},\n volume = {' + res[i].entryTags.volume + '},\n pages = {' + res[i].entryTags.pages + '},\n url = {' + res[i].entryTags.url + '},\n year = {'+ res[i].entryTags.year + '}\n}' + '</td></tr>');
}
}else{
// article
cptIntArticle++;
num_string = '';
if (res[i].entryTags.hasOwnProperty('number')){
num_string = '(' + res[i].entryTags.number + ') ';
}
pages_string=""
if (res[i].entryTags.hasOwnProperty('pages')){
res[i].entryTags.pages = res[i].entryTags.pages.replace("--", "-");
if (res[i].entryTags.pages.length > 0){
pages_string = ', pp. ' + res[i].entryTags.pages;
}
}
vol_string = "";
if (res[i].entryTags.hasOwnProperty('volume')){
if (res[i].entryTags.volume.length > 0){
vol_string = ', Vol. ' + res[i].entryTags.volume;
}
}
publi_string = authors_string + '.<br>' + res[i].entryTags.title + '.<br><i>' + res[i].entryTags.journal + vol_string + num_string + pages_string + ', ' + res[i].entryTags.year +'.</i><br>' + link_string;
$("#int_journals").append('<tr id="' + res[i].citationKey + '" class="entry"><td style="width:40px;padding-right:1em;">[' + cptIntArticle + ']</td><td>' + publi_string + '</td></tr>');
if (res[i].entryTags.hasOwnProperty('number')){
$("#int_journals").append('<tr id="bib_' + res[i].citationKey + '" class="bibtex noshown"><td style="width:40px"></td><td class="bibtex-col"><pre>\n@article{' + res[i].citationKey + ',\n author = {' + res[i].entryTags.author + '},\n title = {' + res[i].entryTags.title + '},\n journal = {' + res[i].entryTags.journal + '},\n volume = {' + res[i].entryTags.volume + '},\n number = {' + res[i].entryTags.number + '},\n pages = {' + res[i].entryTags.pages + '},\n url = {' + res[i].entryTags.url + '},\n year = {'+ res[i].entryTags.year + '}\n}' + '</td></tr>');
}else{
$("#int_journals").append('<tr id="bib_' + res[i].citationKey + '" class="bibtex noshown"><td style="width:40px"></td><td class="bibtex-col"><pre>\n@article{' + res[i].citationKey + ',\n author = {' + res[i].entryTags.author + '},\n title = {' + res[i].entryTags.title + '},\n journal = {' + res[i].entryTags.journal + '},\n volume = {' + res[i].entryTags.volume + '},\n pages = {' + res[i].entryTags.pages + '},\n url = {' + res[i].entryTags.url + '},\n year = {'+ res[i].entryTags.year + '}\n}' + '</td></tr>');
}
}
}else if (res[i].entryType == 'inproceedings'){
if ((res[i].entryTags.hasOwnProperty('language')) && (res[i].entryTags.language == 'french')){
// national conf
cptNatConf++;
publi_string = authors_string + '.<br>' + res[i].entryTags.title + '.<br><i>' + res[i].entryTags.booktitle + ', ' + res[i].entryTags.address + ', ' + res[i].entryTags.year +'.</i><br>' + link_string;
$("#nat_confs").append('<tr id="' + res[i].citationKey + '" class="entry"><td style="width:40px;padding-right:1em;">[' + cptNatConf + ']</td><td>' + publi_string + '</td></tr>');
$("#nat_confs").append('<tr id="bib_' + res[i].citationKey + '" class="bibtex noshown"><td style="width:40px"></td><td class="bibtex-col"><pre>\n@inproceedings{' + res[i].citationKey + ',\n author = {' + res[i].entryTags.author + '},\n title = {' + res[i].entryTags.title + '},\n booktitle = {' + res[i].entryTags.booktitle + '},\n address = {' + res[i].entryTags.address + '},\n pages = {' + res[i].entryTags.pages + '},\n url = {' + res[i].entryTags.url + '},\n year = {'+ res[i].entryTags.year + '}\n}' + '</td></tr>');
}else if ((res[i].entryTags.hasOwnProperty('workshop')) && (res[i].entryTags.workshop == 'True')){
// international workshop
cptIntWork++;
publi_string = authors_string + '.<br>' + res[i].entryTags.title + '.<br><i>' + res[i].entryTags.booktitle + ', ' + res[i].entryTags.address + ', ' + res[i].entryTags.year +'.</i><br>' + link_string;
$("#int_workshops").append('<tr id="' + res[i].citationKey + '" class="entry"><td style="width:40px;padding-right:1em;">[' + cptIntWork + ']</td><td>' + publi_string + '</td></tr>');
$("#int_workshops").append('<tr id="bib_' + res[i].citationKey + '" class="bibtex noshown"><td style="width:40px"></td><td class="bibtex-col"><pre>\n@inproceedings{' + res[i].citationKey + ',\n author = {' + res[i].entryTags.author + '},\n title = {' + res[i].entryTags.title + '},\n booktitle = {' + res[i].entryTags.booktitle + '},\n address = {' + res[i].entryTags.address + '},\n pages = {' + res[i].entryTags.pages + '},\n url = {' + res[i].entryTags.url + '},\n year = {'+ res[i].entryTags.year + '}\n}' + '</td></tr>');
}else{
// international conf
cptIntConf++;
publi_string = authors_string + '.<br>' + res[i].entryTags.title + '.<br><i>' + res[i].entryTags.booktitle + ', ' + res[i].entryTags.address + ', ' + res[i].entryTags.year +'.</i><br>' + link_string;
$("#int_confs").append('<tr id="' + res[i].citationKey + '" class="entry"><td style="width:40px;padding-right:1em;">[' + cptIntConf + ']</td><td>' + publi_string + '</td></tr>');
$("#int_confs").append('<tr id="bib_' + res[i].citationKey + '" class="bibtex noshown"><td style="width:40px"></td><td class="bibtex-col"><pre>\n@inproceedings{' + res[i].citationKey + ',\n author = {' + res[i].entryTags.author + '},\n title = {' + res[i].entryTags.title + '},\n booktitle = {' + res[i].entryTags.booktitle + '},\n address = {' + res[i].entryTags.address + '},\n pages = {' + res[i].entryTags.pages + '},\n url = {' + res[i].entryTags.url + '},\n year = {'+ res[i].entryTags.year + '}\n}' + '</td></tr>');
}
}else if (res[i].entryType == 'inbook'){
// book chapter
cptChapter++;
res[i].entryTags.pages = res[i].entryTags.pages.replace("--", "-")
publi_string = authors_string + '.<br>' + res[i].entryTags.title + '.<br><i>' + res[i].entryTags.booktitle + ', pp.' + res[i].entryTags.pages + ', ' + res[i].entryTags.year +'.</i><br>' + link_string;
$("#chapters").append('<tr id="' + res[i].citationKey + '" class="entry"><td style="width:40px;padding-right:1em;">[' + cptChapter + ']</td><td>' + publi_string + '</td></tr>');
$("#chapters").append('<tr id="bib_' + res[i].citationKey + '" class="bibtex noshown"><td style="width:40px"></td><td class="bibtex-col"><pre>\n@inbook{' + res[i].citationKey + ',\n author = {' + res[i].entryTags.author + '},\n title = {' + res[i].entryTags.title + '},\n booktitle = {' + res[i].entryTags.booktitle + '},\n pages = {' + res[i].entryTags.pages + '},\n url = {' + res[i].entryTags.url + '},\n year = {'+ res[i].entryTags.year + '},\n editor = {' + res[i].entryTags.editor + '}\n}' + '</td></tr>');
}
}
}, 'text');
});
function toggleInfos(articleid,info) {
var entry = document.getElementById(articleid);
var abs = document.getElementById('abs_'+articleid);
var rev = document.getElementById('rev_'+articleid);
var bib = document.getElementById("bib_"+articleid);
if ($("#bib_"+articleid).is(":hidden")){
$("#bib_"+articleid).show();
}else{
$("#bib_"+articleid).hide();
}
if (abs && info == 'abstract') {
abs.className.indexOf('noshow') == -1?abs.className = 'abstract noshow':abs.className = 'abstract shown';
} else if (rev && info == 'review') {
rev.className.indexOf('noshow') == -1?rev.className = 'review noshow':rev.className = 'review shown';
} else if (bib && info == 'bibtex') {
bib.className.indexOf('noshow') == -1?bib.className = 'bibtex noshow':bib.className = 'bibtex shown';
} else {
return;
}
// check if one or the other is available
var revshow; var absshow; var bibshow;
(abs && abs.className.indexOf('noshow') == -1)? absshow = true: absshow = false;
(rev && rev.className.indexOf('noshow') == -1)? revshow = true: revshow = false;
(bib && bib.className.indexOf('noshow') == -1)? bibshow = true: bibshow = false;
// highlight original entry
if(entry) {
if (revshow || absshow || bibshow) {
entry.className = 'entry highlight shown';
} else {
entry.className = 'entry shown';
}
}
}
// Function for smooth scroll on links
$(document).ready(function(){
// Add smooth scrolling to all links
$("a").on('click', function(event) {
// Make sure this.hash has a value before overriding default behavior
if (this.hash !== "") {
// Prevent default anchor click behavior
event.preventDefault();
// Store hash
var hash = this.hash;
// Using jQuery's animate() method to add smooth page scroll
// The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 800, function(){
// Add hash (#) to url when done scrolling (default click behavior)
window.location.hash = hash;
});
} // End if
});
});