menu.html
15.8 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
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
<!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 name="description" content="" />
<meta name="author" content="" />
<title>Modern Business - Start Bootstrap Template</title>
<!-- Favicon-->
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<!-- Bootstrap icons-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="css/styles.css" rel="stylesheet" />
</head>
<body class="d-flex flex-column">
<main class="flex-shrink-0">
<!-- Navigation-->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container px-5">
<a class="navbar-brand" href="/">휴게소 정보</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<li class="nav-item"><a class="nav-link" href="/">Home</a></li>
<li class="nav-item"><a class="nav-link" href="/menu">휴게소 메뉴</a></li>
<li class="nav-item"><a class="nav-link" href="/weather">날씨</a></li>
<li class="nav-item"><a class="nav-link" href="/lpg">LPG</a></li>
<li class="nav-item"><a class="nav-link" href="/post">Board</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownBlog" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Blog</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownBlog">
<li><a class="dropdown-item" href="blog-home.html">Blog Home</a></li>
<li><a class="dropdown-item" href="blog-post.html">Blog Post</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
<li><a class="dropdown-item" href="/login">Login</a></li>
<li><a class="dropdown-item" href="/signup">Sign-up</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<!-- Header-->
<header class="py-5">
<div class="container px-5">
<div class="row justify-content-center">
<div class="col-lg-8 col-xxl-6">
<div class="text-center my-5">
<h1 class="fw-bolder mb-3">휴게소 메뉴 정보</h1>
<p class="lead fw-normal text-muted mb-4">Just search the name of the rest stop,<br>You'll find out what kind of food there is at the rest area.</p>
<p><h3>검색할 휴게소의 이름을 입력하세요</h3></p>
<input type="text" placeholder="내용을 입력하세요" id="menuname"><input type="button" onclick="Showmenu()" value="확인">
</a>
</div>
</div>
</div>
</div>
</header>
<!--추천메뉴-->
<section class="py-5 bg-light">
<div class="container px-2 my-2">
<div class="text-center">
<h2 class="fw-bolder">추천메뉴</h2>
<p class="lead fw-normal text-muted mb-5">Recommend the menu you can eat at the rest stop</p>
</div>
<div class="row gx-5 row-cols-1 row-cols-sm-2 row-cols-xl-4 justify-content-center">
<div class="col mb-5 mb-5 mb-xl-0">
<div class="text-center">
<img class="img-fluid rounded-circle mb-4 px-4" src="https://dummyimage.com/150x150/ced4da/6c757d" alt="..." />
<h5 class="fw-bolder"><recommend1></recommend1></h5>
<div class="fst-italic text-muted"><rec1></rec1></div>
</div>
</div>
<div class="col mb-5 mb-5 mb-xl-0">
<div class="text-center">
<img class="img-fluid rounded-circle mb-4 px-4" src="https://dummyimage.com/150x150/ced4da/6c757d" alt="..." />
<h5 class="fw-bolder"><recommend2></recommend2></h5>
<div class="fst-italic text-muted"><rec2></rec2></div>
</div>
</div>
<div class="col mb-5 mb-5 mb-sm-0">
<div class="text-center">
<img class="img-fluid rounded-circle mb-4 px-4" src="https://dummyimage.com/150x150/ced4da/6c757d" alt="..." />
<h5 class="fw-bolder"><recommend3></recommend3></h5>
<div class="fst-italic text-muted"><rec3></rec3></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!--menu1-->
<section class="py-3">
<div class="container px-0.1 my-0.1">
<div class="text-center">
<h4 class="fw-bolder"> <menu1></menu1></h4>
</div>
</section>
<section class="py-5 bg-light" id="scroll-target">
<div class="container px-2 my-2">
<div class="text-center">
<h2 class="fw-bolder"><foodname1></foodname1></h2>
<p class="lead fw-normal text-muted mb-0"><foodcost1></foodcost1></p>
</div>
</div>
</section>
<!--menu2-->
<section class="py-3">
<div class="container px-0.1 my-0.1">
<div class="text-center">
<h4 class="fw-bolder"> <menu2></menu2></h4>
</div>
</section>
<section class="py-5 bg-light" id="scroll-target">
<div class="container px-2 my-2">
<div class="text-center">
<h2 class="fw-bolder"><foodname2></foodname2></h2>
<p class="lead fw-normal text-muted mb-0"><foodcost2></foodcost2></p>
</div>
</div>
</section>
<!--menu3-->
<section class="py-3">
<div class="container px-0.1 my-0.1">
<div class="text-center">
<h4 class="fw-bolder"> <menu3></menu3> </h4>
</div>
</section>
<section class="py-5 bg-light" id="scroll-target">
<div class="container px-2 my-2">
<div class="text-center">
<h2 class="fw-bolder"><foodname3></foodname3></h2>
<p class="lead fw-normal text-muted mb-0"><foodcost3></foodcost3></p>
</div>
</div>
</section>
<!--menu4-->
<section class="py-3">
<div class="container px-0.1 my-0.1">
<div class="text-center">
<h4 class="fw-bolder"> <menu4></menu4></h4>
</div>
</section>
<section class="py-5 bg-light" id="scroll-target">
<div class="container px-2 my-2">
<div class="text-center">
<h2 class="fw-bolder"><foodname4></foodname4></h2>
<p class="lead fw-normal text-muted mb-0"><foodcost4></foodcost4></p>
</div>
</div>
</section>
<!--menu5-->
<section class="py-3">
<div class="container px-0.1 my-0.1">
<div class="text-center">
<h4 class="fw-bolder"> <menu5></menu5> </h4>
</div>
</section>
<section class="py-5 bg-light" id="scroll-target">
<div class="container px-2 my-2">
<div class="text-center">
<h2 class="fw-bolder"><foodname5></foodname5></h2>
<p class="lead fw-normal text-muted mb-0"><foodcost5></foodcost5></p>
</div>
</div>
</section>
<!--menu6-->
<section class="py-3">
<div class="container px-0.1 my-0.1">
<div class="text-center">
<h4 class="fw-bolder"> <menu6></menu6> </h4>
</div>
</section>
<section class="py-5 bg-light" id="scroll-target">
<div class="container px-2 my-2">
<div class="text-center">
<h2 class="fw-bolder"><foodname6></foodname6></h2>
<p class="lead fw-normal text-muted mb-0"><foodcost6></foodcost6></p>
</div>
</div>
</section>
<!--menu7-->
<section class="py-3">
<div class="container px-0.1 my-0.1">
<div class="text-center">
<h4 class="fw-bolder"> <menu7></menu7> </h4>
</div>
</section>
<section class="py-5 bg-light" id="scroll-target">
<div class="container px-2 my-2">
<div class="text-center">
<h2 class="fw-bolder"><foodname7></foodname7></h2>
<p class="lead fw-normal text-muted mb-0"><foodcost7></foodcost6></p>
</div>
</div>
</section>
<!--menu8-->
<section class="py-3">
<div class="container px-0.1 my-0.1">
<div class="text-center">
<h4 class="fw-bolder"> <menu8></menu8> </h4>
</div>
</section>
<section class="py-5 bg-light" id="scroll-target">
<div class="container px-2 my-2">
<div class="text-center">
<h2 class="fw-bolder"><foodname8></foodname8></h2>
<p class="lead fw-normal text-muted mb-0"><foodcost8></foodcost8></p>
</div>
</div>
</section>
</main>
<!-- Footer-->
<footer class="bg-dark py-4 mt-auto">
<div class="container px-5">
<div class="row align-items-center justify-content-between flex-column flex-sm-row">
<div class="col-auto"><div class="small m-0 text-white">Copyright © Your Website 2022</div></div>
<div class="col-auto">
<a class="link-light small" href="#!">Privacy</a>
<span class="text-white mx-1">·</span>
<a class="link-light small" href="#!">Terms</a>
<span class="text-white mx-1">·</span>
<a class="link-light small" href="#!">Contact</a>
</div>
</div>
</div>
</footer>
<!--fetch로 오픈 api 데이터 끌어오기-->
<script>
function Showmenu() {
menuname = document.getElementById('menuname').value
fetch('http://data.ex.co.kr/openapi/restinfo/restBestfoodList?key=6806352377&type=json&numOfRows=1000' + '&stdRestNm='+menuname).then(function(response){
method: 'GET';
body: JSON.stringify(this.obj)
response.text().then(function(text){
//데이터 정렬 및 text data-> array data 변환
index1=text.indexOf('[')
index2=text.indexOf(']')
ndata=text.substr(index1+1, index2-index1+1)
nndata=ndata.split('},');
for(let i=0; i<8; i++){
index3=nndata[i].indexOf('"foodNm":"')
index4=nndata[i].indexOf('"foodCost":"')
index5=nndata[i].indexOf('"etc"')
foodname=nndata[i].substr(index3+10, index4-index3-12)
foodcost=nndata[i].substr(index4+12, index5-index4-14)
console.log(foodname,foodcost)
//foodname
document.querySelector('foodname'+String(i+1)).innerHTML = foodname;
//foodcost
document.querySelector('foodcost'+String(i+1)).innerHTML = foodcost+"원";
}
//recommend menu
index3=nndata[1].indexOf('"foodNm":"')
index4=nndata[1].indexOf('"foodCost":"')
index5=nndata[1].indexOf('"etc"')
foodname1=nndata[1].substr(index3+10, index4-index3-12)
foodcost1=nndata[1].substr(index4+12, index5-index4-14)
document.querySelector('recommend1').innerHTML = foodname1;
document.querySelector('rec1').innerHTML = foodcost1+"원";
index3=nndata[4].indexOf('"foodNm":"')
index4=nndata[4].indexOf('"foodCost":"')
index5=nndata[4].indexOf('"etc"')
foodname1=nndata[4].substr(index3+10, index4-index3-12)
foodcost1=nndata[4].substr(index4+12, index5-index4-14)
document.querySelector('recommend2').innerHTML = foodname1;
document.querySelector('rec2').innerHTML = foodcost1+"원";
index3=nndata[5].indexOf('"foodNm":"')
index4=nndata[5].indexOf('"foodCost":"')
index5=nndata[5].indexOf('"etc"')
foodname1=nndata[5].substr(index3+10, index4-index3-12)
foodcost1=nndata[5].substr(index4+12, index5-index4-14)
document.querySelector('recommend3').innerHTML = foodname1;
document.querySelector('rec3').innerHTML = foodcost1+"원";
for(let i=1; i<9; i++)
document.querySelector('menu'+String(i)).innerHTML = "< "+"menu"+String(i)+" >";
}
)
})
}
</script>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="js/scripts.js"></script>
</body>
</html>