Joung Jiwon

Merge branch 'cal' into 'master'

add calculate

학년 학기 별 계산

See merge request !5
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html lang="en"> 2 <html lang="en">
3 - <head> 3 +
4 +<head>
4 <meta charset="UTF-8" /> 5 <meta charset="UTF-8" />
5 - <meta name="viewport" content="width=device-width, initial-scale=1.0"/> 6 + <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6 <meta http-equiv="X-UA-Compatible" content="ie=edge" /> 7 <meta http-equiv="X-UA-Compatible" content="ie=edge" />
7 - <title>DDuBuk</title> 8 + <title>The Town HTML CSS Template</title>
8 <link rel="stylesheet" href="fontawesome-5.5/css/all.min.css" /> 9 <link rel="stylesheet" href="fontawesome-5.5/css/all.min.css" />
9 <link rel="stylesheet" href="slick/slick.css"> 10 <link rel="stylesheet" href="slick/slick.css">
10 <link rel="stylesheet" href="slick/slick-theme.css"> 11 <link rel="stylesheet" href="slick/slick-theme.css">
11 <link rel="stylesheet" href="magnific-popup/magnific-popup.css"> 12 <link rel="stylesheet" href="magnific-popup/magnific-popup.css">
12 <link rel="stylesheet" href="css/bootstrap.min.css" /> 13 <link rel="stylesheet" href="css/bootstrap.min.css" />
13 <link rel="stylesheet" href="css/templatemo-style.css" /> 14 <link rel="stylesheet" href="css/templatemo-style.css" />
14 - <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">
15 17
16 - <script src="../../docs/js/jquery-1.9.1.js"></script>
17 - <script type="text/javascript" src="../../docs/js/examples-base.js"></script>
18 - <script type="text/javascript" src="../../docs/js/highlight.min.js"></script>
19 - <script type="text/javascript" src="https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=rr4owjosjy&submodules=geocoder"></script>
20 - <link rel="stylesheet" type="text/css" href="../../docs/css/examples-base.css" />
21 <!-- 18 <!--
22 The Town 19 The Town
23 https://templatemo.com/tm-525-the-town 20 https://templatemo.com/tm-525-the-town
24 --> 21 -->
22 +</head>
25 23
26 - <script type= "text/css"> 24 +<body>
27 - window.onload = function(){
28 - document.getElementById('btn').onclick = function(){
29 - document.getElementById('frm').submit();
30 - return false;
31 - };
32 -};
33 -
34 -</script>
35 -
36 - </head>
37 - <body>
38 <!-- Hero section --> 25 <!-- Hero section -->
39 <section id="hero" class="text-white tm-font-big tm-parallax"> 26 <section id="hero" class="text-white tm-font-big tm-parallax">
40 - <video autoplay muted loop id ="hero-video"> 27 + <video autoplay muted loop id="hero-video">
41 <source src="img/main-video1.mp4" type="video/mp4"> 28 <source src="img/main-video1.mp4" type="video/mp4">
42 </video> 29 </video>
43 <!-- Navigation --> 30 <!-- Navigation -->
...@@ -54,7 +41,7 @@ ...@@ -54,7 +41,7 @@
54 <h2 class="tm-hero-title">통학생은 길에서 몇시간을 보냈을까?</h2> 41 <h2 class="tm-hero-title">통학생은 길에서 몇시간을 보냈을까?</h2>
55 <p class="tm-hero-subtitle"> 42 <p class="tm-hero-subtitle">
56 매일 학교에 통학하시나요?<br> 43 매일 학교에 통학하시나요?<br>
57 - 뚜벅이님이 지금까지 몇 시간을 길에서 보냈는지 보여드립니다. 44 + 뚜벅이님이 지금까지 몇시간을 길에서 보냈는지 보여드립니다.
58 <br>-뚜벅이- 45 <br>-뚜벅이-
59 </p> 46 </p>
60 </div> 47 </div>
...@@ -62,7 +49,7 @@ ...@@ -62,7 +49,7 @@
62 49
63 <div class="tm-next tm-intro-next"> 50 <div class="tm-next tm-intro-next">
64 <a href="#introduction" class="text-center tm-down-arrow-link"> 51 <a href="#introduction" class="text-center tm-down-arrow-link">
65 - <i class="fas fa-3x fa-caret-down tm-down-arrow">계산하</i> 52 + <i class="fas fa-3x fa-caret-down tm-down-arrow">계산해보</i>
66 </a> 53 </a>
67 </div> 54 </div>
68 </section> 55 </section>
...@@ -77,18 +64,18 @@ ...@@ -77,18 +64,18 @@
77 <div class="question-text">어디에 사나요?</div> 64 <div class="question-text">어디에 사나요?</div>
78 <div class="question-input"> 65 <div class="question-input">
79 <label for="question-input-field"></label> 66 <label for="question-input-field"></label>
80 - <input type ="text" id="start"> 67 + <input type="text" id="question-input-field">
81 </div> 68 </div>
82 </div> 69 </div>
83 <div class="container question-field"> 70 <div class="container question-field">
84 - <div class="question-text">무슨 학교에 다니나요?</div> 71 + <div class="question-text">무슨학교에 다니나요?</div>
85 <div class="question-input"> 72 <div class="question-input">
86 <label for="question-input-field"></label> 73 <label for="question-input-field"></label>
87 - <input type ="text" id="end"> 74 + <input type="text" id="question-input-field">
88 </div> 75 </div>
89 </div> 76 </div>
90 <div class="container question-field"> 77 <div class="container question-field">
91 - <div class="question-text">학년인가요?</div> 78 + <div class="question-text">학년인가요?</div>
92 <div class="question-input"> 79 <div class="question-input">
93 <select name="semester" id="semester"> 80 <select name="semester" id="semester">
94 <option value="sem-1-1">1학년 1학기</option> 81 <option value="sem-1-1">1학년 1학기</option>
...@@ -103,170 +90,44 @@ ...@@ -103,170 +90,44 @@
103 </div> 90 </div>
104 </div> 91 </div>
105 <div class="container button-field"> 92 <div class="container button-field">
106 - <button class="button_calculate" type="button">계산하기 93 + <button class="button_calculate" type="button" onclick="semester();return false;">
94 + 계산해보기
107 </button> 95 </button>
108 </div> 96 </div>
109 </div> 97 </div>
110 -<br> 98 + <div class=row id="map-answer" style="margin-top:100px">
111 - 99 + <div style="width:30%">
112 - 100 + <iframe
113 -<div id="map" style="width:700px;height:700px;"></div> 101 + src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d203276.83209506533!2d126.94001771640623!3d37.24295009999998!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x357b44de2c7f3ddb%3A0x4c35e852f90f5520!2z6rK97Z2s64yA7ZWZ6rWQIOq1reygnOy6oO2NvOyKpA!5e0!3m2!1sko!2skr!4v1606155147622!5m2!1sko!2skr"
114 -<script> 102 + width=100% height="250" frameborder="0" style="border:0;" allowfullscreen="" aria-hidden="false"
115 -var btn = document.querySelector('button'); 103 + tabindex="0" right="20%"></iframe>
116 - 104 + </div>
117 -btn.addEventListener('click', updateBtn); 105 + <div class="answer-field">
118 - 106 + 한번 갈 때마다 ...<br>
119 -function updateBtn() { 107 + <span class="answer-highlight">n</span> 시간 <span class="answer-highlight">n</span><br>
120 - var start = document.getElementById('start').value; 108 + <span class="answer-highlight">n</span><br>
121 - var end = document.getElementById('end').value; 109 + </div>
122 - naver.maps.Service.geocode({ 110 + </div>
123 - address: start
124 -
125 - }, function(status, response) {
126 - if (status !== naver.maps.Service.Status.OK) {
127 - return alert('Something wrong!');
128 - }
129 - var result = response.result, // 검색 결과의 컨테이너
130 - items = result.items;
131 - var sx = result.items[0].point.x;
132 - var sy = result.items[0].point.y;
133 -
134 - naver.maps.Service.geocode({
135 - address: end
136 -
137 - }, function(status, response) {
138 - if (status !== naver.maps.Service.Status.OK) {
139 - return alert('Something wrong!');
140 - }
141 - var result = response.result, // 검색 결과의 컨테이너
142 - items = result.items;
143 - var ex = result.items[0].point.x;
144 - var ey = result.items[0].point.y;
145 -
146 -
147 - /*var sx = 127.0739547;
148 - var sy = 37.2407701;
149 - var ex = 126.921666;
150 - var ey = 37.1308333;
151 - */
152 -
153 -
154 - var mapOptions = {
155 - center: new naver.maps.LatLng(start,end),
156 - zoom: 10
157 - };
158 -
159 - var map = new naver.maps.Map('map', mapOptions);
160 -
161 -
162 -
163 - function searchPubTransPathAJAX() {
164 - var xhr = new XMLHttpRequest();
165 - //ODsay apiKey 입력
166 - var url = "https://api.odsay.com/v1/api/searchPubTransPath?SX="+sx+"&SY="+sy+"&EX="+ex+"&EY="+ey+"&apiKey=nnsDQB1AWhpETO3HmMdDAw";
167 - xhr.open("GET", url, true);
168 - xhr.send();
169 - xhr.onreadystatechange = function() {
170 - if (xhr.readyState == 4 && xhr.status == 200) {
171 - console.log( JSON.parse(xhr.responseText) ); // <- xhr.responseText 로 결과를 가져올 수 있음
172 - //노선그래픽 데이터 호출
173 - callMapObjApiAJAX((JSON.parse(xhr.responseText))["result"]["path"][0].info.mapObj);
174 - }
175 - }
176 - }
177 -
178 - //길찾기 API 호출
179 - searchPubTransPathAJAX();
180 -
181 - function callMapObjApiAJAX(mabObj){
182 - var xhr = new XMLHttpRequest();
183 - //ODsay apiKey 입력
184 - var url = "https://api.odsay.com/v1/api/loadLane?mapObject=0:0@"+mabObj+"&apiKey=nnsDQB1AWhpETO3HmMdDAw";
185 - xhr.open("GET", url, true);
186 - xhr.send();
187 - xhr.onreadystatechange = function() {
188 - if (xhr.readyState == 4 && xhr.status == 200) {
189 - var resultJsonData = JSON.parse(xhr.responseText);
190 - drawNaverMarker(sx,sy); // 출발지 마커 표시
191 - drawNaverMarker(ex,ey); // 도착지 마커 표시
192 - drawNaverPolyLine(resultJsonData); // 노선그래픽데이터 지도위 표시
193 - // boundary 데이터가 있을경우, 해당 boundary로 지도이동
194 - if(resultJsonData.result.boundary){
195 - var boundary = new naver.maps.LatLngBounds(
196 - new naver.maps.LatLng(resultJsonData.result.boundary.top, resultJsonData.result.boundary.left),
197 - new naver.maps.LatLng(resultJsonData.result.boundary.bottom, resultJsonData.result.boundary.right)
198 - );
199 - map.panToBounds(boundary);
200 - }
201 - }
202 - }
203 - }
204 -
205 - // 지도위 마커 표시해주는 함수
206 - function drawNaverMarker(x,y){
207 - var marker = new naver.maps.Marker({
208 - position: new naver.maps.LatLng(y, x),
209 - map: map
210 - });
211 - }
212 -
213 - // 노선그래픽 데이터를 이용하여 지도위 폴리라인 그려주는 함수
214 - function drawNaverPolyLine(data){
215 - var lineArray;
216 -
217 - for(var i = 0 ; i < data.result.lane.length; i++){
218 - for(var j=0 ; j <data.result.lane[i].section.length; j++){
219 - lineArray = null;
220 - lineArray = new Array();
221 - for(var k=0 ; k < data.result.lane[i].section[j].graphPos.length; k++){
222 - lineArray.push(new naver.maps.LatLng(data.result.lane[i].section[j].graphPos[k].y, data.result.lane[i].section[j].graphPos[k].x));
223 - }
224 -
225 - //지하철결과의 경우 노선에 따른 라인색상 지정하는 부분 (1,2호선의 경우만 예로 들음)
226 - if(data.result.lane[i].type == 1){
227 - var polyline = new naver.maps.Polyline({
228 - map: map,
229 - path: lineArray,
230 - strokeWeight: 3,
231 - strokeColor: '#003499'
232 - });
233 - }else if(data.result.lane[i].type == 2){
234 - var polyline = new naver.maps.Polyline({
235 - map: map,
236 - path: lineArray,
237 - strokeWeight: 3,
238 - strokeColor: '#37b42d'
239 - });
240 - }else{
241 - var polyline = new naver.maps.Polyline({
242 - map: map,
243 - path: lineArray,
244 - strokeWeight: 3
245 - });
246 - }
247 - }
248 - }
249 - }
250 - });
251 - });
252 -}
253 -</script>
254 -
255 <div class="row"> 111 <div class="row">
256 <div id="list-answer"> 112 <div id="list-answer">
257 <div class="answer-field" id="answer-how-many-hours"> 113 <div class="answer-field" id="answer-how-many-hours">
258 - 지금까지 <span class="answer-highlight">n</span> 시간을 길에서 보내셨군요!<br> 114 + 지금까지 <span class="answer-highlight" id="since">?</span>시간을 길에서 보내셨군요<br>
259 - 앞으로 <span class="answer-highlight">n</span> 시간은 더 길에서 보내시면 됩니다!!<br> 115 + 졸업까지 앞으로 <span class="answer-highlight" id="until">?</span>시간은 더 길에서 보내시면 됩니다.<br>
260 </div> 116 </div>
261 </div> 117 </div>
262 </div> 118 </div>
263 <div class="row"> 119 <div class="row">
264 - <div id="list-answer"> 120 + <div class="answer-detail-question">
265 - <div class="answer-field" id="answer-how-many-hours"> 121 + 이 시간에 알바를 했다면? <br>
266 - <p>이 시간에..</p> 122 + 교통비로 국밥 <br>
267 - 알바를 했다면? <span class="answer-highlight">n</span><br> 123 + 이 거리라면 에베레스트 등반을 <br>
268 - <p>이 돈이면..</p> 124 + 지구를
269 - 국밥이 <span class="answer-highlight">n</span> 그릇<br> 125 + </div>
126 + <div class="answer-detail-answer">
127 + <span id = "salary">?</span><br>
128 + <span id = "dish">?</span>그릇<br>
129 + <span id = "everest">?</span>번이나...<br>
130 + <span id = "earth">?</span>바퀴나 돌아요<br>
270 </div> 131 </div>
271 </div> 132 </div>
272 </div> 133 </div>
...@@ -284,80 +145,142 @@ function updateBtn() { ...@@ -284,80 +145,142 @@ function updateBtn() {
284 <script src="js/jquery.singlePageNav.min.js"></script> 145 <script src="js/jquery.singlePageNav.min.js"></script>
285 <script src="js/bootstrap.min.js"></script> 146 <script src="js/bootstrap.min.js"></script>
286 <script> 147 <script>
287 - $('button-calculate').click(function(){ 148 + $('button-calculate').click(function () {
288 149
289 }) 150 })
290 151
291 - function getOffSet(){ 152 + function semester() {
153 + var target = document.getElementById("semester").value;
154 + var input = 0
155 +
156 + var since, until, salary, dish, everest, earth
157 +
158 + // 임시값 지정
159 + var time = 2
160 + var distance = 30000
161 + var costs = 100000
162 +
163 + function sum(sem) {
164 + since = sem * time * 150
165 + until = (8 - sem) * time * 150
166 + salary = since * 8590
167 + dish = Math.floor((costs * 150) / 6000)
168 + everest = Math.floor((distance * 2) / 8846)
169 + earth = ((distance * 2) / 40075000).toFixed(3)
170 + }
171 +
172 + if (target == 'sem-1-1') {
173 + input = 1
174 + sum(input)
175 + }
176 + else if (target == 'sem-1-2') {
177 + input = 2
178 + sum(input)
179 + }
180 + else if (target == 'sem-2-1') {
181 + input = 3
182 + sum(input)
183 + }
184 + else if (target == 'sem-2-2') {
185 + input = 4
186 + sum(input)
187 + }
188 + else if (target == 'sem-3-1') {
189 + input = 5
190 + sum(input)
191 + }
192 + else if (target == 'sem-3-2') {
193 + input = 6
194 + sum(input)
195 + }
196 + else if (target == 'sem-4-1') {
197 + input = 7
198 + sum(input)
199 + }
200 + else if (target == 'sem-4-2') {
201 + input = 8
202 + sum(input)
203 + }
204 +
205 + document.getElementById("since").innerHTML = since
206 + document.getElementById("until").innerHTML = until
207 + document.getElementById("salary").innerHTML = salary
208 + document.getElementById("dish").innerHTML = dish
209 + document.getElementById("everest").innerHTML = everest
210 + document.getElementById("earth").innerHTML = earth
211 + }
212 +
213 +
214 + function getOffSet() {
292 var _offset = 450; 215 var _offset = 450;
293 var windowHeight = window.innerHeight; 216 var windowHeight = window.innerHeight;
294 217
295 - if(windowHeight > 500) { 218 + if (windowHeight > 500) {
296 _offset = 400; 219 _offset = 400;
297 } 220 }
298 - if(windowHeight > 680) { 221 + if (windowHeight > 680) {
299 _offset = 300 222 _offset = 300
300 } 223 }
301 - if(windowHeight > 830) { 224 + if (windowHeight > 830) {
302 _offset = 210; 225 _offset = 210;
303 } 226 }
304 227
305 return _offset; 228 return _offset;
306 } 229 }
307 230
308 - function setParallaxPosition($doc, multiplier, $object){ 231 + function setParallaxPosition($doc, multiplier, $object) {
309 var offset = getOffSet(); 232 var offset = getOffSet();
310 var from_top = $doc.scrollTop(), 233 var from_top = $doc.scrollTop(),
311 - bg_css = 'center ' +(multiplier * from_top - offset) + 'px'; 234 + bg_css = 'center ' + (multiplier * from_top - offset) + 'px';
312 - $object.css({"background-position" : bg_css }); 235 + $object.css({ "background-position": bg_css });
313 } 236 }
314 237
315 // Parallax function 238 // Parallax function
316 // Adapted based on https://codepen.io/roborich/pen/wpAsm 239 // Adapted based on https://codepen.io/roborich/pen/wpAsm
317 - var background_image_parallax = function($object, multiplier, forceSet){ 240 + var background_image_parallax = function ($object, multiplier, forceSet) {
318 multiplier = typeof multiplier !== 'undefined' ? multiplier : 0.5; 241 multiplier = typeof multiplier !== 'undefined' ? multiplier : 0.5;
319 multiplier = 1 - multiplier; 242 multiplier = 1 - multiplier;
320 var $doc = $(document); 243 var $doc = $(document);
321 // $object.css({"background-attatchment" : "fixed"}); 244 // $object.css({"background-attatchment" : "fixed"});
322 245
323 - if(forceSet) { 246 + if (forceSet) {
324 setParallaxPosition($doc, multiplier, $object); 247 setParallaxPosition($doc, multiplier, $object);
325 } else { 248 } else {
326 - $(window).scroll(function(){ 249 + $(window).scroll(function () {
327 setParallaxPosition($doc, multiplier, $object); 250 setParallaxPosition($doc, multiplier, $object);
328 }); 251 });
329 } 252 }
330 }; 253 };
331 254
332 - var background_image_parallax_2 = function($object, multiplier){ 255 + var background_image_parallax_2 = function ($object, multiplier) {
333 multiplier = typeof multiplier !== 'undefined' ? multiplier : 0.5; 256 multiplier = typeof multiplier !== 'undefined' ? multiplier : 0.5;
334 multiplier = 1 - multiplier; 257 multiplier = 1 - multiplier;
335 var $doc = $(document); 258 var $doc = $(document);
336 - $object.css({"background-attachment" : "fixed"}); 259 + $object.css({ "background-attachment": "fixed" });
337 - $(window).scroll(function(){ 260 + $(window).scroll(function () {
338 var firstTop = $object.offset().top, 261 var firstTop = $object.offset().top,
339 pos = $(window).scrollTop(), 262 pos = $(window).scrollTop(),
340 yPos = Math.round((multiplier * (firstTop - pos)) - 186); 263 yPos = Math.round((multiplier * (firstTop - pos)) - 186);
341 264
342 var bg_css = 'center ' + yPos + 'px'; 265 var bg_css = 'center ' + yPos + 'px';
343 266
344 - $object.css({"background-position" : bg_css }); 267 + $object.css({ "background-position": bg_css });
345 }); 268 });
346 }; 269 };
347 270
348 - $(function(){ 271 + $(function () {
349 // Hero Section - Background Parallax 272 // Hero Section - Background Parallax
350 background_image_parallax($(".tm-parallax"), 0.30, false); 273 background_image_parallax($(".tm-parallax"), 0.30, false);
351 background_image_parallax_2($("#contact"), 0.80); 274 background_image_parallax_2($("#contact"), 0.80);
352 275
353 // Handle window resize 276 // Handle window resize
354 - window.addEventListener('resize', function(){ 277 + window.addEventListener('resize', function () {
355 background_image_parallax($(".tm-parallax"), 0.30, true); 278 background_image_parallax($(".tm-parallax"), 0.30, true);
356 }, true); 279 }, true);
357 280
358 // Detect window scroll and update navbar 281 // Detect window scroll and update navbar
359 - $(window).scroll(function(e){ 282 + $(window).scroll(function (e) {
360 - if($(document).scrollTop() > 120) { 283 + if ($(document).scrollTop() > 120) {
361 $('.tm-navbar').addClass("scroll"); 284 $('.tm-navbar').addClass("scroll");
362 } else { 285 } else {
363 $('.tm-navbar').removeClass("scroll"); 286 $('.tm-navbar').removeClass("scroll");
...@@ -365,7 +288,7 @@ function updateBtn() { ...@@ -365,7 +288,7 @@ function updateBtn() {
365 }); 288 });
366 289
367 // Close mobile menu after click 290 // Close mobile menu after click
368 - $('#tmNav a').on('click', function(){ 291 + $('#tmNav a').on('click', function () {
369 $('.navbar-collapse').removeClass('show'); 292 $('.navbar-collapse').removeClass('show');
370 }) 293 })
371 294
...@@ -374,7 +297,7 @@ function updateBtn() { ...@@ -374,7 +297,7 @@ function updateBtn() {
374 297
375 // Add smooth scrolling to all links 298 // Add smooth scrolling to all links
376 // https://www.w3schools.com/howto/howto_css_smooth_scroll.asp 299 // https://www.w3schools.com/howto/howto_css_smooth_scroll.asp
377 - $("a").on('click', function(event) { 300 + $("a").on('click', function (event) {
378 $('html, body').animate({ 301 $('html, body').animate({
379 scrollTop: $("#contact").offset().top 302 scrollTop: $("#contact").offset().top
380 }, 400); 303 }, 400);
...@@ -426,5 +349,6 @@ function updateBtn() { ...@@ -426,5 +349,6 @@ function updateBtn() {
426 }); 349 });
427 }); 350 });
428 </script> 351 </script>
429 - </body> 352 +</body>
353 +
430 </html> 354 </html>
...\ No newline at end of file ...\ No newline at end of file
......