-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublications.html
More file actions
executable file
·203 lines (173 loc) · 9.32 KB
/
publications.html
File metadata and controls
executable file
·203 lines (173 loc) · 9.32 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
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-TDC01ELJLN"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-TDC01ELJLN');
</script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/underscore-min.js"></script>
<link type="text/css" rel="stylesheet" href="css/custom.css" />
<link type="text/css" rel="stylesheet" href="css/hover-min.css" />
<title>VRL Lab Publications</title>
<script type="text/javascript">
function draw_publication(publication){
pstr = '<div class="row" style="margin:1em;">';
console.log(publication);
// Badges
pstr += '<div class="col-lg-2">';
for(var i = 0; i < publication['topics'].length; i++){
pstr += '<span class="badge badge-pill badge-secondary">' + publication['topics'][i] + '</span>';
}
pstr += '<span class="badge badge-pill badge-success">' + publication['year'] + '</span>';
pstr += '<span class="badge badge-pill badge-info">' + publication['type'] + '</span>';
pstr += '</div>';
// Publication text
pstr += '<div class="col-lg-7">' + publication['text'] + '<br>';
if (publication['links'] !== undefined){
for (var j = 0; j < publication['links'].length; j++) {
var link = publication['links'][j];
if (link['source'].startsWith('bibtex') || link['source'].startsWith('files')){
link['source'] = 'data/publications/' + link['source'];
}
if (link['name'] == 'BibTeX'){
var linkId = link['source'].split('/');
linkId = linkId[linkId.length-1].split('.')[0];
pstr += '<a data-toggle="collapse" data-target="#' + linkId + '">' + link['name'] + '</a>';
pstr += '<pre class="collapse bg-light" id="'+ linkId +'" style="padding:1em;">' + link['source'] + '</pre>';
}else if (link['name'] == 'twitter'){
pstr += '<a href="' + link['source'] + '" target="_blank"><img src="img/twitter-icon.png" style="height:1em;"></a>';
}else{
pstr += '<a href="' + link['source'] + '" target="_blank">' + link['name'] + '</a>';
}
if(j !== publication['links'].length-1){
pstr += ' | ';
}
else{
pstr += '<br/>'
}
}
}
if (publication['coverage'] !== undefined){
pstr += '<span class="coverage">Media Coverages: </span>'
for (var j = 0; j < publication['coverage'].length; j++) {
var link = publication['coverage'][j];
if (link['source'].startsWith('bibtex') || link['source'].startsWith('files')){
link['source'] = 'apps/publications/' + link['source'];
}
pstr += '<a href="' + link['source'] + '" target="_blank">' + link['name'] + '</a>';
if(j !== publication['coverage'].length-1){
pstr += ' | ';
}
else{
pstr += '<br/>'
}
}
}
pstr += '</div>';
// Publication image
pstr += '<div class="col-lg-3 hidden-xs my-auto">';
if(publication['image'] !== undefined){
pstr += '<img src="data/publications/' + publication['image'] + '" width="100%">';
}
pstr += '</div>';
pstr += '</div>';
$('#publication-container').append(pstr);
}
function prepare_publication_table(publications, criteria){
if (criteria == 'topics'){
console.log('Sorting by topics');
var topics = [];
for(var i=0; i < publications.length; i++){
topics = topics.concat(publications[i]['topics']);
}
topics = _.sortBy(_.uniq(topics), function(p){ return p; });
console.log('topics',topics);
for(var t=0; t < topics.length; t++){
$('#publication-container').append('<h4>' + topics[t] + '</h4>');
var plist = _.filter(publications, function(p){ return p['topics'].includes(topics[t]); });
_.each(plist, draw_publication);
}
} else if (criteria == 'years'){
console.log('Sorting by years');
var years = [];
for(var i=0; i < publications.length; i++){
years.push(publications[i]['year']);
}
years = _.sortBy(_.uniq(years), function(p){ return -p; });
//console.log('Years',years);
for(var y=0; y < years.length; y++){
$('#publication-container').append('<h4>' + years[y] + '</h4>');
var plist = _.filter(publications, function(p){
return (p['year'] == years[y]) && (p['type'] != "thesis");
});
_.each(plist, draw_publication);
}
} else {
var ttype = [['preprint', 'Preprints & Under submission'],
['journal', 'Journal articles'],
['conference', 'Conference proceedings'],
['book', 'Book chapters'],
['thesis', 'Thesis & Dissertation']];
for (var t=0; t < ttype.length; t++){
var plist = _.filter(publications, function(p){ return p['type'] == ttype[t][0]; });
plist = _.sortBy(plist, function(p){ return -p['year']; });
if (plist.length == 0){ continue; }
//console.log(plist);
$('#publication-container').append('<h4>' + ttype[t][1] + '</h4>');
_.each(plist, draw_publication, [criteria]);
}
}
}
function updateBibtex(){
$('pre').each(function(){
const file = $(this).text().trim(); // file name inside <pre>
const pre = $(this);
$.get(file, function(data) {
pre.text(data); // replace with file contents
});
});
}
function get_publications_and_draw(criteria){
$.getJSON('data/publications/publications.json',
function (json) {
$('.btn').removeClass('active');
$('#btn-'+criteria).addClass('active');
$( "#publication-container" ).empty();
prepare_publication_table(json, criteria);
updateBibtex();
});
}
$(document).ready(function () {
$('#header-container').load('template_header.html');
$('#footer-container').load('template_footer.html');
get_publications_and_draw('years');
});
</script>
</head>
<body>
<div id="header-container"></div>
<!--<div class="jumbotron" style="background-image: url(img/bg-publications-2.png);"></div>-->
<div class="container" style="margin-top:30px;">
<div class="btn-group" role="group" style="margin-bottom: 1em;">
<div class="input-group-text">Group by:</div>
<button id="btn-types" type="button" class="btn btn-secondary active" onclick="get_publications_and_draw('types');">types</button>
<button id="btn-years" type="button" class="btn btn-secondary" onclick="get_publications_and_draw('years');">years</button>
<button id="btn-topics" type="button" class="btn btn-secondary" onclick="get_publications_and_draw('topics');">topics</button>
</div>
<div id="publication-container"></div>
</div>
<br>
<div id="footer-container"></div>
</body>
</html>