1$(function(){ 2 3 var mapStyleList = ['streets-v11','satellite-streets-v11','dark-v10']; 4 5 var mapStyle = getURLParameter('t')?(mapStyleList.indexOf(getURLParameter('t')) != -1?getURLParameter('t'):"streets-v11"):'satellite-streets-v11'; 6 7 8 9 if(loadingMaps){ 10 11 intoMap(); 12 13 } 14 15 16 17 function intoMap(){ 18 19 mapboxgl.accessToken = mapkey; 20 21 map = new mapboxgl.Map({ 22 23 container: 'maps', 24 25 style: 'mapbox://styles/mapbox/'+ mapStyle, 26 27 center: [-79.4512, 43.6568], 28 29 zoom: 6.9, 30 31 preserveDrawingBuffer: true 32 33 }); 34 35 36 37 if(navActive == '3dmaps'){ 38 39 map.setZoom(15) 40 41 map.on('load', function () { 42 43 // Insert the layer beneath any symbol layer. 44 45 var layers = map.getStyle().layers; 46 47 48 49 var labelLayerId; 50 51 for (var i = 0; i < layers.length; i++) { 52 53 if (layers[i].type === 'symbol' && layers[i].layout['text-field']) { 54 55 labelLayerId = layers[i].id; 56 57 break; 58 59 } 60 61 } 62 63 map.addLayer( 64 65 { 66 67 'id': '3d-buildings', 68 69 'source': 'composite', 70 71 'source-layer': 'building', 72 73 'filter': ['==', 'extrude', 'true'], 74 75 'type': 'fill-extrusion', 76 77 'minzoom': 12, 78 79 'paint': { 80 81 'fill-extrusion-color': '#aaa', 82 83 84 85 'fill-extrusion-height': [ 86 87 'interpolate', 88 89 ['linear'], 90 91 ['zoom'], 92 93 15, 94 95 0, 96 97 15.5, 98 99 ['get', 'height'] 100 101 ], 102 103 'fill-extrusion-base': [ 104 105 'interpolate', 106 107 ['linear'], 108 109 ['zoom'], 110 111 15, 112 113 0, 114 115 15.5, 116 117 ['get', 'min_height'] 118 119 ], 120 121 'fill-extrusion-opacity': 0.8 122 123 } 124 125 }, 126 127 labelLayerId 128 129 130 131 ); 132 133 map.setPitch(45); 134 135 }); 136 137 } 138 139 } 140 141 142 143 144 145 $("#pac-input").on('focus',function(){ 146 147 $(".close_ipt").show(); 148 149 }) 150 151 152 153 $("#pac-input").on('blur',function(){ 154 155 setTimeout(function(){ 156 157 $(".close_ipt").hide(); 158 159 },200) 160 161 }) 162 163 $(".close_ipt").on('click',function(){ 164 165 $("#pac-input").val(''); 166 167 setTimeout(function(){ 168 169 $(".close_ipt").hide(); 170 171 // $("#search-form").attr('href','#'); 172 173 },200) 174 175 }) 176 177 178 179 $("#pac-input").on("keyup",function(e){ 180 181 if($(this).val() == ''){ 182 183 $(".suggestionsList,.suggestions").hide(); 184 185 // $("#search-form").attr('href','#'); 186 187 } 188 189 throttle(suggWorker,window, 500); 190 191 }) 192 193 194 195 function suggWorker(){ 196 197 var input_address= $("#pac-input").val(); 198 199 if(input_address == ''){ 200 201 $(".suggestionsList,.suggestions").hide(); 202 203 return; 204 205 } 206 207 getNominatimSuggestion(input_address,function(list){ 208 209 var dname = $("#pac-input").val(); 210 211 if(list.length > 0){ 212 213 var sugglist=$(".suggestions li"); 214 215 if($("#pac-input").val()!=input_address){ 216 217 return; 218 219 } 220 221 if(list.length>0){ 222 223 destLoc=list[0]; 224 225 $(".suggestionsList,.suggestions").show(); 226 227 }else{ 228 229 destLoc=null; 230 231 } 232 233 for(var i=0;i < sugglist.length;i++){ 234 235 if(i < list.length){ 236 237 $(sugglist[i]).show(); 238 239 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion").attr("data_lat",list[i].lat); 240 241 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion").attr("data_lon",list[i].lon); 242 243 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion-title").text(list[i].namedetails?list[i].namedetails.name:list[i].name); 244 245 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion-address").text(list[i].display_name); 246 247 }else{ 248 249 $(sugglist[i]).hide(); 250 251 } 252 253 } 254 255 }else{ 256 257 getNominatimAgain($("#pac-input").val(),function(list){ 258 259 if(list.features.length > 0){ 260 261 lat = list.features[0].center[1]; 262 263 lon = list.features[0].center[0]; 264 265 var sugglist=$(".suggestions li"); 266 267 var list = list.features; 268 269 for(var i=0;i < sugglist.length;i++){ 270 271 if(i < list.length){ 272 273 $(sugglist[i]).show(); 274 275 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion").attr("data_lat",lat); 276 277 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion").attr("data_lon",lon); 278 279 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion-title").text(list[i].text); 280 281 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion-address").text(list[i].place_name); 282 283 }else{ 284 285 $(sugglist[i]).hide(); 286 287 } 288 289 } 290 291 }else{ 292 293 var sugglist=$(".suggestions li"); 294 295 for(var i=0;i < sugglist.length;i++){ 296 297 $(sugglist[i]).show(); 298 299 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion").attr("data_lat",''); 300 301 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion").attr("data_lon",''); 302 303 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion-title").text(''); 304 305 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion-address").text(''); 306 307 } 308 309 $(sugglist[0]).find(".mapboxgl-ctrl-geocoder--suggestion-title").text(dname+' no se puede encontrar'); 310 311 $(sugglist[0]).show(); 312 313 $(".suggestionsList,.suggestions").show(); 314 315 } 316 317 }) 318 319 } 320 321 }) 322 323 } 324 325 326 327 $(".suggestions li").click(function(){ 328 329 var text = $(this).find(".mapboxgl-ctrl-geocoder--suggestion-address").text(); 330 331 $("#pac-input").val(text); 332 333 $("#pac-input").focus(); 334 335 $(".suggestions").hide(); 336 337 338 339 var lat = $(this).find(".mapboxgl-ctrl-geocoder--suggestion").attr('data_lat'); 340 341 var lon = $(this).find(".mapboxgl-ctrl-geocoder--suggestion").attr('data_lon'); 342 343 344 345 if(lat != '' && lon != '' && text != ''){ 346 347 var coordinate = [lat,lon]; 348 349 window.localStorage.setItem('coordinate',JSON.stringify(coordinate)); 350 351 window.localStorage.setItem('coordinateText',text); 352 353 locationUrl(text); 354 355 } 356 357 }) 358 359 360 361 $("#search-form").on('click',function(){ 362 363 var val = $("#pac-input").val(); 364 365 if(val != ''){ 366 367 zdLocation(val); 368 369 } 370 371 }) 372 373 374 375 function zdLocation(val){ 376 377 getNominatimSuggestion(val,function(list){ 378 379 if(list.length > 0){ 380 381 lat = list[0].lat; 382 383 lon = list[0].lon; 384 385 var coordinate = [lat,lon]; 386 387 window.localStorage.setItem('coordinate',JSON.stringify(coordinate)); 388 389 window.localStorage.setItem('coordinateText',val); 390 391 locationUrl(val); 392 393 }else{ 394 395 getNominatimAgain(val,function(list){ 396 397 if(list.features.length > 0){ 398 399 lat = list.features[0].center[1]; 400 401 lon = list.features[0].center[0]; 402 403 var coordinate = [lat,lon]; 404 405 window.localStorage.setItem('coordinate',JSON.stringify(coordinate)); 406 407 window.localStorage.setItem('coordinateText',val); 408 409 locationUrl(val); 410 411 }else{ 412 413 var sugglist=$(".suggestions li"); 414 415 for(var i=0;i < sugglist.length;i++){ 416 417 $(sugglist[i]).show(); 418 419 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion").attr("data_lat",''); 420 421 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion").attr("data_lon",''); 422 423 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion-title").text(''); 424 425 $(sugglist[i]).find(".mapboxgl-ctrl-geocoder--suggestion-address").text(''); 426 427 } 428 429 $(sugglist[0]).find(".mapboxgl-ctrl-geocoder--suggestion-title").text(val+' no se puede encontrar'); 430 431 $(sugglist[0]).show(); 432 433 $(".suggestionsList,.suggestions").show(); 434 435 } 436 437 }) 438 439 } 440 441 442 443 }) 444 445 446 447 } 448 449 450 451 function locationUrl(val){ 452 453 var url = "search?q="+val; 454 455 if(navActive == '3dmaps'){ 456 457 url = "search?q="+val+'&sl=3d'; 458 459 } 460 461 if(t != ''){ 462 463 url = url + '&t='+t; 464 465 } 466 467 // $("#search-form").attr('href',url); 468 469 location = url; 470 471 } 472 473 474 475})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.