Showing
3 changed files
with
70 additions
and
29 deletions
... | @@ -90,17 +90,19 @@ | ... | @@ -90,17 +90,19 @@ |
90 | <div class="row" id="cardBody"> | 90 | <div class="row" id="cardBody"> |
91 | </div> | 91 | </div> |
92 | 92 | ||
93 | - <!-- <script> | ||
94 | - var result_entertainment = [] | ||
95 | - </script> --> | ||
96 | <script> | 93 | <script> |
97 | - var result_entertainment = [] | 94 | + var result_entertainment = []; |
95 | + </script> | ||
96 | + | ||
97 | + <script> | ||
98 | var entName = ''; | 98 | var entName = ''; |
99 | var entType = ''; | 99 | var entType = ''; |
100 | var card = ''; | 100 | var card = ''; |
101 | 101 | ||
102 | var map; | 102 | var map; |
103 | var service; | 103 | var service; |
104 | + var _length =0; | ||
105 | + var _temp = 0; | ||
104 | 106 | ||
105 | function initMap() { | 107 | function initMap() { |
106 | // Try HTML5 geolocation. | 108 | // Try HTML5 geolocation. |
... | @@ -126,32 +128,34 @@ | ... | @@ -126,32 +128,34 @@ |
126 | searchPlace('night_club', 'entertainment'); | 128 | searchPlace('night_club', 'entertainment'); |
127 | searchPlace('shopping_mall', 'entertainment'); | 129 | searchPlace('shopping_mall', 'entertainment'); |
128 | searchPlace('zoo', 'entertainment'); | 130 | searchPlace('zoo', 'entertainment'); |
131 | + if (_temp ==5) | ||
132 | + makecard(_length); | ||
129 | }); | 133 | }); |
130 | } | 134 | } |
131 | } | 135 | } |
132 | 136 | ||
133 | - async function searchPlace(str, placeType) { | 137 | + function searchPlace(str, placeType) { |
134 | switch (placeType) { | 138 | switch (placeType) { |
135 | case 'food': | 139 | case 'food': |
136 | service.nearbySearch({ | 140 | service.nearbySearch({ |
137 | location: pos, | 141 | location: pos, |
138 | radius: 500, | 142 | radius: 500, |
139 | type: [str] | 143 | type: [str] |
140 | - }, await callback_foods); | 144 | + }, callback_foods); |
141 | break; | 145 | break; |
142 | case 'entertainment': | 146 | case 'entertainment': |
143 | service.nearbySearch({ | 147 | service.nearbySearch({ |
144 | location: pos, | 148 | location: pos, |
145 | radius: 500, | 149 | radius: 500, |
146 | type: [str] | 150 | type: [str] |
147 | - }, await callback_entertainment); | 151 | + }, callback_entertainment); |
148 | break; | 152 | break; |
149 | case 'room': | 153 | case 'room': |
150 | service.nearbySearch({ | 154 | service.nearbySearch({ |
151 | location: pos, | 155 | location: pos, |
152 | radius: 500, | 156 | radius: 500, |
153 | type: [str] | 157 | type: [str] |
154 | - }, await callback_rooms); | 158 | + }, callback_rooms); |
155 | break; | 159 | break; |
156 | default: | 160 | default: |
157 | break; | 161 | break; |
... | @@ -161,12 +165,41 @@ | ... | @@ -161,12 +165,41 @@ |
161 | function callback_entertainment(results, status) { | 165 | function callback_entertainment(results, status) { |
162 | if (status === google.maps.places.PlacesServiceStatus.OK) { | 166 | if (status === google.maps.places.PlacesServiceStatus.OK) { |
163 | for (var i = 0; i < results.length; i++) { | 167 | for (var i = 0; i < results.length; i++) { |
164 | - console.log(results[i]); | 168 | + //console.log(results[i]); |
165 | - result_entertainment.push(results[i]) | 169 | + result_entertainment.push(results[i]); |
170 | + _length +=1; | ||
171 | + console.log(_length); | ||
172 | + if (_length ==2) | ||
173 | + makecard(_length); | ||
174 | + //console.log(result_entertainment[i]); | ||
175 | + _temp = 5; | ||
176 | + | ||
166 | } | 177 | } |
167 | } | 178 | } |
168 | } | 179 | } |
180 | + function makecard(_length) | ||
181 | + { | ||
182 | + console.log("make") | ||
183 | + for(var i =0;i<_length;i++) | ||
184 | + { | ||
185 | + //console.log(result_entertainment[i]); | ||
186 | + | ||
187 | + entName = result_entertainment[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 | + document.getElementById("cardBody").innerHTML = tmp; | ||
169 | 200 | ||
201 | + } | ||
202 | + } | ||
170 | // const id = result['id']; | 203 | // const id = result['id']; |
171 | // const place_id =result['place_id']; | 204 | // const place_id =result['place_id']; |
172 | // const name = result['name']; | 205 | // const name = result['name']; |
... | @@ -178,22 +211,28 @@ | ... | @@ -178,22 +211,28 @@ |
178 | // const lng = result.geometry.viewport.ea.j; | 211 | // const lng = result.geometry.viewport.ea.j; |
179 | // const lat =result.geometry.viewport.la.j; | 212 | // const lat =result.geometry.viewport.la.j; |
180 | 213 | ||
181 | - setTimeout(function(){ | ||
182 | - for (var i = 0; i < result_entertainment.length; i++) { | ||
183 | - entName = result_entertainment[i][name]; | ||
184 | - entType = "result_entertainment[i][types];" | ||
185 | 214 | ||
186 | - var tmp = '<div class="col-xl-6 col-sm-6 mb-3">' + | 215 | + // for (var i = 0; i <result_entertainment.length; i++) { |
187 | - '<div class="card text-white bg-light o-hidden h-100">' + | 216 | + // console.log("AAA"); |
188 | - '<div class="card-body"' + ' style="height:350px; background-image:url(' + "'entertainment.jpg'" + '); background-size: 100% 100%; background-repeat: no-repeat;">' + // place photo | 217 | + // entName = result_entertainment[i][name]; |
189 | - '<div class="mr-5" id="nameDiv">'+entName+'</div>'+ // place name | 218 | + // entType = result_entertainment[i][types]; |
190 | - '<div class="mr-5" id="typeDiv">'+entType+'</div>'+ // place type | 219 | + // console.log(result_entertainment[i]); |
191 | - '</div>' + | 220 | + // console.log(result_entertainment[i]); |
192 | - '</div>' + | 221 | + // // if(result_entertainment[i][photo]==undefined){ |
193 | - '</div>'; | 222 | + // // entPhoto = "noimage.png"; |
194 | - card+=tmp; | 223 | + // // } |
195 | - } | 224 | + // // else{ |
196 | - }, 5000); | 225 | + // // entPhoto = entList[i][photo]; |
226 | + // var tmp = '<div class="col-xl-6 col-sm-6 mb-3">' + | ||
227 | + // '<div class="card text-white bg-light o-hidden h-100">' + | ||
228 | + // '<div class="card-body"' + ' style="height:350px; background-image:url(' + "'2.jpg'" + '); background-size: 100% 100%; background-repeat: no-repeat;">' + // place photo | ||
229 | + // '<div class="mr-5" id="nameDiv">'+entName+'</div>'+ // place name | ||
230 | + // '<div class="mr-5" id="typeDiv">'+entType+'</div>'+ // place type | ||
231 | + // '</div>' + | ||
232 | + // '</div>' + | ||
233 | + // '</div>'; | ||
234 | + // card+=tmp; | ||
235 | + // } | ||
197 | 236 | ||
198 | document.getElementById("cardBody").innerHTML = card; | 237 | document.getElementById("cardBody").innerHTML = card; |
199 | 238 | ||
... | @@ -203,6 +242,10 @@ | ... | @@ -203,6 +242,10 @@ |
203 | <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDg4CkUEEt_96n1ork1nL5t4E_SpdKrgMI&libraries=places&callback=initMap" | 242 | <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDg4CkUEEt_96n1ork1nL5t4E_SpdKrgMI&libraries=places&callback=initMap" |
204 | async defer></script> | 243 | async defer></script> |
205 | 244 | ||
245 | + <p class="small text-center text-muted my-5"> | ||
246 | + <em>More chart examples coming soon...</em> | ||
247 | + </p> | ||
248 | + | ||
206 | </div> | 249 | </div> |
207 | <!-- /.container-fluid --> | 250 | <!-- /.container-fluid --> |
208 | 251 | ... | ... |
... | @@ -23,6 +23,8 @@ | ... | @@ -23,6 +23,8 @@ |
23 | <!-- Custom styles for this template--> | 23 | <!-- Custom styles for this template--> |
24 | <link href="css/sb-admin.css" rel="stylesheet"> | 24 | <link href="css/sb-admin.css" rel="stylesheet"> |
25 | 25 | ||
26 | + <link href="https://fonts.googleapis.com/css?family=Do+Hyeon&subset=korean" rel="stylesheet"> | ||
27 | + | ||
26 | </head> | 28 | </head> |
27 | 29 | ||
28 | <body id="page-top"> | 30 | <body id="page-top"> |
... | @@ -88,10 +90,6 @@ | ... | @@ -88,10 +90,6 @@ |
88 | <script src="js/showFood.js"></script> | 90 | <script src="js/showFood.js"></script> |
89 | </div> | 91 | </div> |
90 | 92 | ||
91 | - <p class="small text-center text-muted my-5"> | ||
92 | - <em>More chart examples coming soon...</em> | ||
93 | - </p> | ||
94 | - | ||
95 | </div> | 93 | </div> |
96 | <!-- /.container-fluid --> | 94 | <!-- /.container-fluid --> |
97 | 95 | ... | ... |
public/foods.png
0 → 100644
219 KB
-
Please register or login to post a comment