-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay_papers.js
94 lines (77 loc) · 3.11 KB
/
display_papers.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
function contains(a, obj) {
var i = a.length;
while (i--) {
if (a[i] === obj) {
return true;
}
}
return false;
}
function display_papers(papers, ordered, num_to_display){
if (ordered)
document.write('<ol>')
for (var y in entities)
{
if ((papers.length != 0 && !(contains(papers, y))) || (num_to_display == 0))
continue;
num_to_display--;
if (ordered)
document.write('<li>');
if (entities[y]["location"] == null)
document.write('<span class="label label-primary">PRE-PRINT</span> ');
else
document.write('<span class="label label-primary">PAPER</span> ');
document.write('<a href='+entities[y]["link"]+"><font color='#3498DB'>"+entities[y]["title"]+"</font></a>. <br/>");
document.write(entities[y]["authors"]+". ");
if (entities[y]["location"] == null)
document.write(entities[y]["type"]+ ". "+ entities[y]["date"]+"<br/>");
else
document.write('<b>'+entities[y]["type"]+ "</b>, "+ entities[y]["location"] + ". " + entities[y]["date"]+"<br/>");
if (entities[y]["special"] != null)
document.write('<span class="badge">'+entities[y]["special"]+'</span><br/>');
if (ordered)
document.write('</li>')
}
if (ordered)
document.write('</ol>')
}
function display_papers_year(papers, ordered, num_to_display){
if (ordered)
document.write('<ol>')
old_year = "1000";
for (var y in entities)
{
if ((papers.length != 0 && !(contains(papers, y))) || (num_to_display == 0))
continue;
num_to_display--;
// new year-based-segment
full_date = entities[y]["date"];
year = full_date.substr(full_date.length - 4);
if (year != old_year)
{
old_year = year;
document.write('</ol>');
document.write('<h2>'+year+'</h2>');
document.write('<ol>');
}
// end new year-based-segment
if (ordered)
document.write('<li>');
if (entities[y]["location"] == null)
document.write('<span class="label label-primary">PRE-PRINT</span> ');
else
document.write('<span class="label label-primary">PAPER</span> ');
document.write('<a href='+entities[y]["link"]+">"+entities[y]["title"]+"</a>. <br/>");
document.write(entities[y]["authors"]+". ");
if (entities[y]["location"] == null)
document.write(entities[y]["type"]+ ". "+ entities[y]["date"]+"<br/>");
else
document.write('<b>'+entities[y]["type"]+ "</b>, "+ entities[y]["location"] + ". " + entities[y]["date"]+"<br/>");
if (entities[y]["special"] != null)
document.write('<span class="badge">'+entities[y]["special"]+'</span><br/>');
if (ordered)
document.write('</li>')
}
if (ordered)
document.write('</ol>')
}