Showing
1 changed file
with
114 additions
and
50 deletions
... | @@ -13,11 +13,13 @@ | ... | @@ -13,11 +13,13 @@ |
13 | <!-- Core theme CSS (includes Bootstrap)--> | 13 | <!-- Core theme CSS (includes Bootstrap)--> |
14 | <link href="css/styles.css" rel="stylesheet" /> | 14 | <link href="css/styles.css" rel="stylesheet" /> |
15 | </head> | 15 | </head> |
16 | + | ||
17 | + | ||
16 | <body class="d-flex flex-column"> | 18 | <body class="d-flex flex-column"> |
17 | <main class="flex-shrink-0"> | 19 | <main class="flex-shrink-0"> |
18 | <!-- Navigation--> | 20 | <!-- Navigation--> |
19 | <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> | 21 | <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> |
20 | - <div class="container px-5"> | 22 | + <div class="container px-3"> |
21 | <a class="navbar-brand" href="/">휴게소 정보</a> | 23 | <a class="navbar-brand" href="/">휴게소 정보</a> |
22 | <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> | 24 | <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> |
23 | <div class="collapse navbar-collapse" id="navbarSupportedContent"> | 25 | <div class="collapse navbar-collapse" id="navbarSupportedContent"> |
... | @@ -45,83 +47,143 @@ | ... | @@ -45,83 +47,143 @@ |
45 | </div> | 47 | </div> |
46 | </div> | 48 | </div> |
47 | </nav> | 49 | </nav> |
50 | + | ||
48 | <!-- Header--> | 51 | <!-- Header--> |
49 | <header class="py-5"> | 52 | <header class="py-5"> |
50 | <div class="container px-5"> | 53 | <div class="container px-5"> |
51 | <div class="row justify-content-center"> | 54 | <div class="row justify-content-center"> |
52 | <div class="col-lg-8 col-xxl-6"> | 55 | <div class="col-lg-8 col-xxl-6"> |
53 | <div class="text-center my-5"> | 56 | <div class="text-center my-5"> |
54 | - <h1 class="fw-bolder mb-3">휴게소 날씨.</h1> | 57 | + <h1 class="fw-bolder mb-3">휴게소 날씨</h1> |
55 | - <p class="lead fw-normal text-muted mb-4">Start Bootstrap was built on the idea that quality, functional website templates and themes should be available to everyone. Use our open source, free products, or support us by purchasing one of our premium products or services.</p> | 58 | + <p class="lead fw-normal text-muted mb-4">Just search the name of the rest stop,<br>You'll find out the weather of the rest area.</p> |
56 | - <a class="btn btn-primary btn-lg" href="#scroll-target">여기도 메뉴페이지 비슷하게 드랍다운 2개</a> | 59 | + |
60 | + <!--검색 버튼으로 검색할 휴게소 이름 입력 받기--> | ||
61 | + <p><input type="text" placeholder="휴게소 이름" id="name"><input type="button" onclick="Showweather()" value="확인"></p> | ||
62 | + | ||
57 | </div> | 63 | </div> |
58 | </div> | 64 | </div> |
59 | </div> | 65 | </div> |
60 | </div> | 66 | </div> |
61 | </header> | 67 | </header> |
62 | - <!-- About section one--> | 68 | + |
63 | - <section class="py-5 bg-light" id="scroll-target"> | 69 | + |
70 | + <!--bar--> | ||
71 | + <section class="py-3 bg-light" id="scroll-target"> | ||
72 | + <div class="container px-1 my-1"> | ||
73 | + <div class="text-center"> | ||
74 | + <center><p><h3 class="fw-bolder"><reststop_name></reststop_name></h3></p></center> | ||
75 | + <center><hr style ="height:2px; width: 55%"></hr></center> | ||
76 | + <center><p><h5 class="fw-bolder"><bar1></bar1>    <bar2></bar2>     <bar3></bar3>     <bar4></bar4></h5></p></center> | ||
77 | + <div class="container px-1 my-1"><h6 class="lead fw-normal text-muted mb-4"><bar_Weather></bar_Weather><bar_temperature></bar_temperature><bar_humidity></bar_humidity><bar_wind></bar_wind><empty></empty></h6><div> | ||
78 | + </div> | ||
79 | + </div> | ||
80 | + </section> | ||
81 | + | ||
82 | + | ||
83 | + | ||
84 | + <!-- [ 그래프 박스 ]--> | ||
85 | + <!--temperature graph--> | ||
86 | + <section class="py-5" id="scroll-target"> | ||
64 | <div class="container px-5 my-5"> | 87 | <div class="container px-5 my-5"> |
65 | <div class="row gx-5 align-items-center"> | 88 | <div class="row gx-5 align-items-center"> |
66 | - <div class="col-lg-6"><img class="img-fluid rounded mb-5 mb-lg-0" src="https://dummyimage.com/600x400/343a40/6c757d" alt="..." /></div> | 89 | + <div class="col-lg-6"><canvas id="temperature-graph" width="100" height="50"></canvas></div> |
67 | <div class="col-lg-6"> | 90 | <div class="col-lg-6"> |
68 | - <h2 class="fw-bolder">Our founding</h2> | 91 | + <h2 class="fw-bolder"><exp1></exp1></h2> |
69 | - <p class="lead fw-normal text-muted mb-0">Lorem ipsum dolor sit amet consectetur adipisicing elit. Iusto est, ut esse a labore aliquam beatae expedita. Blanditiis impedit numquam libero molestiae et fugit cupiditate, quibusdam expedita, maiores eaque quisquam.</p> | 92 | + <p class="lead fw-normal text-muted mb-0"><exp2></exp2></p> |
70 | </div> | 93 | </div> |
71 | </div> | 94 | </div> |
72 | </div> | 95 | </div> |
73 | </section> | 96 | </section> |
74 | - <!-- About section two--> | 97 | + |
75 | - <section class="py-5"> | 98 | + |
99 | + <!--humidity graph--> | ||
100 | + <section class="py-5" id="scroll-target"> | ||
76 | <div class="container px-5 my-5"> | 101 | <div class="container px-5 my-5"> |
77 | <div class="row gx-5 align-items-center"> | 102 | <div class="row gx-5 align-items-center"> |
78 | - <div class="col-lg-6 order-first order-lg-last"><img class="img-fluid rounded mb-5 mb-lg-0" src="https://dummyimage.com/600x400/343a40/6c757d" alt="..." /></div> | 103 | + <div class="col-lg-6"><canvas id="humidity-graph" width="100" height="50"></canvas></div> |
79 | <div class="col-lg-6"> | 104 | <div class="col-lg-6"> |
80 | - <h2 class="fw-bolder">Growth & beyond</h2> | 105 | + <h2 class="fw-bolder"><exp3></exp3></h2> |
81 | - <p class="lead fw-normal text-muted mb-0">Lorem ipsum dolor sit amet consectetur adipisicing elit. Iusto est, ut esse a labore aliquam beatae expedita. Blanditiis impedit numquam libero molestiae et fugit cupiditate, quibusdam expedita, maiores eaque quisquam.</p> | 106 | + <p class="lead fw-normal text-muted mb-0"><exp4></exp4></p> |
82 | </div> | 107 | </div> |
83 | </div> | 108 | </div> |
84 | </div> | 109 | </div> |
85 | </section> | 110 | </section> |
86 | - <!-- Team members section--> | 111 | + |
87 | - <section class="py-5 bg-light"> | 112 | + |
113 | + | ||
114 | + <!--wind graph--> | ||
115 | + <section class="py-5" id="scroll-target"> | ||
88 | <div class="container px-5 my-5"> | 116 | <div class="container px-5 my-5"> |
89 | - <div class="text-center"> | 117 | + <div class="row gx-5 align-items-center"> |
90 | - <h2 class="fw-bolder">Our team</h2> | 118 | + <div class="col-lg-6"><canvas id="wind-graph" width="100" height="50"></canvas></div> |
91 | - <p class="lead fw-normal text-muted mb-5">Dedicated to quality and your success</p> | 119 | + <div class="col-lg-6"> |
92 | - </div> | 120 | + <h2 class="fw-bolder"><exp5></exp5></h2> |
93 | - <div class="row gx-5 row-cols-1 row-cols-sm-2 row-cols-xl-4 justify-content-center"> | 121 | + <p class="lead fw-normal text-muted mb-0"><exp6></exp6></p> |
94 | - <div class="col mb-5 mb-5 mb-xl-0"> | ||
95 | - <div class="text-center"> | ||
96 | - <img class="img-fluid rounded-circle mb-4 px-4" src="https://dummyimage.com/150x150/ced4da/6c757d" alt="..." /> | ||
97 | - <h5 class="fw-bolder">Ibbie Eckart</h5> | ||
98 | - <div class="fst-italic text-muted">Founder & CEO</div> | ||
99 | - </div> | ||
100 | - </div> | ||
101 | - <div class="col mb-5 mb-5 mb-xl-0"> | ||
102 | - <div class="text-center"> | ||
103 | - <img class="img-fluid rounded-circle mb-4 px-4" src="https://dummyimage.com/150x150/ced4da/6c757d" alt="..." /> | ||
104 | - <h5 class="fw-bolder">Arden Vasek</h5> | ||
105 | - <div class="fst-italic text-muted">CFO</div> | ||
106 | - </div> | ||
107 | - </div> | ||
108 | - <div class="col mb-5 mb-5 mb-sm-0"> | ||
109 | - <div class="text-center"> | ||
110 | - <img class="img-fluid rounded-circle mb-4 px-4" src="https://dummyimage.com/150x150/ced4da/6c757d" alt="..." /> | ||
111 | - <h5 class="fw-bolder">Toribio Nerthus</h5> | ||
112 | - <div class="fst-italic text-muted">Operations Manager</div> | ||
113 | - </div> | ||
114 | - </div> | ||
115 | - <div class="col mb-5"> | ||
116 | - <div class="text-center"> | ||
117 | - <img class="img-fluid rounded-circle mb-4 px-4" src="https://dummyimage.com/150x150/ced4da/6c757d" alt="..." /> | ||
118 | - <h5 class="fw-bolder">Malvina Cilla</h5> | ||
119 | - <div class="fst-italic text-muted">CTO</div> | ||
120 | - </div> | ||
121 | </div> | 122 | </div> |
122 | </div> | 123 | </div> |
123 | </div> | 124 | </div> |
124 | - </section> | 125 | + </section> |
126 | + | ||
127 | + | ||
128 | + <script> | ||
129 | + //날씨 오픈 api는 조회 방식이나 끌어오는 데이터가 복잡해서 주석을 자세히 작성함 | ||
130 | + | ||
131 | + //* 휴게소 날씨 오픈 api 주의 사항 () | ||
132 | + //날씨 정보가 반영되는 데에 시간이 걸려서 대체적으로 (현재 시간-3시간)부터 조회 가능함 | ||
133 | + //날씨 정보가 올라오지 않는, 데이터가 빈 시간대도 존재함. | ||
134 | + //오픈 api 데이터를 가져오기 위해서는 필수적으로 key, type(xml/json), sdate(날짜), stdHour(시간)을 입력해야 함 | ||
135 | + | ||
136 | + //[ 현재 year, month, date, time(hour) 받아오기 ] | ||
137 | + //데이터 조회시 year이나 time은 7대신 07형태로 입력해야 하므로 slice를 이용하여 0X형태로 만듦 | ||
138 | + let present = new Date(); | ||
139 | + let present_year = present.getFullYear(); | ||
140 | + let present_month = ('0'+(present.getMonth() + 1)).slice(-2); | ||
141 | + let present_date = present.getDate(); | ||
142 | + let present_time = ('0'+(present.getHours())).slice(-2); | ||
143 | + | ||
144 | + //현재 년도, 월, 날짜를 YYYYMMDD형태로 변형 | ||
145 | + //날씨 오픈 api의 연일월 입력타입이 YYYYMMDD | ||
146 | + let YYYYMMDD = String(present_year)+String(present_month)+String(present_date); | ||
147 | + | ||
148 | + //어제 날짜 구하기 | ||
149 | + //어제 날짜를 구하는 이유는 바를 출력할 때는 최소 2-3시간, 그래프를 출력할 때에는 9시간 전 ~ 3시간 전의 데이터를 | ||
150 | + //수집해야 하는데, 이때 이 구간이 00시에 겹치는 경우에는 그 이전에 해당하는 시간은 yesterday_YYYYMMDD로, | ||
151 | + //그 이후에 해당하는 시간은 YYYYMMDD로 하여 데이터를 정확하게 가져오기 위함이다. | ||
152 | + let yesterday = new Date(present_year, present.getMonth(), present_date-1).toLocaleDateString(); | ||
153 | + ydata = yesterday.split('.'); | ||
154 | + yesterday_YYYYMMDD = String(ydata[0])+ ('0'+String(ydata[1].substr(1))).slice(-2) + ('0'+String(ydata[2].substr(1))).slice(-2) | ||
155 | + | ||
156 | + console.log(yesterday_YYYYMMDD) | ||
157 | + console.log(YYYYMMDD) | ||
158 | + | ||
159 | + | ||
160 | + //검색창에 휴게소 이름을 입력하면 실행되는 함수 Showweather() | ||
161 | + function Showweather() { | ||
162 | + | ||
163 | + //휴게소 이름을 검색하기 전까지는 기타 html 구성 요소들은 숨기기 위하여 innerHTML사용 | ||
164 | + //휴게소 이름 검색시 화면에 표시 | ||
165 | + //bar | ||
166 | + document.querySelector('bar1').innerHTML = '날씨'; | ||
167 | + document.querySelector('bar2').innerHTML = '온도'; | ||
168 | + document.querySelector('bar3').innerHTML = '습도'; | ||
169 | + document.querySelector('bar4').innerHTML = '바람'; | ||
170 | + | ||
171 | + //그래프 | ||
172 | + document.querySelector('exp1').innerHTML = 'Temperature 기온'; | ||
173 | + document.querySelector('exp2').innerHTML = '지금으로부터 9시간 전부터 3시간 전까지의 기온을 조회합니다. <br>* 날씨 데이터가 없는 시간대는 조회 불가능합니다'; | ||
174 | + document.querySelector('exp3').innerHTML = 'Humidity 습도'; | ||
175 | + document.querySelector('exp4').innerHTML = '지금으로부터 9시간 전부터 3시간 전까지의 습도를 조회합니다. '; | ||
176 | + document.querySelector('exp5').innerHTML = 'wind velocity 풍속'; | ||
177 | + document.querySelector('exp6').innerHTML = '지금으로부터 9시간 전부터 3시간 전까지의 풍속을 조회합니다. '; | ||
178 | + | ||
179 | + //사용자가 입력한 휴게소 이름의 값을 name 변수에 할당 | ||
180 | + name = document.getElementById('name').value | ||
181 | + //bar부분에 휴게소 이름 출력 | ||
182 | + document.querySelector('reststop_name').innerHTML = name;} | ||
183 | + | ||
184 | + </script> | ||
185 | + | ||
186 | + | ||
125 | </main> | 187 | </main> |
126 | <!-- Footer--> | 188 | <!-- Footer--> |
127 | <footer class="bg-dark py-4 mt-auto"> | 189 | <footer class="bg-dark py-4 mt-auto"> |
... | @@ -138,9 +200,11 @@ | ... | @@ -138,9 +200,11 @@ |
138 | </div> | 200 | </div> |
139 | </div> | 201 | </div> |
140 | </footer> | 202 | </footer> |
203 | + | ||
204 | + | ||
141 | <!-- Bootstrap core JS--> | 205 | <!-- Bootstrap core JS--> |
142 | <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> | 206 | <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> |
143 | <!-- Core theme JS--> | 207 | <!-- Core theme JS--> |
144 | <script src="js/scripts.js"></script> | 208 | <script src="js/scripts.js"></script> |
145 | </body> | 209 | </body> |
146 | -</html> | 210 | +</html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment