-
Notifications
You must be signed in to change notification settings - Fork 0
/
hospital.html
452 lines (372 loc) · 13.4 KB
/
hospital.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>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style2.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css" integrity="폰트어썸 본인 CDN" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@200&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style3.css">
<link rel="stylesheet" href="select_style.css">
<script src="main.js" defer></script>
<link rel="shortcut icon" type="image⁄x-icon" href="C:\Users\SAMSUNG\Desktop\버스.png">
<title>Bus Information System</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
<!--파이썬 css 연동-->
<link rel="stylesheet" href="{{ url_for('static', filename='css/style2.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/style3.css') }}">
<title>Bus Information System</title>
<style type="text/css">
#map {
position: absolute;
z-index:-1;
height: 100%;
width: 100%;
}
</style>
<script src="busstop.js"></script>
<script>
window.onload = getLocation;
function getLocation(){
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(locationSuccess, locationError, geo_options);
}else{
console.log("지오 로케이션 없음")
}
};
// getLocation
var latitude, longitude;
function locationSuccess(p){
latitude = p.coords.latitude,
longitude = p.coords.longitude;
initialize();
}
// locationSuccess
function locationError(error){
var errorTypes = {
0 : "무슨 에러냥~",
1 : "허용 안눌렀음",
2 : "위치가 안잡힘",
3 : "응답시간 지남"
};
var errorMsg = errorTypes[error.code];
}
// locationError
var geo_options = {
enableHighAccuracy: true,
maximumAge : 30000,
timeout : 27000
};
var map;
function initialize() {
var myLatLng = new google.maps.LatLng(latitude, longitude);
var mapOptions = {
zoom: 13,
center: myLatLng
};
map = new google.maps.Map(document.getElementById('map'), mapOptions);
var beachMarker = new google.maps.Marker({
position: myLatLng,
map: map,
})
var markers = [];
var infowindow = new google.maps.InfoWindow();
//마커 생성
for (var i = 0; i < HOSPITAL.length; i++) {
var marker = new google.maps.Marker({
map: map,
visible: true,
position: new google.maps.LatLng(HOSPITAL[i][5], HOSPITAL[i][6]),
})
markers.push(marker);
google.maps.event.addListener(marker, 'click', (function (marker, i) {
return function () {
//html로 표시될 인포 윈도우의 내용
infowindow.setContent(HOSPITAL[i][0]+"<br>"+HOSPITAL[i][1]+"<br>"+HOSPITAL[i][2]);
//인포윈도우가 표시될 위치
infowindow.open(map, marker);
}
})(marker, i));
if (marker) {
marker.addListener('click', function () {
//중심 위치를 클릭된 마커의 위치로 변경
map.setCenter(this.getPosition());
//마커 클릭 시의 줌 변화
map.setZoom(17);
});
}
google.maps.event.addListener(map, 'zoom_changed', function () {
var zoom = map.getZoom();
console.log("현재 zoom level : " + zoom);
for(var i = 0; i < HOSPITAL.length; i++){
if(document.getElementById('stop').value == HOSPITAL[i][0]){
console.log("success");
var a = parseFloat(HOSPITAL[i][5]);
var b = parseFloat(HOSPITAL[i][6]);
const uluru = { lat: a, lng: b };
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 15, center: uluru, });
var marker = new google.maps.Marker({
position: uluru,
map: map,
});
infowindow.setContent(HOSPITAL[i][0]+"<br>"+HOSPITAL[i][1]+"<br>"+HOSPITAL[i][2]);
infowindow.open(map, marker);
map.setZoom(16);
}
}
})
}
}
</script>
<!--speech to text-->
<div class="words" id="txt" contenteditable style=" float:left; margin-right:100px; width:500px"> <!--왼쪽 text box!-->
</div>
</head>
<body style="background-color: #d7e1ec;">
<!--h3>My Google Maps Demo</h3-->
<div id="map" ></div>
<div id="num" ></div>
<input type="text" id="stop" style="display:none;" />
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC0SZqnzFTUJ0pDDItOSAXHs4ZgQC6M69I" ></script>
<!--bus icon-->
<div class="wrapper">
<div class="icon facebook" onClick="location.href='busstop_r.html'">
<div class="tooltip" >Route</div>
<span><i class="fa fa-database" ></i></span>
</div>
<div class="icon twitter" onClick="location.href='busstop_p.html'">
<div class="tooltip">Busstop</div>
<span><i class="fa fa-bus"></i></span>
</div>
<div class="icon star" onClick="location.href='speech.html'">
<div class="tooltip">GetOnOff</div>
<span><i class="fa fa-envelope"></i></span>
</div>
<div class="icon github">
<div class="tooltip">Time</div>
<span><i class="fa fa-file"></i></span>
</div>
<div class="icon youtube">
<div class="tooltip">Information</div>
<span><i class="fa fa-info"></i></span>
</div>
<div class="icon hospital">
<div class="tooltip">Hospital</div>
<span><i class="fa fa-ambulance"></i></span>
</div>
<div class="icon welfare">
<div class="tooltip">Welfare</div>
<span><i class="fa fa-blind"></i></span>
</div>
</div>
<style>
.wrapper{
height:600px;
display:flex;
justify-content: center;
align-items: center;
position: absolute;
z-index:2;
margin-top:380px;
}
.wrapper .icon{
margin: 0 20px;
cursor:pointer;
display:flex;
align-items:center;
justify-content:center;
flex-direction:column;
}
.wrapper .icon span{
position:relative;
z-index:2;
height: 60px;
width: 60px;
display:block;
background: #fff;
box-shadow: 0 10px 10px rgba(0,0,0,0.1);
border-radius:50%;
text-align:center;
transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.wrapper .icon span i{
font-size:25px;
line-height:60px;
}
.wrapper .icon .tooltip{
position:absolute;
top:0px;
background: #fff;
box-shadow: 0 10px 10px rgba(0,0,0,0.1);
font-size: 20px;
padding: 10px 18px;
border-radius: 25px;
color:white;
opacity:0;
pointer-events: none;
transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.wrapper .icon:hover .tooltip{
opacity:1;
pointer-events: auto;
top:200px; /*위에 뿅 하고 뜨는거 거리*/
}
.wrapper .icon .tooltip:before{
position:absolute;
content:"";
height:15px;
width:15px;
bottom:-8px;
left:50%;
transform: translateX(-50%) rotate(45deg);
}
.wrapper .icon:hover span,
.wrapp .icon:hover .tooltip{
text-shadow: 0px -1px 0px rgba(0,0,0,0.4);
}
.wrapper .icon:hover span{
color: #fff;
}
.wrapper .facebook:hover span,
.wrapper .facebook:hover .tooltip,
.wrapper .facebook:hover .tooltip:before{
background:#008000;
}
.wrapper .star:hover span,
.wrapper .star:hover .tooltip,
.wrapper .star:hover .tooltip:before{
background:#5808b4;
}
.wrapper .twitter:hover span,
.wrapper .twitter:hover .tooltip,
.wrapper .twitter:hover .tooltip:before{
background:#ff9900;
}
.wrapper .github:hover span,
.wrapper .github:hover .tooltip,
.wrapper .github:hover .tooltip:before{
background:#333;
}
.wrapper .youtube:hover span,
.wrapper .youtube:hover .tooltip,
.wrapper .youtube:hover .tooltip:before{
background:#3B5999;
}
.wrapper .hospital:hover span,
.wrapper .hospital:hover .tooltip,
.wrapper .hospital:hover .tooltip:before{
background:#ffd700;
}
.wrapper .welfare:hover span,
.wrapper .welfare:hover .tooltip,
.wrapper .welfare:hover .tooltip:before{
background:#ff1493;
}
</style>
<script>
window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
const recognition = new SpeechRecognition();
recognition.interimResults = true;
recognition.maxAlternatives = 10000;
let p = document.createElement('p');
const words = document.querySelector('.words');
words.appendChild(p);
recognition.addEventListener('result', e => {
const transcript = Array.from(e.results)
.map(result => result[0])
.map(result => result.transcript)
.join('');
p.textContent = transcript;
if(e.results[0].isFinal) {
p = document.createElement('p');
words.appendChild(p);
}
if(transcript.includes('날씨')) {
console.log('오늘의 날씨는 직접 알아보세요.');
}
if(transcript.includes('노선')){
var link = 'busstop_r.html';
location.replace(link);
window.open(link);
}
if(transcript.includes('정류')){
var link = 'busstop_p.html';
location.replace(link);
window.open(link);
}
if(transcript.includes('응급')){
var link = 'hospital.html';
location.replace(link);
window.open(link);
}
if(transcript.includes('시설')){
var link = 'welfare.html';
location.replace(link);
window.open(link);
}
if(transcript.includes('예약')){
var link = 'speech.html';
location.replace(link);
window.open(link);
}
for(var i =0; i < HOSPITAL.length; i ++){ //이 과정을 삭제해도 될 듯
var check = HOSPITAL[i][0];
if(check == transcript){
document.getElementById("stop").value = transcript;
console.log("gooood");
}
}
console.log(transcript);
});
recognition.addEventListener('end', recognition.start);
recognition.start();
</script>
<style>
html {
font-size: 10px;
}
body {
background: white;
font-family: 'helvetica neue';
font-weight: 200;
font-size: 20px;
}
.words {
max-width: 400px;
/*margin: 150px auto;*/
margin-left: 20px;
margin-top:200px; /*-550px*/
background-color: transparent; /*#d7e1ec*/
border-radius: 5px;
/*box-shadow: 10px 10px 0 rgba(0,0,0,0.1);*/
padding: 1rem 2rem 1rem 5rem;
/*background: -webkit-gradient(linear, 0 0, 0 100%, from(#d9eaf3), color-stop(4%, #fff)) 0 4px;*/
background-size: 100% 3rem;
position: relative;
z-index: 0; /*이건 없었음*/
line-height: 3rem;
color : #000a12;
font-family: "Noto Serif Korean", sans-serif;
font-size:25px;
font-weight:bold;
}
p {
margin: 0 0 3rem;
}
.words:before {
content: '';
position: absolute;
width: 4px;
top: 0;
left: 30px;
bottom: 0;
border: 1px solid;
border-color: transparent /*#efe4e4;*/
/*border-color : #d7e1ec;*/
}
</style>
<!--the end-->
</body>
</html>