Showing
5 changed files
with
406 additions
and
159 deletions
... | @@ -9,7 +9,7 @@ | ... | @@ -9,7 +9,7 @@ |
9 | <meta name="description" content=""> | 9 | <meta name="description" content=""> |
10 | <meta name="author" content=""> | 10 | <meta name="author" content=""> |
11 | 11 | ||
12 | - <title>저기어때</title> | 12 | + <title>뭐라도해</title> |
13 | 13 | ||
14 | <!-- Bootstrap core CSS--> | 14 | <!-- Bootstrap core CSS--> |
15 | <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet"> | 15 | <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet"> |
... | @@ -31,7 +31,7 @@ | ... | @@ -31,7 +31,7 @@ |
31 | 31 | ||
32 | <nav class="navbar navbar-expand navbar-dark bg-dark static-top"> | 32 | <nav class="navbar navbar-expand navbar-dark bg-dark static-top"> |
33 | 33 | ||
34 | - <a class="navbar-brand mr-1" href="index.html">저기어때</a> | 34 | + <a class="navbar-brand mr-1" href="index.html">뭐라도해</a> |
35 | 35 | ||
36 | <button class="btn btn-link btn-sm text-white order-1 order-sm-0" id="sidebarToggle" href="#"> | 36 | <button class="btn btn-link btn-sm text-white order-1 order-sm-0" id="sidebarToggle" href="#"> |
37 | <i class="fas fa-bars"></i> | 37 | <i class="fas fa-bars"></i> |
... | @@ -102,7 +102,7 @@ | ... | @@ -102,7 +102,7 @@ |
102 | var map; | 102 | var map; |
103 | var service; | 103 | var service; |
104 | var _length =0; | 104 | var _length =0; |
105 | - var _temp = 0; | 105 | + var check = 0; |
106 | 106 | ||
107 | function initMap() { | 107 | function initMap() { |
108 | // Try HTML5 geolocation. | 108 | // Try HTML5 geolocation. |
... | @@ -128,7 +128,7 @@ | ... | @@ -128,7 +128,7 @@ |
128 | searchPlace('night_club', 'entertainment'); | 128 | searchPlace('night_club', 'entertainment'); |
129 | searchPlace('shopping_mall', 'entertainment'); | 129 | searchPlace('shopping_mall', 'entertainment'); |
130 | searchPlace('zoo', 'entertainment'); | 130 | searchPlace('zoo', 'entertainment'); |
131 | - if (_temp ==5) | 131 | + if (check ==1) |
132 | makecard(_length); | 132 | makecard(_length); |
133 | }); | 133 | }); |
134 | } | 134 | } |
... | @@ -169,17 +169,19 @@ | ... | @@ -169,17 +169,19 @@ |
169 | result_entertainment.push(results[i]); | 169 | result_entertainment.push(results[i]); |
170 | _length +=1; | 170 | _length +=1; |
171 | console.log(_length); | 171 | console.log(_length); |
172 | - if (_length ==2) | 172 | + |
173 | + if (i ==results.length-1) | ||
173 | makecard(_length); | 174 | makecard(_length); |
174 | //console.log(result_entertainment[i]); | 175 | //console.log(result_entertainment[i]); |
175 | - _temp = 5; | 176 | + check =1; |
176 | 177 | ||
177 | } | 178 | } |
178 | } | 179 | } |
179 | } | 180 | } |
180 | function makecard(_length) | 181 | function makecard(_length) |
181 | { | 182 | { |
182 | - console.log("make") | 183 | + console.log("make"); |
184 | + console.log(_length); | ||
183 | for(var i =0;i<_length;i++) | 185 | for(var i =0;i<_length;i++) |
184 | { | 186 | { |
185 | //console.log(result_entertainment[i]); | 187 | //console.log(result_entertainment[i]); |
... | @@ -196,7 +198,8 @@ | ... | @@ -196,7 +198,8 @@ |
196 | '</div>'; | 198 | '</div>'; |
197 | //card+=tmp; | 199 | //card+=tmp; |
198 | console.log(tmp); | 200 | console.log(tmp); |
199 | - document.getElementById("cardBody").innerHTML = tmp; | 201 | + card +=tmp; |
202 | + document.getElementById("cardBody").innerHTML = card; | ||
200 | 203 | ||
201 | } | 204 | } |
202 | } | 205 | } |
... | @@ -270,25 +273,6 @@ | ... | @@ -270,25 +273,6 @@ |
270 | </a> | 273 | </a> |
271 | 274 | ||
272 | 275 | ||
273 | - | ||
274 | - <!-- Bootstrap core JavaScript--> | ||
275 | - <script src="vendor/jquery/jquery.min.js"></script> | ||
276 | - <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> | ||
277 | - | ||
278 | - <!-- Core plugin JavaScript--> | ||
279 | - <script src="vendor/jquery-easing/jquery.easing.min.js"></script> | ||
280 | - | ||
281 | - <!-- Page level plugin JavaScript--> | ||
282 | - <script src="vendor/chart.js/Chart.min.js"></script> | ||
283 | - | ||
284 | - <!-- Custom scripts for all pages--> | ||
285 | - <script src="js/sb-admin.min.js"></script> | ||
286 | - | ||
287 | - <!-- Demo scripts for this page--> | ||
288 | - <script src="js/demo/chart-area-demo.js"></script> | ||
289 | - <script src="js/demo/chart-bar-demo.js"></script> | ||
290 | - <script src="js/demo/chart-pie-demo.js"></script> | ||
291 | - | ||
292 | </body> | 276 | </body> |
293 | 277 | ||
294 | </html> | 278 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -9,7 +9,7 @@ | ... | @@ -9,7 +9,7 @@ |
9 | <meta name="description" content=""> | 9 | <meta name="description" content=""> |
10 | <meta name="author" content=""> | 10 | <meta name="author" content=""> |
11 | 11 | ||
12 | - <title>저기어때</title> | 12 | + <title>뭐라도해</title> |
13 | 13 | ||
14 | <!-- Bootstrap core CSS--> | 14 | <!-- Bootstrap core CSS--> |
15 | <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet"> | 15 | <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet"> |
... | @@ -31,7 +31,7 @@ | ... | @@ -31,7 +31,7 @@ |
31 | 31 | ||
32 | <nav class="navbar navbar-expand navbar-dark bg-dark static-top"> | 32 | <nav class="navbar navbar-expand navbar-dark bg-dark static-top"> |
33 | 33 | ||
34 | - <a class="navbar-brand mr-1" href="index.html">저기어때</a> | 34 | + <a class="navbar-brand mr-1" href="index.html">뭐라도해</a> |
35 | 35 | ||
36 | <button class="btn btn-link btn-sm text-white order-1 order-sm-0" id="sidebarToggle" href="#"> | 36 | <button class="btn btn-link btn-sm text-white order-1 order-sm-0" id="sidebarToggle" href="#"> |
37 | <i class="fas fa-bars"></i> | 37 | <i class="fas fa-bars"></i> |
... | @@ -86,10 +86,133 @@ | ... | @@ -86,10 +86,133 @@ |
86 | </ol> | 86 | </ol> |
87 | 87 | ||
88 | <!-- Icon Cards--> | 88 | <!-- Icon Cards--> |
89 | - <div class="row" id="body"> | 89 | + <div class="row" id="cardBody"> |
90 | - <script src="js/showFood.js"></script> | ||
91 | </div> | 90 | </div> |
92 | 91 | ||
92 | + <script> | ||
93 | + var result_food = []; | ||
94 | + </script> | ||
95 | + | ||
96 | + <script> | ||
97 | + var entName = ''; | ||
98 | + var entType = ''; | ||
99 | + var card = ''; | ||
100 | + | ||
101 | + var map; | ||
102 | + var service; | ||
103 | + var _length =0; | ||
104 | + var check = 0; | ||
105 | + | ||
106 | + function initMap() { | ||
107 | + // Try HTML5 geolocation. | ||
108 | + if (navigator.geolocation) { | ||
109 | + navigator.geolocation.getCurrentPosition(function (position) { | ||
110 | + pos = { | ||
111 | + lat: position.coords.latitude, | ||
112 | + lng: position.coords.longitude | ||
113 | + }; | ||
114 | + | ||
115 | + map = new google.maps.Map(document.getElementById('map'), { | ||
116 | + center: pos, | ||
117 | + zoom: 17 | ||
118 | + }); | ||
119 | + | ||
120 | + map.setCenter(pos); | ||
121 | + | ||
122 | + service = new google.maps.places.PlacesService(map); | ||
123 | + | ||
124 | + searchPlace('bar','food'); | ||
125 | + searchPlace('cafe','food'); | ||
126 | + searchPlace('meal_delivery','food'); | ||
127 | + searchPlace('meal_takeaway','food'); | ||
128 | + searchPlace('restaurant','food'); | ||
129 | + searchPlace('bakery','food'); | ||
130 | + if (check ==1) | ||
131 | + makecard(_length); | ||
132 | + }); | ||
133 | + } | ||
134 | + } | ||
135 | + | ||
136 | + function searchPlace(str, placeType) { | ||
137 | + switch (placeType) { | ||
138 | + case 'food': | ||
139 | + service.nearbySearch({ | ||
140 | + location: pos, | ||
141 | + radius: 500, | ||
142 | + type: [str] | ||
143 | + }, callback_foods); | ||
144 | + break; | ||
145 | + case 'entertainment': | ||
146 | + service.nearbySearch({ | ||
147 | + location: pos, | ||
148 | + radius: 500, | ||
149 | + type: [str] | ||
150 | + }, callback_entertainment); | ||
151 | + break; | ||
152 | + case 'room': | ||
153 | + service.nearbySearch({ | ||
154 | + location: pos, | ||
155 | + radius: 500, | ||
156 | + type: [str] | ||
157 | + }, callback_rooms); | ||
158 | + break; | ||
159 | + default: | ||
160 | + break; | ||
161 | + } | ||
162 | + } | ||
163 | + | ||
164 | + function callback_foods(results, status) { | ||
165 | + if (status === google.maps.places.PlacesServiceStatus.OK) { | ||
166 | + for (var i = 0; i < results.length; i++) { | ||
167 | + //console.log(results[i]); | ||
168 | + result_food.push(results[i]); | ||
169 | + _length +=1; | ||
170 | + console.log(_length); | ||
171 | + | ||
172 | + if (i ==results.length-1) | ||
173 | + makecard(_length); | ||
174 | + //console.log(result_entertainment[i]); | ||
175 | + check = 1; | ||
176 | + | ||
177 | + } | ||
178 | + } | ||
179 | + } | ||
180 | + function makecard(_length) | ||
181 | + { | ||
182 | + console.log("make"); | ||
183 | + console.log(_length); | ||
184 | + for(var i =0;i<_length;i++) | ||
185 | + { | ||
186 | + | ||
187 | + entName = result_food[i].name; | ||
188 | + console.log(entName); | ||
189 | + var tmp = '<div class="col-xl-6 col-sm-6 mb-3">' + | ||
190 | + '<div class="card text-white bg-light o-hidden h-100">' + | ||
191 | + '<div class="card-body"' + ' style="height:350px; background-image:url(' + "'entertainment.jpg'" + '); background-size: 100% 100%; background-repeat: no-repeat;">' + // place photo | ||
192 | + '<div class="mr-5" id="nameDiv">'+entName+'</div>'+ // place name | ||
193 | + //'<div class="mr-5" id="typeDiv">'+entType+'</div>'+ // place type | ||
194 | + '</div>' + | ||
195 | + '</div>' + | ||
196 | + '</div>'; | ||
197 | + //card+=tmp; | ||
198 | + console.log(tmp); | ||
199 | + card +=tmp; | ||
200 | + document.getElementById("cardBody").innerHTML = card; | ||
201 | + | ||
202 | + } | ||
203 | + } | ||
204 | + | ||
205 | + | ||
206 | + </script> | ||
207 | + | ||
208 | + <div id="map"></div> | ||
209 | + <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDg4CkUEEt_96n1ork1nL5t4E_SpdKrgMI&libraries=places&callback=initMap" | ||
210 | + async defer></script> | ||
211 | + | ||
212 | + <p class="small text-center text-muted my-5"> | ||
213 | + <em>More chart examples coming soon...</em> | ||
214 | + </p> | ||
215 | + | ||
93 | </div> | 216 | </div> |
94 | <!-- /.container-fluid --> | 217 | <!-- /.container-fluid --> |
95 | 218 | ||
... | @@ -105,31 +228,11 @@ | ... | @@ -105,31 +228,11 @@ |
105 | </div> | 228 | </div> |
106 | <!-- /.content-wrapper --> | 229 | <!-- /.content-wrapper --> |
107 | 230 | ||
108 | - </div> | ||
109 | - <!-- /#wrapper --> | ||
110 | - | ||
111 | <!-- Scroll to Top Button--> | 231 | <!-- Scroll to Top Button--> |
112 | <a class="scroll-to-top rounded" href="#page-top"> | 232 | <a class="scroll-to-top rounded" href="#page-top"> |
113 | <i class="fas fa-angle-up"></i> | 233 | <i class="fas fa-angle-up"></i> |
114 | </a> | 234 | </a> |
115 | 235 | ||
116 | - <!-- Bootstrap core JavaScript--> | ||
117 | - <script src="vendor/jquery/jquery.min.js"></script> | ||
118 | - <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> | ||
119 | - | ||
120 | - <!-- Core plugin JavaScript--> | ||
121 | - <script src="vendor/jquery-easing/jquery.easing.min.js"></script> | ||
122 | - | ||
123 | - <!-- Page level plugin JavaScript--> | ||
124 | - <script src="vendor/chart.js/Chart.min.js"></script> | ||
125 | - | ||
126 | - <!-- Custom scripts for all pages--> | ||
127 | - <script src="js/sb-admin.min.js"></script> | ||
128 | - | ||
129 | - <!-- Demo scripts for this page--> | ||
130 | - <script src="js/demo/chart-area-demo.js"></script> | ||
131 | - <script src="js/demo/chart-bar-demo.js"></script> | ||
132 | - <script src="js/demo/chart-pie-demo.js"></script> | ||
133 | 236 | ||
134 | </body> | 237 | </body> |
135 | 238 | ... | ... |
... | @@ -31,7 +31,7 @@ | ... | @@ -31,7 +31,7 @@ |
31 | 31 | ||
32 | <nav class="navbar navbar-expand navbar-dark bg-dark static-top"> | 32 | <nav class="navbar navbar-expand navbar-dark bg-dark static-top"> |
33 | 33 | ||
34 | - <a class="navbar-brand mr-1" href="index.html">저기어때</a> | 34 | + <a class="navbar-brand mr-1" href="index.html">뭐라도해</a> |
35 | 35 | ||
36 | <button class="btn btn-link btn-sm text-white order-1 order-sm-0" id="sidebarToggle" href="#"> | 36 | <button class="btn btn-link btn-sm text-white order-1 order-sm-0" id="sidebarToggle" href="#"> |
37 | <i class="fas fa-bars"></i> | 37 | <i class="fas fa-bars"></i> |
... | @@ -87,72 +87,124 @@ | ... | @@ -87,72 +87,124 @@ |
87 | </ol> | 87 | </ol> |
88 | 88 | ||
89 | <!-- Icon Cards--> | 89 | <!-- Icon Cards--> |
90 | - <div class="row"> | 90 | + <div class="row" id="cardBody"> |
91 | - <div class="col-xl-3 col-sm-6 mb-3"> | 91 | + </div> |
92 | - <div class="card text-white bg-primary o-hidden h-100"> | 92 | + |
93 | - <div class="card-body"> | 93 | + <script> |
94 | - <div class="card-body-icon"> | 94 | + var result_rooms = []; |
95 | - <i class="fas fa-fw fa-comments"></i> | 95 | + </script> |
96 | - </div> | 96 | + |
97 | - <div class="mr-5">26 New Messages!</div> | 97 | + <script> |
98 | - </div> | 98 | + var entName = ''; |
99 | - <a class="card-footer text-white clearfix small z-1" href="#"> | 99 | + var entType = ''; |
100 | - <span class="float-left">View Details</span> | 100 | + var card = ''; |
101 | - <span class="float-right"> | 101 | + |
102 | - <i class="fas fa-angle-right"></i> | 102 | + var map; |
103 | - </span> | 103 | + var service; |
104 | - </a> | 104 | + var _length =0; |
105 | - </div> | 105 | + var check = 0; |
106 | - </div> | 106 | + |
107 | - <div class="col-xl-3 col-sm-6 mb-3"> | 107 | + function initMap() { |
108 | - <div class="card text-white bg-warning o-hidden h-100"> | 108 | + // Try HTML5 geolocation. |
109 | - <div class="card-body"> | 109 | + if (navigator.geolocation) { |
110 | - <div class="card-body-icon"> | 110 | + navigator.geolocation.getCurrentPosition(function (position) { |
111 | - <i class="fas fa-fw fa-list"></i> | 111 | + pos = { |
112 | - </div> | 112 | + lat: position.coords.latitude, |
113 | - <div class="mr-5">11 New Tasks!</div> | 113 | + lng: position.coords.longitude |
114 | - </div> | 114 | + }; |
115 | - <a class="card-footer text-white clearfix small z-1" href="#"> | 115 | + |
116 | - <span class="float-left">View Details</span> | 116 | + map = new google.maps.Map(document.getElementById('map'), { |
117 | - <span class="float-right"> | 117 | + center: pos, |
118 | - <i class="fas fa-angle-right"></i> | 118 | + zoom: 17 |
119 | - </span> | 119 | + }); |
120 | - </a> | 120 | + |
121 | - </div> | 121 | + map.setCenter(pos); |
122 | - </div> | 122 | + |
123 | - <div class="col-xl-3 col-sm-6 mb-3"> | 123 | + service = new google.maps.places.PlacesService(map); |
124 | - <div class="card text-white bg-success o-hidden h-100"> | 124 | + |
125 | - <div class="card-body"> | 125 | + searchPlace('lodging','room'); |
126 | - <div class="card-body-icon"> | 126 | + |
127 | - <i class="fas fa-fw fa-shopping-cart"></i> | 127 | + // if (check ==1) |
128 | - </div> | 128 | + // makecard(_length); |
129 | - <div class="mr-5">123 New Orders!</div> | 129 | + }); |
130 | - </div> | 130 | + } |
131 | - <a class="card-footer text-white clearfix small z-1" href="#"> | 131 | + } |
132 | - <span class="float-left">View Details</span> | 132 | + |
133 | - <span class="float-right"> | 133 | + function searchPlace(str, placeType) { |
134 | - <i class="fas fa-angle-right"></i> | 134 | + switch (placeType) { |
135 | - </span> | 135 | + case 'food': |
136 | - </a> | 136 | + service.nearbySearch({ |
137 | - </div> | 137 | + location: pos, |
138 | - </div> | 138 | + radius: 500, |
139 | - <div class="col-xl-3 col-sm-6 mb-3"> | 139 | + type: [str] |
140 | - <div class="card text-white bg-danger o-hidden h-100"> | 140 | + }, callback_foods); |
141 | - <div class="card-body"> | 141 | + break; |
142 | - <div class="card-body-icon"> | 142 | + case 'entertainment': |
143 | - <i class="fas fa-fw fa-life-ring"></i> | 143 | + service.nearbySearch({ |
144 | - </div> | 144 | + location: pos, |
145 | - <div class="mr-5">13 New Tickets!</div> | 145 | + radius: 500, |
146 | - </div> | 146 | + type: [str] |
147 | - <a class="card-footer text-white clearfix small z-1" href="#"> | 147 | + }, callback_entertainment); |
148 | - <span class="float-left">View Details</span> | 148 | + break; |
149 | - <span class="float-right"> | 149 | + case 'room': |
150 | - <i class="fas fa-angle-right"></i> | 150 | + service.nearbySearch({ |
151 | - </span> | 151 | + location: pos, |
152 | - </a> | 152 | + radius: 500, |
153 | - </div> | 153 | + type: [str] |
154 | - </div> | 154 | + }, callback_rooms); |
155 | - </div> | 155 | + break; |
156 | + default: | ||
157 | + break; | ||
158 | + } | ||
159 | + } | ||
160 | + | ||
161 | + function callback_rooms(results, status) { | ||
162 | + if (status === google.maps.places.PlacesServiceStatus.OK) { | ||
163 | + for (var i = 0; i < results.length; i++) { | ||
164 | + //console.log(results[i]); | ||
165 | + result_rooms.push(results[i]); | ||
166 | + _length +=1; | ||
167 | + console.log(_length); | ||
168 | + | ||
169 | + if (i ==results.length-1) | ||
170 | + makecard(_length); | ||
171 | + //console.log(result_entertainment[i]); | ||
172 | + check =1; | ||
173 | + | ||
174 | + } | ||
175 | + } | ||
176 | + } | ||
177 | + function makecard(_length) | ||
178 | + { | ||
179 | + console.log("make"); | ||
180 | + console.log(_length); | ||
181 | + for(var i =0;i<_length;i++) | ||
182 | + { | ||
183 | + | ||
184 | + entName = result_rooms[i].name; | ||
185 | + console.log(entName); | ||
186 | + var tmp = '<div class="col-xl-6 col-sm-6 mb-3">' + | ||
187 | + '<div class="card text-white bg-light o-hidden h-100">' + | ||
188 | + '<div class="card-body"' + ' style="height:350px; background-image:url(' + "'entertainment.jpg'" + '); background-size: 100% 100%; background-repeat: no-repeat;">' + // place photo | ||
189 | + '<div class="mr-5" id="nameDiv">'+entName+'</div>'+ // place name | ||
190 | + //'<div class="mr-5" id="typeDiv">'+entType+'</div>'+ // place type | ||
191 | + '</div>' + | ||
192 | + '</div>' + | ||
193 | + '</div>'; | ||
194 | + //card+=tmp; | ||
195 | + console.log(tmp); | ||
196 | + card +=tmp; | ||
197 | + document.getElementById("cardBody").innerHTML = card; | ||
198 | + | ||
199 | + } | ||
200 | + } | ||
201 | + | ||
202 | + | ||
203 | + </script> | ||
204 | + | ||
205 | + <div id="map"></div> | ||
206 | + <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDg4CkUEEt_96n1ork1nL5t4E_SpdKrgMI&libraries=places&callback=initMap" | ||
207 | + async defer></script> | ||
156 | 208 | ||
157 | <p class="small text-center text-muted my-5"> | 209 | <p class="small text-center text-muted my-5"> |
158 | <em>More chart examples coming soon...</em> | 210 | <em>More chart examples coming soon...</em> |
... | @@ -181,26 +233,6 @@ | ... | @@ -181,26 +233,6 @@ |
181 | <i class="fas fa-angle-up"></i> | 233 | <i class="fas fa-angle-up"></i> |
182 | </a> | 234 | </a> |
183 | 235 | ||
184 | - | ||
185 | - | ||
186 | - <!-- Bootstrap core JavaScript--> | ||
187 | - <script src="vendor/jquery/jquery.min.js"></script> | ||
188 | - <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> | ||
189 | - | ||
190 | - <!-- Core plugin JavaScript--> | ||
191 | - <script src="vendor/jquery-easing/jquery.easing.min.js"></script> | ||
192 | - | ||
193 | - <!-- Page level plugin JavaScript--> | ||
194 | - <script src="vendor/chart.js/Chart.min.js"></script> | ||
195 | - | ||
196 | - <!-- Custom scripts for all pages--> | ||
197 | - <script src="js/sb-admin.min.js"></script> | ||
198 | - | ||
199 | - <!-- Demo scripts for this page--> | ||
200 | - <script src="js/demo/chart-area-demo.js"></script> | ||
201 | - <script src="js/demo/chart-bar-demo.js"></script> | ||
202 | - <script src="js/demo/chart-pie-demo.js"></script> | ||
203 | - | ||
204 | </body> | 236 | </body> |
205 | 237 | ||
206 | </html> | 238 | </html> | ... | ... |
... | @@ -9,7 +9,7 @@ | ... | @@ -9,7 +9,7 @@ |
9 | <meta name="description" content=""> | 9 | <meta name="description" content=""> |
10 | <meta name="author" content=""> | 10 | <meta name="author" content=""> |
11 | 11 | ||
12 | - <title>저기어때</title> | 12 | + <title>뭐라도해</title> |
13 | 13 | ||
14 | <style> | 14 | <style> |
15 | /* Always set the map height explicitly to define the size of the div | 15 | /* Always set the map height explicitly to define the size of the div |
... | @@ -43,7 +43,7 @@ | ... | @@ -43,7 +43,7 @@ |
43 | 43 | ||
44 | <nav class="navbar navbar-expand navbar-dark bg-dark static-top"> | 44 | <nav class="navbar navbar-expand navbar-dark bg-dark static-top"> |
45 | 45 | ||
46 | - <a class="navbar-brand mr-1" href="index.html">저기어때</a> | 46 | + <a class="navbar-brand mr-1" href="index.html">뭐라도해</a> |
47 | 47 | ||
48 | <button class="btn btn-link btn-sm text-white order-1 order-sm-0" id="sidebarToggle" href="#"> | 48 | <button class="btn btn-link btn-sm text-white order-1 order-sm-0" id="sidebarToggle" href="#"> |
49 | <i class="fas fa-bars"></i> | 49 | <i class="fas fa-bars"></i> |
... | @@ -93,7 +93,7 @@ | ... | @@ -93,7 +93,7 @@ |
93 | var result_food = [] | 93 | var result_food = [] |
94 | var result_room = [] | 94 | var result_room = [] |
95 | </script> | 95 | </script> |
96 | - <script type="text/javascript" src="/js/getPlaceList.js"></script> | 96 | + <script type="text/javascript" src="./js/getPlaceList.js"></script> |
97 | <div id="map"></div> | 97 | <div id="map"></div> |
98 | <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDg4CkUEEt_96n1ork1nL5t4E_SpdKrgMI&libraries=places&callback=initMap" async defer></script> | 98 | <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDg4CkUEEt_96n1ork1nL5t4E_SpdKrgMI&libraries=places&callback=initMap" async defer></script> |
99 | 99 | ||
... | @@ -133,24 +133,6 @@ | ... | @@ -133,24 +133,6 @@ |
133 | </div> | 133 | </div> |
134 | </div> | 134 | </div> |
135 | 135 | ||
136 | - <!-- Bootstrap core JavaScript--> | ||
137 | - <script src="vendor/jquery/jquery.min.js"></script> | ||
138 | - <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> | ||
139 | - | ||
140 | - <!-- Core plugin JavaScript--> | ||
141 | - <script src="vendor/jquery-easing/jquery.easing.min.js"></script> | ||
142 | - | ||
143 | - <!-- Page level plugin JavaScript--> | ||
144 | - <script src="vendor/chart.js/Chart.min.js"></script> | ||
145 | - <script src="vendor/datatables/jquery.dataTables.js"></script> | ||
146 | - <script src="vendor/datatables/dataTables.bootstrap4.js"></script> | ||
147 | - | ||
148 | - <!-- Custom scripts for all pages--> | ||
149 | - <script src="js/sb-admin.min.js"></script> | ||
150 | - | ||
151 | - <!-- Demo scripts for this page--> | ||
152 | - <script src="js/demo/datatables-demo.js"></script> | ||
153 | - <script src="js/demo/chart-area-demo.js"></script> | ||
154 | 136 | ||
155 | </body> | 137 | </body> |
156 | 138 | ... | ... |
public/js/getPlaceList.js
0 → 100644
1 | +var pos; | ||
2 | +var map; | ||
3 | +var infowindow; | ||
4 | +var service; | ||
5 | + | ||
6 | +function initMap() { | ||
7 | + | ||
8 | + map = new google.maps.Map(document.getElementById('map'), { | ||
9 | + center: {lat: -34.397, lng: 150.644}, | ||
10 | + zoom: 17 | ||
11 | + }); | ||
12 | + infowindow = new google.maps.InfoWindow(); | ||
13 | + | ||
14 | + // Try HTML5 geolocation. | ||
15 | + if (navigator.geolocation) { | ||
16 | + navigator.geolocation.getCurrentPosition(function(position) { | ||
17 | + pos = { | ||
18 | + lat: position.coords.latitude, | ||
19 | + lng: position.coords.longitude | ||
20 | + }; | ||
21 | + | ||
22 | + var map = new google.maps.Map(document.getElementById('map'), { | ||
23 | + center: pos, | ||
24 | + zoom: 17 | ||
25 | + }); | ||
26 | + infowindow = new google.maps.InfoWindow(); | ||
27 | + | ||
28 | + map.setCenter(pos); | ||
29 | + | ||
30 | + service = new google.maps.places.PlacesService(map); | ||
31 | + | ||
32 | + searchPlace('bar','food'); | ||
33 | + searchPlace('cafe','food'); | ||
34 | + searchPlace('meal_delivery','food'); | ||
35 | + searchPlace('meal_takeaway','food'); | ||
36 | + searchPlace('restaurant','food'); | ||
37 | + searchPlace('bakery','food'); | ||
38 | + | ||
39 | + searchPlace('department_store','entertainment'); | ||
40 | + searchPlace('movie_theater','entertainment'); | ||
41 | + searchPlace('museum','entertainment'); | ||
42 | + searchPlace('night_club','entertainment'); | ||
43 | + searchPlace('shopping_mall','entertainment'); | ||
44 | + searchPlace('zoo','entertainment'); | ||
45 | + | ||
46 | + searchPlace('lodging','room'); | ||
47 | + | ||
48 | + }); | ||
49 | + } | ||
50 | +} | ||
51 | + | ||
52 | + | ||
53 | +function searchPlace(str, placeType) { | ||
54 | + switch(placeType) { | ||
55 | + case 'food': | ||
56 | + service.nearbySearch({ | ||
57 | + location: pos, | ||
58 | + radius: 500, | ||
59 | + type: [str] | ||
60 | + }, callback_foods); | ||
61 | + break; | ||
62 | + case 'entertainment': | ||
63 | + service.nearbySearch({ | ||
64 | + location: pos, | ||
65 | + radius: 500, | ||
66 | + type: [str] | ||
67 | + }, callback_entertainment); | ||
68 | + break; | ||
69 | + case 'room': | ||
70 | + service.nearbySearch({ | ||
71 | + location: pos, | ||
72 | + radius: 500, | ||
73 | + type: [str] | ||
74 | + }, callback_rooms); | ||
75 | + break; | ||
76 | + default: | ||
77 | + break; | ||
78 | + } | ||
79 | +} | ||
80 | + | ||
81 | + | ||
82 | +function callback_foods(results, status) { | ||
83 | + if (status === google.maps.places.PlacesServiceStatus.OK) { | ||
84 | + for (var i = 0; i < results.length; i++) { | ||
85 | + createMarker_foods(results[i]); | ||
86 | + } | ||
87 | + } | ||
88 | +} | ||
89 | + | ||
90 | +function callback_entertainment(results, status) { | ||
91 | + if (status === google.maps.places.PlacesServiceStatus.OK) { | ||
92 | + for (var i = 0; i < results.length; i++) { | ||
93 | + createMarker_entertainment(results[i]); | ||
94 | + } | ||
95 | + } | ||
96 | +} | ||
97 | + | ||
98 | +function callback_rooms(results, status) { | ||
99 | + if (status === google.maps.places.PlacesServiceStatus.OK) { | ||
100 | + for (var i = 0; i < results.length; i++) { | ||
101 | + createMarker_rooms(results[i]); | ||
102 | + } | ||
103 | + } | ||
104 | +} | ||
105 | + | ||
106 | +function createMarker_foods(place) { | ||
107 | + var marker = new google.maps.Marker({ | ||
108 | + map: map, | ||
109 | + position: place.geometry.location, | ||
110 | + icon : "./icons/restaurant-15.svg", | ||
111 | + //fillcolor : "#FF0000" | ||
112 | + }); | ||
113 | + | ||
114 | + google.maps.event.addListener(marker, 'click', function() { | ||
115 | + infowindow.setContent(place.name); | ||
116 | + infowindow.open(map, this); | ||
117 | + }); | ||
118 | +} | ||
119 | + | ||
120 | +function createMarker_entertainment(place) { | ||
121 | + var placeLoc = place.geometry.location; | ||
122 | + var marker = new google.maps.Marker({ | ||
123 | + map: map, | ||
124 | + position: place.geometry.location, | ||
125 | + icon : "./icons/gaming-15.svg" | ||
126 | + }); | ||
127 | + | ||
128 | + google.maps.event.addListener(marker, 'click', function() { | ||
129 | + infowindow.setContent(place.name); | ||
130 | + infowindow.open(map, this); | ||
131 | + }); | ||
132 | +} | ||
133 | + | ||
134 | +function createMarker_rooms(place) { | ||
135 | + var placeLoc = place.geometry.location; | ||
136 | + var marker = new google.maps.Marker({ | ||
137 | + map: map, | ||
138 | + position: place.geometry.location, | ||
139 | + icon : "./icons/lodging-15.svg" | ||
140 | + }); | ||
141 | + | ||
142 | + google.maps.event.addListener(marker, 'click', function() { | ||
143 | + infowindow.setContent(place.name); | ||
144 | + infowindow.open(map, this); | ||
145 | + }); | ||
146 | +} |
-
Please register or login to post a comment