1var geocoder; 2var map; 3var isnoempty = false; 4var defZoom = 11; 5var defLat = 59.9436675; 6var defLng = 30.2828307; 7var markers = new Array(); 8var infowindow = null; 9var data = new Array(); 10var icon = { 11 name: 'luxapart', 12 icon: 'images/pin.png' 13}; 14var mapStyle = [ 15 { 16 "featureType": "landscape", 17 "elementType": "all", 18 "stylers": [ 19 { 20 "saturation": "-100" 21 } 22 ] 23 }, 24 { 25 "featureType": "poi", 26 "elementType": "all", 27 "stylers": [ 28 { 29 "saturation": "-76" 30 }, 31 { 32 "hue": "#ffde00" 33 } 34 ] 35 }, 36 { 37 "featureType": "road", 38 "elementType": "all", 39 "stylers": [ 40 { 41 "saturation": "-83" 42 }, 43 { 44 "lightness": "8" 45 }, 46 { 47 "gamma": "1.14" 48 }, 49 { 50 "hue": "#ffbd00" 51 } 52 ] 53 }, 54 { 55 "featureType": "transit", 56 "elementType": "all", 57 "stylers": [ 58 { 59 "saturation": "-73" 60 } 61 ] 62 } 63]; 64 65function initialize() { 66 67 $("#address").autocomplete({ 68 //source: data, 69 source: function (req, res) { 70 71 $.post('/mapa/search', $('#map_search_pane form').serialize(), function (d) { 72 res(d); 73 }, 'json'); 74 }, 75 minLength: 0, 76 select: function (event, ui) { 77 console.log('ala') 78 showMarkers(ui.item.id.split(',')) 79 }, 80 response: function (event, ui) { 81 console.log('ala') 82 var str = ''; 83 for(var i = 0; i<ui.content.length; i++) 84 { 85 str += ui.content[i].id + ','; 86 } 87 var markers = str.split(','); 88 if(markers.length > 0) 89 showMarkers(markers); 90 }, focus: function (event, ui) { 91 //$("#address").val(ui.item.value); 92 //$("#address").attr('data-items', ui.item.id); 93 $('#map_search_pane .btn-search').removeClass('disable'); 94 return false; 95 }, open: function () 96 { 97 //$('#address').attr('data-items', ''); 98 $('#map_search_pane .btn-search').addClass('disable'); 99 } 100// ,search:function(event,ui){ 101// $(this).autocomplete( "option", { source: data } ); 102// } 103 }); 104// var input = document.getElementById('address'); 105// if (input !== null) 106// { 107// var autocomplete = new google.maps.places.Autocomplete(input); 108// $('#address').keyup(function () { 109// //codeAddress(); 110// }); 111// $('#address').keypress(function (e) { 112// var code = (e.keyCode ? e.keyCode : e.which); 113// if (code == 13) 114// { 115// //codeAddress(); 116// return false; 117// } 118// }); 119// 120// } 121 geocoder = new google.maps.Geocoder(); 122 var latlng = new google.maps.LatLng(defLat, defLng); 123 var myOptions = { 124 zoom: defZoom, 125 center: latlng, 126 mapTypeId: google.maps.MapTypeId.ROADMAP, 127 styles: mapStyle 128 } 129 map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); 130} 131function getHints() 132{ 133 134} 135function codeAddress() { 136 var address = document.getElementById("address").value; 137 geocoder.geocode({'address': address}, function (results, status) { 138 if (status == google.maps.GeocoderStatus.OK) { 139 map.setCenter(results[0].geometry.location); 140 marker.setMap(null); 141 marker = new google.maps.Marker({ 142 map: map, 143 position: results[0].geometry.location 144 }); 145 $('input[name=map_lat]').val(results[0].geometry.location.lat()); 146 $('input[name=map_lng]').val(results[0].geometry.location.lng()); 147 map.setZoom(15); 148 } else { 149 //alert("Adresu nie udaÅo siÄ odnaleźÄ: " + status); 150 } 151 }); 152} 153function getPlaces(center, cat, init) 154{ 155 var count = 0;
156 $('#favLoadProges').show() 157 $.get('mapa/getplaces', function (res) { 158 159 160 data = new Array(); 161 $.each(res, function (i, v) { 162 isnoempty = true; 163 var aut = new Array(); 164 aut['value'] = v.title; 165 aut['label'] = v.title; 166 aut['desc'] = v.lead; 167 aut['position'] = new google.maps.LatLng(v.map_lat, v.map_lng); 168 aut['img'] = (v.file !== undefined ? (v.file.replace('.', '_thumb.')) : ''); 169 aut['id'] = v.id; 170 aut['url'] = v.url; 171 data.push(aut); 172 }); 173 //console.log(data); 174 addPlaces(data, map, center, cat, init); 175 176 if (count == 0) 177 { 178 //.html('0%'); 179 } 180 else 181 { 182// var h = Math.round(count / categories.length * 100) + '%'; 183// $('#loader').stop().animate({height: h}, 300); 184 } 185 if (++count == res.length) 186 { 187 //showMarkers() 188 //$('#favLoadProges').hide(); 189 } 190 }, 'json') 191} 192function addPlaces(locations, map, center, cat, init) 193{ 194 if (locations.length > 0) 195 { 196 197 var bounds = new google.maps.LatLngBounds(); 198 for (var i = 0, location; location = locations[i]; i++) { 199 200 var marker = addMarker(location, map); 201 marker.id_i = location.id; 202// marker.favId = location.id; 203// marker.tag = location.tag; 204// marker.tested = location.tested; 205// marker.last = location.last; 206// marker.family_friendly = location.family_friendly; 207 208 google.maps.event.addListener(marker, 'click', (function (marker, i, location, cat, locations) { 209 210 return function () { 211 //var m =marker.getPosition(); 212 213 214 //offsetCenter(marker.getPosition(),0,-300) 215 216 hideInfoWindow(); 217 marker.setVisible(false); 218 var content = getCString(locations[i]) 219 var notLogged; 220 if ($('#notLoggedToFavourites').length > 0) 221 notLogged = true; 222 else 223 notLogged = false; 224 infowindow = new SmartInfoWindow({position: marker.getPosition(), map: map, content: content, marker: marker, img: locations[i]['img'], placeId: locations[i]['id']}); 225 } 226 })(marker, i, location, cat, locations)); 227 //markers[cat].push(marker); 228 229 bounds.extend(marker.position); 230 marker.setVisible(true); 231 markers.push(marker); 232 //console.log(i,locations.length); 233 if (i == (locations.length - 1)) 234 {
235 $('#favLoadProges').hide() 236 } 237 } 238 if (init == true && center == false) 239 { 240 map.setZoom(7); 241 map.setCenter(new google.maps.LatLng(defLat, defLng)); 242 } 243 else if (center == true) { 244// console.log('bounds');// 245 map.fitBounds(bounds); 246 } else { 247 248 } 249 250 251 } 252} 253function addMarker(feature, map) { 254 255 var zIndex = 1902; 256 if (feature.type == 'geo') 257 zIndex = 10000; 258 259 260 261 image = new google.maps.MarkerImage(icon.icon, 262 null, /* size is determined at runtime */ 263 null, /* origin is 0,0 */ 264 new google.maps.Point(15, 22), 265 new google.maps.Size(31, 44) // 65, 66 266 // new google.maps.Point(55, 160) 267 ); 268 269 270 var marker = new google.maps.Marker({ 271 position: feature.position, 272 icon: image, 273 zIndex: zIndex, 274 map: map 275 }); 276 return marker; 277} 278 279$(document).ready(function () { 280 281 initialize(); 282 getPlaces(true, true, true); 283 284 285}); 286function getCString(location) { 287 //var w = location.name; 288 var img = new Image(); 289 img.src = location['img']; 290 291 var div = '<div class="placedescription onmap "><div class="placedescription-content"><a href="' + location['url'] + '"><h2>' + location['label'] + '</h2><img id="pla_omg" src="' 292 + location['img'] + '"/><div class="text">' + location['desc'] + '</div></a></div></div>'; 293 return div; 294} 295function showMarkers(arr) 296{ 297 hideInfoWindow(); 298 isnoempty = false; 299 var bounds = new google.maps.LatLngBounds(); 300 for (var km in markers) { 301 if (markers.hasOwnProperty(km)) 302 { 303 if (arr.indexOf(markers[km].id_i) < 0) 304 { 305 markers[km].setVisible(false); 306 307 } 308 else 309 { 310 bounds.extend(markers[km].position); 311 markers[km].setVisible(true); 312 if (arr.length == 1) 313 { 314 google.maps.event.trigger(markers[km], 'click'); 315 } 316 } 317 } 318 } 319 320 map.fitBounds(bounds); 321 if(map.getZoom() > 15) 322 map.setZoom(15); 323 324} 325function offsetCenter(latlng, offsetx, offsety) { 326 327// latlng is the apparent centre-point 328// offsetx is the distance you want that point to move to the right, in pixels 329// offsety is the distance you want that point to move upwards, in pixels 330// offset can be negative 331// offsetx and offsety are both optional 332 333 var scale = Math.pow(2, map.getZoom()); 334 var nw = new google.maps.LatLng( 335 map.getBounds().getNorthEast().lat(),
336 map.getBounds().getSouthWest().lng() 337 ); 338 339 var worldCoordinateCenter = map.getProjection().fromLatLngToPoint(latlng); 340 var pixelOffset = new google.maps.Point((offsetx / scale) || 0, (offsety / scale) || 0) 341 342 var worldCoordinateNewCenter = new google.maps.Point( 343 worldCoordinateCenter.x - pixelOffset.x, 344 worldCoordinateCenter.y + pixelOffset.y 345 ); 346 347 var newCenter = map.getProjection().fromPointToLatLng(worldCoordinateNewCenter); 348 349 map.panTo(newCenter); 350 351} 352function hideInfoWindow(){ 353 if (infowindow != null) 354 { 355 infowindow.marker.setVisible(true) 356 infowindow.close(); 357 358 infowindow = null; 359 } 360}
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.