-
Notifications
You must be signed in to change notification settings - Fork 2
/
events.html
262 lines (226 loc) · 10.2 KB
/
events.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>CHINESE OPEN SCIENCE NETWORK</title>
<!-- MDB icon -->
<link rel="icon" href="img/mdb-favicon.ico" type="image/x-icon">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css">
<link rel="stylesheet" href="css/google_fonts.css">
<!-- Google Fonts Roboto -->
<!-- <link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap"
/> -->
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- MDB -->
<link rel="stylesheet" href="css/mdb.min.css" />
<!-- Custom styles -->
<link rel="stylesheet" href="css/custom.css" />
<style>
</style>
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary text-white mb-4">
<a class="navbar-brand" href="index.html">
<img
src="img/logo_w.png"
height="50"
alt=""
loading="lazy"
/>
</a>
<!-- Toggle button -->
<button
class="navbar-toggler"
type="button"
data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link text-white" href="index.html">Home<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="index.html#Members">Members</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="https://github.com/Chinese-Open-Science-Network/site/labels/Articles" target="_blank">Articles</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="https://github.com/Chinese-Open-Science-Network/site/labels/Resources" target="_blank">Resources</a>
</li>
<li class="nav-item active">
<a class="nav-link text-white" href="#">Events</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="https://github.com/OpenSci-CN/chinese-open-science-network.github.io/labels/positions">Positions</a>
</li>
</ul>
<button type="button" class="btn btn-outline-light btn-rounded btn-sm mr-2"><a href="https://github.com/OpenSci-CN/chinese-open-science-network.github.io/issues/new?labels=Calendars" target="_blank" class="text-white">Add event</a></button>
<button type="button" class="btn btn-outline-light btn-rounded btn-sm mr-2"><a href="https://github.com/OpenSci-CN/chinese-open-science-network.github.io/issues/new?labels=Positions,Articles" target="_blank" class="text-white">Add position</a></button>
</div>
</nav>
</header>
<div class="container">
<button type="button" id="btn_opentalk" class="btn bg-primary btn-rounded text-white" onclick="show_opentalk_events()">Show OpenTalk Only</button>
<button type="button" id="btn_all" class="btn bg-primary btn-rounded text-white" onclick="show_all_events()">Show All Events</button>
<div class="row mt-2" id='e_list'>
</div>
</div>
</div>
<!-- Footer -->
<footer class="page-footer font-small blue pt-4 bg-primary text-white">
<!-- Footer Links -->
<div class="container-fluid text-center text-md-left">
<!-- Grid row -->
<div class="row">
<!-- Grid column -->
<div class="col-md-6 mt-md-0 mt-3">
<!-- Content -->
<h5 class="text-uppercase">CHINESE OPEN SCIENCE NETWORK</h5>
<ul class="list-group list-group-horizontal d-flex justify-content-center">
<li class="list-group-item border-0 bg-primary"><a target="_blank" href="https://github.com/Chinese-Open-Science-Network" class="nav-link text-white"><i class="fab fa-github"></i></a></li>
<li class="list-group-item border-0 bg-primary"><a target="_blank" href="https://twitter.com/OpenSciChina" class="nav-link text-white"><i class="fab fa-twitter"></i></a></li>
<li class="list-group-item border-0 bg-primary"><a target="_blank" href="https://www.youtube.com/channel/UC5M4-E8pkO4vJT9K7rT72Uw" class="nav-link text-white"><i class="fab fa-youtube"></i></a></li>
<li class="list-group-item border-0 bg-primary"><a target="_blank" href="https://space.bilibili.com/252509184" class="nav-link text-white">Bilibili</a></li>
<li class="list-group-item border-0 bg-primary"><a target="_blank" href="https://osf.io/9d7y4/" class="nav-link text-white">OSF</a></li>
</ul>
</div>
<!-- Grid column -->
<hr class="clearfix w-100 d-md-none pb-3">
<!-- Grid column -->
<div class="col-md-6 mb-md-0 mb-3">
<!-- Links -->
<h5 class="text-uppercase">Partners</h5>
<ul class="list-group">
<li class="list-group-item border-0 bg-primary">
<a target="_blank" href="https://www.cos.io/" class="text-white">Center for Open Science</a>
</li>
<li class="list-group-item border-0 bg-primary">
<a target="_blank" href="https://curatescience.org/" class="text-white">Curate Science</a>
</li>
<li class="list-group-item border-0 bg-primary">
<a target="_blank" href="https://capbs.github.io/2020/" class="text-white">CAPBS 2020</a>
</li>
</ul>
</div>
<!-- Grid column -->
</div>
<!-- Grid row -->
</div>
<!-- Footer Links -->
<!-- Copyright -->
<div class="footer-copyright text-center py-3" style="color: rgba(255,255,255,0.6); background-color: rgba(0, 0, 0, 0.2)">
The website is designed by: <a class="text-white" href="https://github.com/ray306" target="_blank">Jinbiao Yang</a> @ Chinese Open Science Network</a> </br> © 2020 Copyright:<a class="text-white" href="https://mdbootstrap.com/education/bootstrap/" target="_blank"> MDBootstrap.com </a>
</div>
<!-- Copyright -->
</footer>
<!-- Footer -->
<!-- jQuery -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="js/mdb.min.js"></script>
<script>
function pad(a,b){return(1e6+a+"").slice(-b)}
function show_events(filter_condition){
$("#e_list").empty()
fetch('https://api.github.com/repos/Chinese-Open-Science-Network/site/issues?labels=Calendars')
.then(res => res.json())
.then((out) => {
out.forEach(function(record) {
regex = /Title:\r?\n(.*?)\r?\n/g
Title = regex.exec(record.body)[1];
regex = /Speaker:\r?\n(.*?)\r?\n/g
Speaker = regex.exec(record.body)[1];
regex = /Time:\r?\n(.*?)\r?\n/g
Time = regex.exec(record.body)[1];
regex = /URL:\r?\n(.*?)\r?\n/g
URL = regex.exec(record.body)[1];
regex = /Abstract:\r?\n(.*?)\r?\n/g
Abstract = regex.exec(record.body)[1];
regex = /\[原文地址\]\((.*?)\)/g
original = regex.exec(record.body)[1];
if (Title==null){Title=''};
if (Speaker==null){Speaker=''};
if (Time==null){Time=''};
if (URL==null){URL=''};
if (Abstract==null){Abstract=''};
if (original==null){original=''};
labels = [];
for (la of record.labels){
if (la.name!='Calendars'){
labels.push(la.name);
}
}
if (!((filter_condition == 'All') || (labels.includes(filter_condition)))){
return;
}
// the time info
// Time = splited[7];
if (Time!=''){
regex = /(\d+)[ \u4e00-\u9fff]*?(\d+)[ \u4e00-\u9fff]*?.*?(\d+):(\d+).*?(\d+):(\d+)/
match = regex.exec(Time);
year = '';
for (i of labels){
if (i.includes('20')){
year = i;
break
}
}
month = match[1];
day = match[2];
startTime_h = match[3];
startTime_m = match[4];
endTime_h = match[5];
endTime_m = match[6];
date = new Date(year, month-1, day, startTime_h, startTime_m);
Time = date.getFullYear()+'/'+pad(date.getMonth()+1,2)+'/'+pad(date.getDate(),2)+' '+pad(date.getHours(),2)+':'+pad(date.getMinutes(),2)
}
// url = '<button type="button" class="btn"><a href="'+splited[13].slice(7,-1)+'" target="_blank">More</a></button>'
new_event = '<div class="card mb-4 "> <div class="card-header"><strong>'+ Time +
'</strong></div> <a href="'+original+'"><div class="card-body"> <h5 style="margin-top:-5px;margin-bottom:10px"><span class="badge bg-primary">'+
labels.join(', ')+
'</span><h5><h4 class="card-title">'+
Title+
'</h4> <h5 class="card-title font-italic">'+
Speaker+
'</h5> <h5 class="card-title font-italic">'+
URL+
'</h5> <p>'+
Abstract+
'</p></a></div> </div>'
$("#e_list").append(new_event);
});
}).catch(err => console.error(err));
}
function show_all_events(){
show_events('All');
$("#btn_opentalk").removeClass('d-none');
$("#btn_all").addClass('d-none');
}
function show_opentalk_events(){
show_events('OpenTalks');
$("#btn_all").removeClass('d-none');
$("#btn_opentalk").addClass('d-none');
}
if (new URLSearchParams(window.location.search).get('opentalk')){
show_opentalk_events();
}
else{
show_all_events();
}
</script>
</body>
</html>