-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmunji_inbound_live.html
452 lines (371 loc) · 21.4 KB
/
munji_inbound_live.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
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
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
<!DOCTYPE html>
<html lang="en">
<head>
<title>KAIST 버스 2.0 - 문지: 본교행 (오늘)</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#413b98">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
<link rel="stylesheet" href="./style.css">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+KR&display=swap&subset=korean" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.0"></script>
<link rel="shortcut icon" href="./icon-4x.png" type="image/x-icon">
<link rel="icon" href="./favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="./icon-4x.png" type="image/x-icon">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ZPGD7LLE5D"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-ZPGD7LLE5D');
</script>
<script>
var arrayWeekdays = [450, 480, 510, 540, 580, 610, 640, 670, 730, 820, 880, 940, 1000, 1030, 1060, 1090, 1120, 1150, 1180, 1240, 1270, 1300, 1360, 1420, 1480, 1540, 1600];
var arrayWeekends = [490, 580, 670, 760, 850, 940, 1030, 1120, 1210, 1300, 1390, 1480, 1570];
var expressWeekdays = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var expressWeekends = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var delay = [0, 4, 20];
</script>
<script src="./liveTickHelper.js"></script>
<script>
var date = new Date();
setInterval(function() {
var date = new Date();
var time = tick(date.getHours(), 2) + ":" + tick(date.getMinutes(), 2) + ":" + tick(date.getSeconds(), 2);
$('.current_timer').text(time);
var next_bus_val = next_bus(date.getHours(), date.getMinutes(), 0);
if (next_bus_val == -1) {
$("#timer_nextbus").text("운행 종료");
$("#timer_left").text("운행 종료");
} else {
$("#timer_nextbus").text(tick(Math.floor(array1[next_bus_val] / 60), 2) + ":" + tick(Math.floor(array1[next_bus_val] - Math.floor(array1[next_bus_val] / 60) * 60), 2) + ":00");
var time_left = Math.floor(array1[next_bus_val] / 60) * 3600 + Math.floor(array1[next_bus_val] - Math.floor(array1[next_bus_val] / 60) * 60) * 60 + 0 - (date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds());
$("#timer_left").text(tick(Math.floor(time_left / 3600), 2) + ":" + tick(Math.floor((time_left - Math.floor(time_left / 3600) * 3600) / 60), 2) + ":" + tick(time_left - Math.floor(time_left / 3600) * 3600 - Math.floor((time_left - Math.floor(time_left / 3600) * 3600) / 60) * 60, 2));
}
$("#timer_nextbus2").text(stationTimerSetting1(delay[1], date));
$("#timer_left2").text(stationTimerSetting2(delay[1], date));
$("#timer_nextbus3").text(stationTimerSetting1(delay[2], date));
$("#timer_left3").text(stationTimerSetting2(delay[2], date));
$("#timer_nextbus4").text(stationTimerSetting1(delay[3], date));
$("#timer_left4").text(stationTimerSetting2(delay[3], date));
$("#timer_nextbus5").text(stationTimerSetting1(delay[4], date));
$("#timer_left5").text(stationTimerSetting2(delay[4], date));
$(".spinner-timer").hide();
$('#ttProvider').html(contentsMakerExpress(delay[0]));
$('#ttProvider2').html(contentsMaker(delay[1]));
$('#ttProvider3').html(contentsMaker(delay[2]));
$('#ttProvider4').html(contentsMaker(delay[3]));
$('#ttProvider5').html(contentsMaker(delay[4]));
for (var k = 0; k < array1.length; k++) {
for (var k2 = 0; k2 < delay.length; k2++) {
var timeRemaining = array1[k] * 60 + delay[k2] * 60 - date.getHours() * 3600 - date.getMinutes() * 60 - date.getSeconds();
if (timeRemaining > 0) {
$("#timeLeft" + delay[k2] + tick(k, 2)).text((int2strTimeLeft(timeRemaining)));
} else {
$("#timeLeft" + delay[k2] + tick(k, 2)).text(("-"));
}
}
}
}, 500)
function stationTimerSetting1(offset, date) {
var next_bus_val = next_bus(date.getHours(), date.getMinutes(), offset);
if (next_bus_val == -1) {
return "운행 종료";
} else {
var next_bus_time = array1[next_bus_val] + offset;
return tick(Math.floor(next_bus_time / 60), 2) + ":" + tick(Math.floor(next_bus_time - Math.floor(next_bus_time / 60) * 60), 2) + ":00";
}
}
function int2strTimeLeft(num) {
var hr = tick(Math.floor(num / 3600), 1);
var min = tick(Math.floor(tick(num - Math.floor(num / 3600) * 3600, 2) / 60), 1);
var sec = tick(num - hr * 3600 - min * 60, 2)
return (hr != 0 ? (hr + "시간 ") : "") + ((min != 0 || hr != 0) ? (min + "분 ") : "") + sec + "초";
}
function stationTimerSetting2(offset, date) {
var next_bus_val = next_bus(date.getHours(), date.getMinutes(), offset);
if (next_bus_val == -1) {
return "운행 종료";
} else {
var next_bus_time = array1[next_bus_val] + offset;
var time_left = Math.floor(next_bus_time / 60) * 3600 + Math.floor(next_bus_time - Math.floor(next_bus_time / 60) * 60) * 60 - (date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds());
return tick(Math.floor(time_left / 3600), 2) + ":" + tick(Math.floor((time_left - Math.floor(time_left / 3600) * 3600) / 60), 2) + ":" + tick(time_left - Math.floor(time_left / 3600) * 3600 - Math.floor((time_left - Math.floor(time_left / 3600) * 3600) / 60) * 60, 2);
}
}
function int2str(num) {
if (num < 0) {
num += 1440;
}
var hr = tick(Math.floor(num / 60), 2);
var min = tick(num - Math.floor(num / 60) * 60, 2);
return hr + "시 " + min + "분";
}
function tick(num, size) {
var s = num + "";
while (s.length < size) s = "0" + s;
return s;
}
function next_bus(hr, min, offset) {
var cur_time = hr * 60 + min;
for (var i = 0; i < array1.length; i++) {
if (array1[i] + offset > cur_time) {
return i;
}
}
return -1;
}
function contentsMakerExpress(offset) {
var contents = "";
for (i = 0; i < array1.length; i++) {
var isExpressBus = false;
if (expressBus[i] == 1) {
isExpressBus = true;
}
if (isExpressBus) {
contents += "<tr><td>" + int2str(array1[i] + offset) + "</td><td style='text-align: right; font-size:0.88rem;' id='timeLeft" + offset + tick(i, 2) + "'>" + '<div class="spinner-border spinner-border-sm text-info spinner-timer"></div>' + "</td></tr>";
} else {
contents += "<tr><td>" + int2str(array1[i] + offset) + "</td><td style='text-align: right; font-size:0.88rem;' id='timeLeft" + offset + tick(i, 2) + "'>" + '<div class="spinner-border spinner-border-sm text-info spinner-timer"></div>' + "</td></tr>";
}
}
return contents;
}
function contentsMaker(offset) {
var contents = "";
for (i = 0; i < array1.length; i++) {
var isExpressBus = false;
for (var j = 0; j < expressBus.length; j++) {
if (expressBus[j] == i) {
isExpressBus = true;
}
}
if (isExpressBus) {
contents += "<tr><td>" + int2str(array1[i] + offset) + "</td><td style='text-align: right; font-size:0.88rem;' id='timeLeft" + offset + tick(i, 2) + "'>" + '<div class="spinner-border spinner-border-sm text-info spinner-timer"></div>' + "</td></tr>";
} else {
contents += "<tr><td>" + int2str(array1[i] + offset) + "</td><td style='text-align: right; font-size:0.88rem;' id='timeLeft" + offset + tick(i, 2) + "'>" + '<div class="spinner-border spinner-border-sm text-info spinner-timer"></div>' + "</td></tr>";
}
}
return contents;
}
$(document).ready(function() {
$('[data-toggle="tooltip_noWeekends"]').tooltip();
$('[data-toggle="tooltip"]').tooltip();
});
$(function() {
$("#header").load("./header.html");
$("#footer").load("./footer.html");
$("#carousel").load("./carousel.html");
});
</script>
</head>
<body>
<div id="header"></div>
<div class="container bus-title">
<i class="far fa-calendar-check"></i> <mark style="font-size: 1.5rem;">문지: 본교행</mark> <small id='index-date'></small>
</div>
<nav class="navbar navbar-light navbar-expand bg-faded justify-content-center" style="background:linear-gradient(135deg, #7117ea 0%,#9b30b9 100%) !important; padding-top:6px; padding-bottom:6px;">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbar3">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse w-100" id="collapsingNavbar3">
<ul class="nav nav-pills w-100 justify-content-center" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#tab1">문지</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#tab2">로덴하우스</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#tab3">본교</a>
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="col-md-12">
<div class="bd-callout bd-callout-info specialHolidayCallout">
<h4>9월 21일 운행 안내</h4>
<p>캠퍼스 순환 전 노선이 9월 21일(추석 당일)에는 13시 50분부터 운행됩니다.</p>
</div>
</div>
</div>
<div class="container">
<div class="col-md-12">
<div class="bd-callout bd-callout-info">
<h4>평일 19시 40분 버스에 대해</h4>
<p>문지에서 본교로 출발하는 평일 19시 40분 버스는 교통 사정에 따라 운행 시간이 15분여 정도 지연되는 경우가 있습니다.</p>
</div>
</div>
</div>
<div id="warningForDaysInversion"></div>
<div class="container">
<div class="tab-content">
<div id="tab1" class="container tab-pane active">
<div class="card bg-light text-dark text-center" style="margin-top:18px; margin-bottom:18px; display: None;">
<div class="card-body">
<div class="container timers">
<div class="row">
<div class="col-6" style=" text-align: center;">
<span style="line-height: 44px; text-align: left;" data-toggle="tooltip" data-placement="top" title="도착까지 남은 시간"><i class="fas fa-stopwatch"></i> 남은
시간</span>
</div>
<div class="col-2" style="position:absolute; border-left: 2px solid white; opacity: 0.85; height:44px; padding:0; left: 50%;">
</div>
<div class="col-6" style=" text-align: center;">
<div class="spinner-border text-info spinner-timer"></div>
<div style="display:inline-block; text-align: center;"> <span id="timer_left" style="margin-bottom:0; font-size:1.6rem;"></span> </div>
</div>
</div>
</div>
</div>
</div>
<div class="card bg-light text-dark text-center" style="margin-top:18px; margin-bottom:18px;">
<div class="card-body">
<div class="container timers">
<div class="row">
<div class="col-6">
<h4 data-toggle="tooltip" data-placement="top" title="현재 시각"><i class="far fa-clock"></i></h4>
<div class="spinner-border text-info spinner-timer"></div>
<span class="current_timer" style="margin-bottom:0;"></span>
</div>
<div class="col-6">
<h4 data-toggle="tooltip" data-placement="top" title="다음 버스 시각"><i class="fas fa-bus"></i></h4>
<div class="spinner-border text-info spinner-timer"></div>
<span id="timer_nextbus" style="margin-bottom:0;"></span>
</div>
</div>
</div>
</div>
</div>
<table class="table table-hover" style="margin-top:12px;">
<thead>
<tr>
<th>도착 예정</th>
<th style="text-align:right;">남은 시간</th>
</tr>
</thead>
<tbody id='ttProvider'>
</tbody>
</table>
</div>
<div id="container_tab2">
</div>
<div id="tab2" class="container tab-pane">
<div class="card bg-light text-dark text-center" style="margin-top:18px; margin-bottom:18px; display: None;">
<div class="card-body">
<div class="container timers">
<div class="row">
<div class="col-6" style=" text-align: center;">
<span style="line-height: 44px; text-align: left;" data-toggle="tooltip" data-placement="top" title="도착까지 남은 시간"><i class="fas fa-stopwatch"></i> 남은
시간</span>
</div>
<div class="col-2" style="position:absolute; border-left: 2px solid white; opacity: 0.85; height:44px; padding:0; left: 50%;">
</div>
<div class="col-6" style=" text-align: center;">
<div class="spinner-border text-info spinner-timer"></div>
<div style="display:inline-block; text-align: center;"> <span id="timer_left2" style="margin-bottom:0; font-size:1.6rem;"></span> </div>
</div>
</div>
</div>
</div>
</div>
<div class="card bg-light text-dark text-center" style="margin-top:18px; margin-bottom:18px;">
<div class="card-body">
<div class="container timers">
<div class="row">
<div class="col-6">
<h4 data-toggle="tooltip" data-placement="top" title="현재 시각"><i class="far fa-clock"></i></h4>
<div class="spinner-border text-info spinner-timer"></div>
<span class="current_timer" style="margin-bottom:0;"></span>
</div>
<div class="col-6">
<h4 data-toggle="tooltip" data-placement="top" title="다음 버스 시각"><i class="fas fa-bus"></i></h4>
<div class="spinner-border text-info spinner-timer"></div>
<span id="timer_nextbus2" style="margin-bottom:0;"></span>
</div>
</div>
</div>
</div>
</div>
<table class="table table-hover" style="margin-top:12px;">
<thead>
<tr>
<th>도착 예정</th>
<th style="text-align:right;">남은 시간</th>
</tr>
</thead>
<tbody id='ttProvider2'>
</tbody>
</table>
</div>
<div id="tab3" class="container tab-pane">
<div class="card bg-light text-dark text-center" style="margin-top:18px; margin-bottom:18px; display: None;">
<div class="card-body">
<div class="container timers">
<div class="row">
<div class="col-6" style=" text-align: center;">
<span style="line-height: 44px; text-align: left;" data-toggle="tooltip" data-placement="top" title="도착까지 남은 시간"><i class="fas fa-stopwatch"></i> 남은
시간</span>
</div>
<div class="col-2" style="position:absolute; border-left: 2px solid white; opacity: 0.85; height:44px; padding:0; left: 50%;">
</div>
<div class="col-6" style=" text-align: center;">
<div class="spinner-border text-info spinner-timer"></div>
<div style="display:inline-block; text-align: center;"> <span id="timer_left3" style="margin-bottom:0; font-size:1.6rem;"></span> </div>
</div>
</div>
</div>
</div>
</div>
<div class="card bg-light text-dark text-center" style="margin-top:18px; margin-bottom:18px;">
<div class="card-body">
<div class="container timers">
<div class="row">
<div class="col-6">
<h4 data-toggle="tooltip" data-placement="top" title="현재 시각"><i class="far fa-clock"></i></h4>
<div class="spinner-border text-info spinner-timer"></div>
<span class="current_timer" style="margin-bottom:0;"></span>
</div>
<div class="col-6">
<h4 data-toggle="tooltip" data-placement="top" title="다음 버스 시각"><i class="fas fa-bus"></i></h4>
<div class="spinner-border text-info spinner-timer"></div>
<span id="timer_nextbus3" style="margin-bottom:0;"></span>
</div>
</div>
</div>
</div>
</div>
<table class="table table-hover" style="margin-top:12px;">
<thead>
<tr>
<th>도착 예정</th>
<th style="text-align:right;">남은 시간</th>
</tr>
</thead>
<tbody id='ttProvider3'>
</tbody>
</table>
</div>
</div>
</div>
<div class="container">
<div class="bd-callout bd-callout-info">
<h4>교통 상황에 따른 안내</h4>
<p>시내 도로 사정에 따라 각 정류장 도착 예정 시각과 실제 도착 시각 간에 다소 차이가 있을 수 있습니다.</p>
</div>
<div class="bd-callout bd-callout-warning">
<h4>비상 연락처 안내</h4>
<p>총무팀(주간, 042-350-2315)<br>수덕관광(010-9500-3663, 010-3030-4240)</p>
</div>
</div>
<div class="container" style="margin-bottom:20px;">
<div id="carousel"></div>
</div>
<div id="footer"></div>
</body>
</html>