Showing
1 changed file
with
41 additions
and
37 deletions
... | @@ -12,12 +12,14 @@ | ... | @@ -12,12 +12,14 @@ |
12 | <link rel="stylesheet" href="magnific-popup/magnific-popup.css"> | 12 | <link rel="stylesheet" href="magnific-popup/magnific-popup.css"> |
13 | <link rel="stylesheet" href="css/bootstrap.min.css" /> | 13 | <link rel="stylesheet" href="css/bootstrap.min.css" /> |
14 | <link rel="stylesheet" href="css/templatemo-style.css" /> | 14 | <link rel="stylesheet" href="css/templatemo-style.css" /> |
15 | - <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/moonspam/NanumBarunGothic@1.0/nanumbarungothicsubset.css"> | 15 | + <link rel="stylesheet" type="text/css" |
16 | + href="https://cdn.jsdelivr.net/gh/moonspam/NanumBarunGothic@1.0/nanumbarungothicsubset.css"> | ||
16 | 17 | ||
17 | <script src="../../docs/js/jquery-1.9.1.js"></script> | 18 | <script src="../../docs/js/jquery-1.9.1.js"></script> |
18 | <script type="text/javascript" src="../../docs/js/examples-base.js"></script> | 19 | <script type="text/javascript" src="../../docs/js/examples-base.js"></script> |
19 | <script type="text/javascript" src="../../docs/js/highlight.min.js"></script> | 20 | <script type="text/javascript" src="../../docs/js/highlight.min.js"></script> |
20 | - <script type="text/javascript" src="https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=rr4owjosjy&submodules=geocoder"></script> | 21 | + <script type="text/javascript" |
22 | + src="https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=rr4owjosjy&submodules=geocoder"></script> | ||
21 | <link rel="stylesheet" type="text/css" href="../../docs/css/examples-base.css" /> | 23 | <link rel="stylesheet" type="text/css" href="../../docs/css/examples-base.css" /> |
22 | 24 | ||
23 | <!-- | 25 | <!-- |
... | @@ -27,7 +29,7 @@ | ... | @@ -27,7 +29,7 @@ |
27 | 29 | ||
28 | 30 | ||
29 | 31 | ||
30 | - <script type= "text/css"> | 32 | + <script type="text/css"> |
31 | window.onload = function(){ | 33 | window.onload = function(){ |
32 | document.getElementById('btn').onclick = function(){ | 34 | document.getElementById('btn').onclick = function(){ |
33 | document.getElementById('frm').submit(); | 35 | document.getElementById('frm').submit(); |
... | @@ -81,15 +83,16 @@ | ... | @@ -81,15 +83,16 @@ |
81 | <div class="question-field question-home">어디에 사나요?</div> | 83 | <div class="question-field question-home">어디에 사나요?</div> |
82 | <div class="input-field input-home"> | 84 | <div class="input-field input-home"> |
83 | <label for="question-input-field"></label> | 85 | <label for="question-input-field"></label> |
84 | - <input type ="text" id="start"></div> | 86 | + <input type="text" id="start"></div> |
85 | <div class="question-field question-school">무슨 학교에 다니나요?</div> | 87 | <div class="question-field question-school">무슨 학교에 다니나요?</div> |
86 | <div class="input-school"> | 88 | <div class="input-school"> |
87 | <label for="question-input-field"></label> | 89 | <label for="question-input-field"></label> |
88 | - <input type ="text" id="end"> | 90 | + <input type="text" id="end"> |
89 | </div> | 91 | </div> |
90 | <div class="question-field question-grade">몇학년인가요?</div> | 92 | <div class="question-field question-grade">몇학년인가요?</div> |
91 | - <div class="input-grade"><div class="custom-select" style="width:208px; margin-right:40px"> | 93 | + <div class="input-grade"> |
92 | - <select> | 94 | + <div class="custom-select" style="width:208px; margin-right:40px"> |
95 | + <select id="semester"> | ||
93 | <option value="0">1학년 1학기</option> | 96 | <option value="0">1학년 1학기</option> |
94 | <option value="sem-1-1">1학년 1학기</option> | 97 | <option value="sem-1-1">1학년 1학기</option> |
95 | <option value="sem-1-2">1학년 2학기</option> | 98 | <option value="sem-1-2">1학년 2학기</option> |
... | @@ -100,9 +103,10 @@ | ... | @@ -100,9 +103,10 @@ |
100 | <option value="sem-4-1">4학년 1학기</option> | 103 | <option value="sem-4-1">4학년 1학기</option> |
101 | <option value="sem-4-2">4학년 2학기</option> | 104 | <option value="sem-4-2">4학년 2학기</option> |
102 | </select> | 105 | </select> |
103 | - </div></div> | ||
104 | </div> | 106 | </div> |
105 | - <a href="#result" class="text-center tm-down-arrow-link"> | 107 | + </div> |
108 | + </div> | ||
109 | + <a href="#result" class="text-center tm-down-arrow-link" onclick="semester();return false;"> | ||
106 | <i class="fas fa-3x fa-caret-down tm-down-arrow">계산해보기</i> | 110 | <i class="fas fa-3x fa-caret-down tm-down-arrow">계산해보기</i> |
107 | </a> | 111 | </a> |
108 | </div> | 112 | </div> |
... | @@ -131,10 +135,10 @@ | ... | @@ -131,10 +135,10 @@ |
131 | 지구를 | 135 | 지구를 |
132 | </div> | 136 | </div> |
133 | <div class="answer-detail-answer"> | 137 | <div class="answer-detail-answer"> |
134 | - <span id = "salary">?</span>원<br> | 138 | + <span id="salary">?</span>원<br> |
135 | - <span id = "dish">?</span>그릇<br> | 139 | + <span id="dish">?</span>그릇<br> |
136 | - <span id = "everest">?</span>번이나...<br> | 140 | + <span id="everest">?</span>번이나...<br> |
137 | - <span id = "earth">?</span>바퀴나 돌아요<br><br><br> | 141 | + <span id="earth">?</span>바퀴나 돌아요<br><br><br> |
138 | </div> | 142 | </div> |
139 | </div> | 143 | </div> |
140 | <footer class="text-center small tm-footer"> | 144 | <footer class="text-center small tm-footer"> |
... | @@ -174,7 +178,7 @@ | ... | @@ -174,7 +178,7 @@ |
174 | create a new DIV that will act as an option item:*/ | 178 | create a new DIV that will act as an option item:*/ |
175 | c = document.createElement("DIV"); | 179 | c = document.createElement("DIV"); |
176 | c.innerHTML = selElmnt.options[j].innerHTML; | 180 | c.innerHTML = selElmnt.options[j].innerHTML; |
177 | - c.addEventListener("click", function(e) { | 181 | + c.addEventListener("click", function (e) { |
178 | /*when an item is clicked, update the original select box, | 182 | /*when an item is clicked, update the original select box, |
179 | and the selected item:*/ | 183 | and the selected item:*/ |
180 | var y, i, k, s, h, sl, yl; | 184 | var y, i, k, s, h, sl, yl; |
... | @@ -199,7 +203,7 @@ | ... | @@ -199,7 +203,7 @@ |
199 | b.appendChild(c); | 203 | b.appendChild(c); |
200 | } | 204 | } |
201 | x[i].appendChild(b); | 205 | x[i].appendChild(b); |
202 | - a.addEventListener("click", function(e) { | 206 | + a.addEventListener("click", function (e) { |
203 | /*when the select box is clicked, close any other select boxes, | 207 | /*when the select box is clicked, close any other select boxes, |
204 | and open/close the current select box:*/ | 208 | and open/close the current select box:*/ |
205 | e.stopPropagation(); | 209 | e.stopPropagation(); |
... | @@ -244,7 +248,7 @@ | ... | @@ -244,7 +248,7 @@ |
244 | naver.maps.Service.geocode({ | 248 | naver.maps.Service.geocode({ |
245 | address: start | 249 | address: start |
246 | 250 | ||
247 | - }, function(status, response) { | 251 | + }, function (status, response) { |
248 | if (status !== naver.maps.Service.Status.OK) { | 252 | if (status !== naver.maps.Service.Status.OK) { |
249 | return alert('Something wrong!'); | 253 | return alert('Something wrong!'); |
250 | } | 254 | } |
... | @@ -256,7 +260,7 @@ | ... | @@ -256,7 +260,7 @@ |
256 | naver.maps.Service.geocode({ | 260 | naver.maps.Service.geocode({ |
257 | address: end | 261 | address: end |
258 | 262 | ||
259 | - }, function(status, response) { | 263 | + }, function (status, response) { |
260 | if (status !== naver.maps.Service.Status.OK) { | 264 | if (status !== naver.maps.Service.Status.OK) { |
261 | return alert('Something wrong!'); | 265 | return alert('Something wrong!'); |
262 | } | 266 | } |
... | @@ -274,7 +278,7 @@ | ... | @@ -274,7 +278,7 @@ |
274 | 278 | ||
275 | 279 | ||
276 | var mapOptions = { | 280 | var mapOptions = { |
277 | - center: new naver.maps.LatLng(start,end), | 281 | + center: new naver.maps.LatLng(start, end), |
278 | zoom: 10 | 282 | zoom: 10 |
279 | }; | 283 | }; |
280 | 284 | ||
... | @@ -285,12 +289,12 @@ | ... | @@ -285,12 +289,12 @@ |
285 | function searchPubTransPathAJAX() { | 289 | function searchPubTransPathAJAX() { |
286 | var xhr = new XMLHttpRequest(); | 290 | var xhr = new XMLHttpRequest(); |
287 | //ODsay apiKey 입력 | 291 | //ODsay apiKey 입력 |
288 | - var url = "https://api.odsay.com/v1/api/searchPubTransPath?SX="+sx+"&SY="+sy+"&EX="+ex+"&EY="+ey+"&apiKey=nnsDQB1AWhpETO3HmMdDAw"; | 292 | + var url = "https://api.odsay.com/v1/api/searchPubTransPath?SX=" + sx + "&SY=" + sy + "&EX=" + ex + "&EY=" + ey + "&apiKey=nnsDQB1AWhpETO3HmMdDAw"; |
289 | xhr.open("GET", url, true); | 293 | xhr.open("GET", url, true); |
290 | xhr.send(); | 294 | xhr.send(); |
291 | - xhr.onreadystatechange = function() { | 295 | + xhr.onreadystatechange = function () { |
292 | if (xhr.readyState == 4 && xhr.status == 200) { | 296 | if (xhr.readyState == 4 && xhr.status == 200) { |
293 | - console.log( JSON.parse(xhr.responseText) ); // <- xhr.responseText 로 결과를 가져올 수 있음 | 297 | + console.log(JSON.parse(xhr.responseText)); // <- xhr.responseText 로 결과를 가져올 수 있음 |
294 | //노선그래픽 데이터 호출 | 298 | //노선그래픽 데이터 호출 |
295 | callMapObjApiAJAX((JSON.parse(xhr.responseText))["result"]["path"][0].info.mapObj); | 299 | callMapObjApiAJAX((JSON.parse(xhr.responseText))["result"]["path"][0].info.mapObj); |
296 | } | 300 | } |
... | @@ -300,20 +304,20 @@ | ... | @@ -300,20 +304,20 @@ |
300 | //길찾기 API 호출 | 304 | //길찾기 API 호출 |
301 | searchPubTransPathAJAX(); | 305 | searchPubTransPathAJAX(); |
302 | 306 | ||
303 | - function callMapObjApiAJAX(mabObj){ | 307 | + function callMapObjApiAJAX(mabObj) { |
304 | var xhr = new XMLHttpRequest(); | 308 | var xhr = new XMLHttpRequest(); |
305 | //ODsay apiKey 입력 | 309 | //ODsay apiKey 입력 |
306 | - var url = "https://api.odsay.com/v1/api/loadLane?mapObject=0:0@"+mabObj+"&apiKey=nnsDQB1AWhpETO3HmMdDAw"; | 310 | + var url = "https://api.odsay.com/v1/api/loadLane?mapObject=0:0@" + mabObj + "&apiKey=nnsDQB1AWhpETO3HmMdDAw"; |
307 | xhr.open("GET", url, true); | 311 | xhr.open("GET", url, true); |
308 | xhr.send(); | 312 | xhr.send(); |
309 | - xhr.onreadystatechange = function() { | 313 | + xhr.onreadystatechange = function () { |
310 | if (xhr.readyState == 4 && xhr.status == 200) { | 314 | if (xhr.readyState == 4 && xhr.status == 200) { |
311 | var resultJsonData = JSON.parse(xhr.responseText); | 315 | var resultJsonData = JSON.parse(xhr.responseText); |
312 | - drawNaverMarker(sx,sy); // 출발지 마커 표시 | 316 | + drawNaverMarker(sx, sy); // 출발지 마커 표시 |
313 | - drawNaverMarker(ex,ey); // 도착지 마커 표시 | 317 | + drawNaverMarker(ex, ey); // 도착지 마커 표시 |
314 | drawNaverPolyLine(resultJsonData); // 노선그래픽데이터 지도위 표시 | 318 | drawNaverPolyLine(resultJsonData); // 노선그래픽데이터 지도위 표시 |
315 | // boundary 데이터가 있을경우, 해당 boundary로 지도이동 | 319 | // boundary 데이터가 있을경우, 해당 boundary로 지도이동 |
316 | - if(resultJsonData.result.boundary){ | 320 | + if (resultJsonData.result.boundary) { |
317 | var boundary = new naver.maps.LatLngBounds( | 321 | var boundary = new naver.maps.LatLngBounds( |
318 | new naver.maps.LatLng(resultJsonData.result.boundary.top, resultJsonData.result.boundary.left), | 322 | new naver.maps.LatLng(resultJsonData.result.boundary.top, resultJsonData.result.boundary.left), |
319 | new naver.maps.LatLng(resultJsonData.result.boundary.bottom, resultJsonData.result.boundary.right) | 323 | new naver.maps.LatLng(resultJsonData.result.boundary.bottom, resultJsonData.result.boundary.right) |
... | @@ -325,7 +329,7 @@ | ... | @@ -325,7 +329,7 @@ |
325 | } | 329 | } |
326 | 330 | ||
327 | // 지도위 마커 표시해주는 함수 | 331 | // 지도위 마커 표시해주는 함수 |
328 | - function drawNaverMarker(x,y){ | 332 | + function drawNaverMarker(x, y) { |
329 | var marker = new naver.maps.Marker({ | 333 | var marker = new naver.maps.Marker({ |
330 | position: new naver.maps.LatLng(y, x), | 334 | position: new naver.maps.LatLng(y, x), |
331 | map: map | 335 | map: map |
... | @@ -333,33 +337,33 @@ | ... | @@ -333,33 +337,33 @@ |
333 | } | 337 | } |
334 | 338 | ||
335 | // 노선그래픽 데이터를 이용하여 지도위 폴리라인 그려주는 함수 | 339 | // 노선그래픽 데이터를 이용하여 지도위 폴리라인 그려주는 함수 |
336 | - function drawNaverPolyLine(data){ | 340 | + function drawNaverPolyLine(data) { |
337 | var lineArray; | 341 | var lineArray; |
338 | 342 | ||
339 | - for(var i = 0 ; i < data.result.lane.length; i++){ | 343 | + for (var i = 0; i < data.result.lane.length; i++) { |
340 | - for(var j=0 ; j <data.result.lane[i].section.length; j++){ | 344 | + for (var j = 0; j < data.result.lane[i].section.length; j++) { |
341 | lineArray = null; | 345 | lineArray = null; |
342 | lineArray = new Array(); | 346 | lineArray = new Array(); |
343 | - for(var k=0 ; k < data.result.lane[i].section[j].graphPos.length; k++){ | 347 | + for (var k = 0; k < data.result.lane[i].section[j].graphPos.length; k++) { |
344 | lineArray.push(new naver.maps.LatLng(data.result.lane[i].section[j].graphPos[k].y, data.result.lane[i].section[j].graphPos[k].x)); | 348 | lineArray.push(new naver.maps.LatLng(data.result.lane[i].section[j].graphPos[k].y, data.result.lane[i].section[j].graphPos[k].x)); |
345 | } | 349 | } |
346 | 350 | ||
347 | //지하철결과의 경우 노선에 따른 라인색상 지정하는 부분 (1,2호선의 경우만 예로 들음) | 351 | //지하철결과의 경우 노선에 따른 라인색상 지정하는 부분 (1,2호선의 경우만 예로 들음) |
348 | - if(data.result.lane[i].type == 1){ | 352 | + if (data.result.lane[i].type == 1) { |
349 | var polyline = new naver.maps.Polyline({ | 353 | var polyline = new naver.maps.Polyline({ |
350 | map: map, | 354 | map: map, |
351 | path: lineArray, | 355 | path: lineArray, |
352 | strokeWeight: 3, | 356 | strokeWeight: 3, |
353 | strokeColor: '#003499' | 357 | strokeColor: '#003499' |
354 | }); | 358 | }); |
355 | - }else if(data.result.lane[i].type == 2){ | 359 | + } else if (data.result.lane[i].type == 2) { |
356 | var polyline = new naver.maps.Polyline({ | 360 | var polyline = new naver.maps.Polyline({ |
357 | map: map, | 361 | map: map, |
358 | path: lineArray, | 362 | path: lineArray, |
359 | strokeWeight: 3, | 363 | strokeWeight: 3, |
360 | strokeColor: '#37b42d' | 364 | strokeColor: '#37b42d' |
361 | }); | 365 | }); |
362 | - }else{ | 366 | + } else { |
363 | var polyline = new naver.maps.Polyline({ | 367 | var polyline = new naver.maps.Polyline({ |
364 | map: map, | 368 | map: map, |
365 | path: lineArray, | 369 | path: lineArray, |
... | @@ -387,13 +391,13 @@ | ... | @@ -387,13 +391,13 @@ |
387 | // 임시값 지정 | 391 | // 임시값 지정 |
388 | var time = 2 | 392 | var time = 2 |
389 | var distance = 30000 | 393 | var distance = 30000 |
390 | - var costs = 100000 | 394 | + var pay = 100000 |
391 | 395 | ||
392 | function sum(sem) { | 396 | function sum(sem) { |
393 | since = sem * time * 150 | 397 | since = sem * time * 150 |
394 | until = (8 - sem) * time * 150 | 398 | until = (8 - sem) * time * 150 |
395 | salary = since * 8590 | 399 | salary = since * 8590 |
396 | - dish = Math.floor((costs * 150) / 6000) | 400 | + dish = Math.floor((pay * 150) / 6000) |
397 | everest = Math.floor((distance * 2) / 8846) | 401 | everest = Math.floor((distance * 2) / 8846) |
398 | earth = ((distance * 2) / 40075000).toFixed(3) | 402 | earth = ((distance * 2) / 40075000).toFixed(3) |
399 | } | 403 | } | ... | ... |
-
Please register or login to post a comment