김다솜

add list

...@@ -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>
...@@ -75,61 +75,164 @@ ...@@ -75,61 +75,164 @@
75 </ul> 75 </ul>
76 <div id="content-wrapper"> 76 <div id="content-wrapper">
77 77
78 - <div class="container-fluid"> 78 + <div class="container-fluid">
79 79
80 - <!-- Breadcrumbs--> 80 + <!-- Breadcrumbs-->
81 - <ol class="breadcrumb"> 81 + <ol class="breadcrumb">
82 - <li class="breadcrumb-item"> 82 + <li class="breadcrumb-item">
83 - <a href="#">Foods</a> 83 + <a href="#">Foods</a>
84 - </li> 84 + </li>
85 85
86 - </ol> 86 + </ol>
87 -
88 - <!-- Icon Cards-->
89 - <div class="row" id="body">
90 - <script src="js/showFood.js"></script>
91 - </div>
92 87
88 + <!-- Icon Cards-->
89 + <div class="row" id="cardBody">
93 </div> 90 </div>
94 - <!-- /.container-fluid --> 91 +
95 - 92 + <script>
96 - <!-- Sticky Footer --> 93 + var result_food = [];
97 - <footer class="sticky-footer"> 94 + </script>
98 - <div class="container my-auto"> 95 +
99 - <div class="copyright text-center my-auto"> 96 + <script>
100 - <span>Copyright © Your Website 2018</span> 97 + var entName = '';
101 - </div> 98 + var entType = '';
102 - </div> 99 + var card = '';
103 - </footer> 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>
104 215
105 </div> 216 </div>
106 - <!-- /.content-wrapper --> 217 + <!-- /.container-fluid -->
218 +
219 + <!-- Sticky Footer -->
220 + <footer class="sticky-footer">
221 + <div class="container my-auto">
222 + <div class="copyright text-center my-auto">
223 + <span>Copyright © Your Website 2018</span>
224 + </div>
225 + </div>
226 + </footer>
107 227
108 </div> 228 </div>
109 - <!-- /#wrapper --> 229 + <!-- /.content-wrapper -->
110 230
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>
...@@ -76,131 +76,163 @@ ...@@ -76,131 +76,163 @@
76 </ul> 76 </ul>
77 <div id="content-wrapper"> 77 <div id="content-wrapper">
78 78
79 - <div class="container-fluid"> 79 + <div class="container-fluid">
80 - 80 +
81 - <!-- Breadcrumbs--> 81 + <!-- Breadcrumbs-->
82 - <ol class="breadcrumb"> 82 + <ol class="breadcrumb">
83 - <li class="breadcrumb-item"> 83 + <li class="breadcrumb-item">
84 - <a href="#">Rooms</a> 84 + <a href="#">Rooms</a>
85 - </li> 85 + </li>
86 -
87 - </ol>
88 -
89 - <!-- Icon Cards-->
90 - <div class="row">
91 - <div class="col-xl-3 col-sm-6 mb-3">
92 - <div class="card text-white bg-primary o-hidden h-100">
93 - <div class="card-body">
94 - <div class="card-body-icon">
95 - <i class="fas fa-fw fa-comments"></i>
96 - </div>
97 - <div class="mr-5">26 New Messages!</div>
98 - </div>
99 - <a class="card-footer text-white clearfix small z-1" href="#">
100 - <span class="float-left">View Details</span>
101 - <span class="float-right">
102 - <i class="fas fa-angle-right"></i>
103 - </span>
104 - </a>
105 - </div>
106 - </div>
107 - <div class="col-xl-3 col-sm-6 mb-3">
108 - <div class="card text-white bg-warning o-hidden h-100">
109 - <div class="card-body">
110 - <div class="card-body-icon">
111 - <i class="fas fa-fw fa-list"></i>
112 - </div>
113 - <div class="mr-5">11 New Tasks!</div>
114 - </div>
115 - <a class="card-footer text-white clearfix small z-1" href="#">
116 - <span class="float-left">View Details</span>
117 - <span class="float-right">
118 - <i class="fas fa-angle-right"></i>
119 - </span>
120 - </a>
121 - </div>
122 - </div>
123 - <div class="col-xl-3 col-sm-6 mb-3">
124 - <div class="card text-white bg-success o-hidden h-100">
125 - <div class="card-body">
126 - <div class="card-body-icon">
127 - <i class="fas fa-fw fa-shopping-cart"></i>
128 - </div>
129 - <div class="mr-5">123 New Orders!</div>
130 - </div>
131 - <a class="card-footer text-white clearfix small z-1" href="#">
132 - <span class="float-left">View Details</span>
133 - <span class="float-right">
134 - <i class="fas fa-angle-right"></i>
135 - </span>
136 - </a>
137 - </div>
138 - </div>
139 - <div class="col-xl-3 col-sm-6 mb-3">
140 - <div class="card text-white bg-danger o-hidden h-100">
141 - <div class="card-body">
142 - <div class="card-body-icon">
143 - <i class="fas fa-fw fa-life-ring"></i>
144 - </div>
145 - <div class="mr-5">13 New Tickets!</div>
146 - </div>
147 - <a class="card-footer text-white clearfix small z-1" href="#">
148 - <span class="float-left">View Details</span>
149 - <span class="float-right">
150 - <i class="fas fa-angle-right"></i>
151 - </span>
152 - </a>
153 - </div>
154 - </div>
155 - </div>
156 86
157 - <p class="small text-center text-muted my-5"> 87 + </ol>
158 - <em>More chart examples coming soon...</em>
159 - </p>
160 88
89 + <!-- Icon Cards-->
90 + <div class="row" id="cardBody">
161 </div> 91 </div>
162 - <!-- /.container-fluid --> 92 +
163 - 93 + <script>
164 - <!-- Sticky Footer --> 94 + var result_rooms = [];
165 - <footer class="sticky-footer"> 95 + </script>
166 - <div class="container my-auto"> 96 +
167 - <div class="copyright text-center my-auto"> 97 + <script>
168 - <span>Copyright © Your Website 2018</span> 98 + var entName = '';
169 - </div> 99 + var entType = '';
170 - </div> 100 + var card = '';
171 - </footer> 101 +
102 + var map;
103 + var service;
104 + var _length =0;
105 + var check = 0;
106 +
107 + function initMap() {
108 + // Try HTML5 geolocation.
109 + if (navigator.geolocation) {
110 + navigator.geolocation.getCurrentPosition(function (position) {
111 + pos = {
112 + lat: position.coords.latitude,
113 + lng: position.coords.longitude
114 + };
115 +
116 + map = new google.maps.Map(document.getElementById('map'), {
117 + center: pos,
118 + zoom: 17
119 + });
120 +
121 + map.setCenter(pos);
122 +
123 + service = new google.maps.places.PlacesService(map);
124 +
125 + searchPlace('lodging','room');
126 +
127 + // if (check ==1)
128 + // makecard(_length);
129 + });
130 + }
131 + }
132 +
133 + function searchPlace(str, placeType) {
134 + switch (placeType) {
135 + case 'food':
136 + service.nearbySearch({
137 + location: pos,
138 + radius: 500,
139 + type: [str]
140 + }, callback_foods);
141 + break;
142 + case 'entertainment':
143 + service.nearbySearch({
144 + location: pos,
145 + radius: 500,
146 + type: [str]
147 + }, callback_entertainment);
148 + break;
149 + case 'room':
150 + service.nearbySearch({
151 + location: pos,
152 + radius: 500,
153 + type: [str]
154 + }, callback_rooms);
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>
208 +
209 + <p class="small text-center text-muted my-5">
210 + <em>More chart examples coming soon...</em>
211 + </p>
172 212
173 </div> 213 </div>
174 - <!-- /.content-wrapper --> 214 + <!-- /.container-fluid -->
215 +
216 + <!-- Sticky Footer -->
217 + <footer class="sticky-footer">
218 + <div class="container my-auto">
219 + <div class="copyright text-center my-auto">
220 + <span>Copyright © Your Website 2018</span>
221 + </div>
222 + </div>
223 + </footer>
175 224
176 </div> 225 </div>
177 - <!-- /#wrapper --> 226 + <!-- /.content-wrapper -->
227 +
228 + </div>
229 + <!-- /#wrapper -->
178 230
179 <!-- Scroll to Top Button--> 231 <!-- Scroll to Top Button-->
180 <a class="scroll-to-top rounded" href="#page-top"> 232 <a class="scroll-to-top rounded" href="#page-top">
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
......
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 +}