1var pickupl_select_adress = "Wpisz poprawny adres.." 2 3var pickup_oscop = { 4 geokoder: 0, 5 mapa: 0, 6 zoom: 10, 7 markerIcon: 0, 8 language: 0, 9 markersArray: [], 10 contentsArray: [], 11 markerInfo: 0, 12 timeout: 0, 13 loadNavBoolPickup: false, 14 pickupCount: 0, 15 pickupIteration: 0, 16 pickupFind: 0, 17 pickupFirstActive: true, 18 calendar: {}, 19 markerAnimation: 0, 20 pickupsType: 0, 21 google_api_key: 'AIzaSyARceIhR5QaZMVJwjeF9n9QXjjWfVlvzE0', //AIzaSyDmFYP0sv_BvKn1jyRGYa9iluRcDlCBUQo 22 courierId: '', 23 isCod: false, 24 search_lat: 52.2057462, 25 search_lng: 21.0745393, 26 markerClusters: '', 27 ClusterMaxZoom: 13, 28 minimumClusterSize: 10, 29 autocomplete: false, 30 copAdress: '', 31 adress: { street_number: '', route: '', locality: '', administrative_area_level_1: '', country: '', postal_code: '' }, 32 gettingPickups: false, 33 fillInAddress: function(place, manual) { 34 pickup_oscop.adress = { 35 street_number: '', 36 route: '', 37 locality: '', 38 administrative_area_level_1: '', 39 country: '', 40 postal_code: '' 41 }; 42 var componentForm = { 43 street_number: 'short_name', 44 route: 'long_name', 45 locality: 'long_name', 46 administrative_area_level_1: 'short_name', 47 country: 'long_name', 48 postal_code: 'short_name' 49 }; 50 pickup_oscop.search_lat = ''; 51 pickup_oscop.search_lng = ''; 52 if (place && !place.geometry) return false; 53 if (!place) { 54 if (pickup_oscop.courierId == '') return false; 55 //Alertek.show_alert(pickupl_select_adress); 56 $('#pickup_map, .loadingMap').hide(); 57 console.log('returning false 58'); 58 return false; 59 } else { 60 $('.mapContainer_pickup, .asideContainer_pickup, .pickupl_submit, #pickup_map').show(); 61 62 setTimeout(function() { 63 if (!$('.asideContainer_pickup').html().length) { 64 console.log('getLocation 63'); 65 pickup_oscop.getLocation(); 66 } 67 }, 1000); 68 69 } 70 pickup_oscop.search_lat = place.geometry.location.lat(); 71 pickup_oscop.search_lng = place.geometry.location.lng(); 72 for (var i = 0; i < place.address_components.length; i++) { 73 var addressType = place.address_components[i].types[0]; 74 if (componentForm[addressType]) { 75 var val = place.address_components[i][componentForm[addressType]]; 76 pickup_oscop.adress[addressType] = val; 77 } 78 } 79 if (manual) { 80 var inputValue = ''; 81 if (pickup_oscop.adress.route) { 82 inputValue += pickup_oscop.adress.route; 83 if (pickup_oscop.adress.street_number) { 84 inputValue += ' ' + pickup_oscop.adress.street_number; 85 } 86 } 87 if (pickup_oscop.adress.locality) { 88 if (pickup_oscop.adress.route) { 89 inputValue += ', ' 90 } 91 inputValue += pickup_oscop.adress.locality; 92 } 93 if (pickup_oscop.adress.country) { 94 if (pickup_oscop.adress.locality) { 95 inputValue += ', ' 96 } 97 inputValue += pickup_oscop.adress.country; 98 } 99 $('#autocomplete_location').val(inputValue); 100 } 101 }, 102 getLocation: function() { 103 if (pickup_oscop.search_lat == '' && pickup_oscop.search_lng == '') { 104 105 $('#autocomplete_location').val(pickup_oscop.copAdress); 106 pickup_oscop.geokoder.geocode({ address: $('#autocomplete_location').val() }, function(json, status) { 107 var point = (json && json.length) ? json[0] : null; 108 pickup_oscop.fillInAddress(point, true); 109 //console.log('ajaxGetPickup 105'); 110 // pickup_oscop.ajaxGetPickup(); 111 return false; 112 }); 113 } 114 console.log('ajaxGetPickup 109-'); 115 pickup_oscop.ajaxGetPickup(); 116 }, 117 118 ajaxGetPickup: function() { 119 const that = this; 120 121 if (!this.gettingPickups) { 122 console.log('getting pickups'); 123 console.log('setting gettingPickups to true'); 124 this.gettingPickups = true; 125 var filterJSON = false; 126 127 pickup_oscop.courierId = 100149; 128 // pickup_oscop.search_lat = 54.0990439; 129 // pickup_oscop.search_lng = 22.8968229; 130 pickup_oscop.isCod = 0; 131 pickup_oscop.adress.locality = 'Szczecin'; 132 133 if (pickup_oscop.courierId == '') { 134 pickup_oscop.gettingPickups = false; 135 return false; 136 } 137 138 if (!pickup_oscop.adress.locality) { 139 //Alertek.show_alert(pickupl_select_adress); 140 $('#pickup_map, .loadingMap').hide(); 141 pickup_oscop.gettingPickups = false; 142 return false; 143 } else { 144 $('.mapContainer_pickup, .asideContainer_pickup, .pickupl_submit, #pickup_map').show(); 145 } 146 $('label.pickup_point').hide(); 147 $('div.loadingMap').fadeIn('normal', function() {}); 148 $('span.loadingMarkers').hide(); 149 150 var options = { 151 'courierId': pickup_oscop.courierId, 152 'location[latitude]': pickup_oscop.search_lat, 153 'location[longitude]': pickup_oscop.search_lng, 154 'isCod': pickup_oscop.isCod,
155 'radius': 30 156 }; 157 158 $.ajax({ 159 type: 'GET', 160 url: '/ajax/getPickups.php', 161 data: options, 162 dataType: 'json', 163 success: function(json) { 164 if (!json.pickupPoints.length) { 165 Alertek.show_alert(pickupl_nopoints); 166 return false; 167 } 168 if (!pickup_oscop.adress.route) { 169 for (i in json.pickupPoints) { 170 if ($.trim(json.pickupPoints[i].address.city).toLowerCase() == $.trim(pickup_oscop.adress.locality).toLowerCase()) { 171 options.radius = 30; 172 $.ajax({ 173 type: 'GET', 174 url: '/ajax/getPickups.php', 175 data: options, 176 dataType: 'json', 177 success: function(json) { 178 pickup_oscop.setPickupPoints(json, true); 179 }, 180 error: function() {} 181 }); 182 return false; 183 } 184 } 185 } 186 // console.log('setting gettingPickups to false'); 187 // pickup_oscop.gettingPickups = false; 188 // console.log('gettingPickups is', that.gettingPickups); 189 pickup_oscop.setPickupPoints(json, false); 190 191 }, 192 error: function() { 193 Alertek.show_alert(pickupl_error); 194 // console.log('setting gettingPickups to false'); 195 // pickup_oscop.gettingPickups = false; 196 // console.log('gettingPickups is', that.gettingPickups); 197 }, 198 complete: function() { 199 console.log('complete'); 200 console.log('setting gettingPickups to false'); 201 pickup_oscop.gettingPickups = false; 202 } 203 }); 204 } else { 205 console.log('already getting pickups'); 206 } 207 }, 208 showSel: function() { 209 pickup_oscop.pickupCount = $('.asideContainer_pickup .pickup_point').length; 210 pickup_oscop.pickupIteration = 0; 211 $('div.loadingMap').fadeIn('normal', function() {}); 212 $('span.loadingMap').hide(); 213 $('span.loadingMarkers').css('display', 'block'); 214 $('span.loadingMarkersCount').text(pickup_oscop.pickupCount); 215 $('span.loadingMarkersComplete').text(pickup_oscop.pickupIteration); 216 pickup_oscop.markersArray = []; 217 var adresData = [] 218 $('.asideContainer_pickup .pickup_point').each(function(index) { 219 $this = $(this); 220 adresData[index] = {}; 221 adresData[index].idek = $this.data("id"); 222 adresData[index].headerText = $.trim($this.find(".headerText").text()); 223 adresData[index].streetText = $.trim($this.find(".streetText").text()); 224 adresData[index].cityText = $.trim($this.find(".cityText").text()); 225 adresData[index].moreText = $.trim($this.find(".moreLink").text()); 226 adresData[index].moreLink = $.trim($this.find(".moreLink").attr('href')); 227 adresData[index].infoText = $.trim($this.find(".infoText").text()); 228 adresData[index].timeText = $.trim($this.find(".timeText").text()); 229 adresData[index].latitude = $.trim($this.data("latitude")); 230 adresData[index].longitude = $.trim($this.data("longitude")); 231 adresData[index].icon = $.trim($this.data('icon')); 232 }); 233 var adresRow = ''; 234 while (adresRow = adresData.pop()) { 235 if (adresRow.latitude && adresRow.longitude) { 236 pickup_oscop.findAdres(adresRow.headerText, adresRow.streetText, adresRow.cityText, adresRow.moreText, adresRow.moreLink, adresRow.infoText, adresRow.timeText, 'none', 'another', false, adresRow.idek, adresRow.latitude, adresRow.longitude, adresRow.icon); 237 } else { 238 (function(adresRow) { 239 setTimeout(function() { 240 pickup_oscop.findAdres(adresRow.headerText, adresRow.streetText, adresRow.cityText, adresRow.moreText, adresRow.moreLink, adresRow.infoText, adresRow.timeText, 'none', 'another', false, adresRow.idek, adresRow.latitude, adresRow.longitude, adresRow.icon); 241 }, pickup_oscop.timeout); 242 })(adresRow); 243 } 244 // console.log('click first point'); 245 246 // if($('label.pickup_point:eq(0)').is(':visible')) 247 // $('label.pickup_point:eq(0)').click(); 248 } 249 250 }, 251 printDates: function(stockId) { 252 if (!$('#selectPickupDay').size()) return false; 253 var postData = { stock_id: stockId } 254 $.ajax({
255 type: 'GET', 256 url: '/ajax/basket-delivery.php', 257 data: postData, 258 dataType: 'json', 259 success: function(json) { 260 if (!json) { 261 $('#selectPickupDayWrapper').hide(); 262 return false 263 }; 264 $('#selectPickupDay').html(''); 265 $.each(json, function(index, data) { 266 $('#selectPickupDay').append('<label class="pickupl_date"><input name="calendar_select_date" type="radio" class="pickupl_radio" value="' + data.date + '"></input><div class="pickupl_date_sub"><span class="pickupl_date_day">' + data.d + '</span><span class="pickupl_date_month">' + iaical_monthNames[data.m - 1] + '</span></div></label>'); 267 }); 268 $('#selectPickupDayWrapper').show(); 269 $('.pickupl_hour_wrapper').show(); 270 $('#selectPickupDay [name="calendar_select_date"]').eq(1).attr('checked', true); 271 }, 272 error: function() { 273 Alertek.show_alert(pickupl_error); 274 } 275 }); 276 }, 277 setZoom: function() { 278 var bounds = new google.maps.LatLngBounds(); 279 for (var i in pickup_oscop.markersArray) { 280 bounds.extend(pickup_oscop.markersArray[i].getPosition()); 281 } 282 pickup_oscop.mapa.setCenter(bounds.getCenter()); 283 pickup_oscop.mapa.fitBounds(bounds); 284 pickup_oscop.mapa.setZoom(pickup_oscop.mapa.getZoom()); 285 if (pickup_oscop.mapa.getZoom() > 15) { 286 pickup_oscop.mapa.setZoom(15); 287 } 288 }, 289 mapInit: function() { 290 if ($('#autocomplete_location').size()) { 291 pickup_oscop.autocomplete = new google.maps.places.Autocomplete((document.getElementById('autocomplete_location'))); 292 $('label.pickup_point').hide(); 293 } 294 295 if (pickup_oscop.google_api_key === '') { 296 $('.pickupl_sel').removeAttr('disabled'); 297 $('div#ps_other').css('opacity', '1.0'); 298 $('div#ps_other').css('cursor', 'pointer'); 299 } 300 301 pickup_oscop.geokoder = new google.maps.Geocoder(); 302 pickup_oscop.mapa = new google.maps.Map(document.getElementById("pickup_map"), { 303 gestureHandling: 'cooperative', 304 zoom: pickup_oscop.zoom, 305 center: new google.maps.LatLng(52, 19.5), 306 mapTypeId: google.maps.MapTypeId.ROADMAP, 307 navigationControl: true, 308 mapTypeControl: true, 309 scaleControl: false, 310 navigationControlOptions: { style: google.maps.NavigationControlStyle.ZOOM_PAN }, 311 mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU } 312 }); 313 314 315 pickup_oscop.markerInfo = new google.maps.InfoWindow(); 316 google.maps.event.addListener(pickup_oscop.mapa, 'idle', function() { 317 $('span.loadingMap').text($('span.loadingNav').text()); 318 }); 319 if (pickup_oscop.autocomplete) { 320 pickup_oscop.autocomplete.addListener('place_changed', function() { 321 var place = pickup_oscop.autocomplete.getPlace(); 322 pickup_oscop.fillInAddress(place, false); 323 }); 324 console.log('getLocation 286'); 325 pickup_oscop.getLocation(); 326 } else { 327 //console.log('showSel 286'); 328 pickup_oscop.showSel(); 329 } 330 // pickup_oscop.showSel(); 331 332 $('#autocomplete_location').val(''); 333 334 setTimeout(function() { 335 pickup_oscop.mapa.setZoom(6); 336 }, 1000); 337 }, 338 markerClickFunction: function(latlng, content) { 339 return function(e) { 340 e.cancelBubble = true; 341 e.returnValue = false; 342 if (e.stopPropagation) { 343 e.stopPropagation(); 344 e.preventDefault(); 345 } 346 pickup_oscop.infoWindow.setContent(content); 347 pickup_oscop.infoWindow.setPosition(latlng); 348 pickup_oscop.infoWindow.open(pickup_oscop.mapa); 349 }; 350 }, 351 geokoderPrepare: function(point, status, headerText, streetText, cityText, moreText, moreLink, infoText, timeText, className, other, open, idek, latitude, longitude, icon) { 352 if (status == google.maps.GeocoderStatus.OK) { 353 pickup_oscop.timeout = 100; 354 pickup_oscop.pickupIteration++; 355 pickup_oscop.pickupFind++; 356 var content = '<div class="mapTooltip"><b class="mapTooltipName">' + headerText + '</b>'; 357 content += '<div class="mapTooltipAdress"><span>' + streetText + ' </span> <span>' + cityText + '</span></div>'; 358 if (infoText) { 359 content += '<div class="mapTooltipComment">' + infoText + '</div>'; 360 } 361 content += '<div class="mapTooltipTime">' + timeText + '</div>'; 362 if (moreLink) { 363 content += '<div class="mapTooltipLink"><a class="btn-small" title="" href="' + moreLink + '" target="_blank">' + moreText + '</a></div>'; 364 } 365 content += '</div>'; 366 var opcjeMarkera = { title: headerText, pickupPointID: idek }; 367 opcjeMarkera.position = point; 368 opcjeMarkera.map = pickup_oscop.mapa; 369 if (pickup_oscop.markerAnimation) 370 opcjeMarkera.animation = google.maps.Animation.DROP; 371 372 var marker = new google.maps.Marker(opcjeMarkera); 373 pickup_oscop.markersArray.push(marker); 374 google.maps.event.addListener(marker, 'click', (function(marker, i) { 375 return function(e) { 376 e.cancelBubble = true; 377 e.returnValue = false; 378 if (e.stopPropagation) { 379 e.stopPropagation(); 380 e.preventDefault(); 381 } 382 pickup_oscop.markerInfo.setContent(content); 383 pickup_oscop.markerInfo.open(pickup_oscop.mapa, marker); 384 $('.asideContainer_pickup [value="' + marker.pickupPointID + '"]').attr('checked', true); 385 $('.asideContainer_pickup').scrollTop(0); 386 $('.asideContainer_pickup').scrollTop($('#pickup_site [name="pickup_point"]:checked + label').position().top); 387 } 388 })(marker, i)); 389 var pickupItem = $('.asideContainer_pickup [value="' + marker.pickupPointID + '"]').get(0); 390 $('label[for="pickup_point_' + marker.pickupPointID + '"]').show().fadeTo('slow', 1); 391 google.maps.event.addDomListener(pickupItem, 'click', (function(marker, i) { 392 return function(e) { 393 $('.asideContainer_pickup [value="' + marker.pickupPointID + '"]').attr('checked', true); 394 pickup_oscop.markerInfo.setContent(content); 395 pickup_oscop.mapa.setCenter(opcjeMarkera.position); 396 if (pickup_oscop.mapa.getZoom() < pickup_oscop.ClusterMa
396xZoom) { 397 pickup_oscop.mapa.setZoom(pickup_oscop.ClusterMaxZoom + 1); 398 } 399 pickup_oscop.markerInfo.open(pickup_oscop.mapa, marker); 400 } 401 })(marker, i)); 402 if (pickup_oscop.pickupIteration < pickup_oscop.pickupCount) { 403 $('span.loadingMarkersComplete').text(pickup_oscop.pickupIteration); 404 } 405 if (pickup_oscop.pickupIteration >= pickup_oscop.pickupCount) { 406 setTimeout(function() { 407 $('div.loadingMap').fadeOut('normal', function() {}); 408 var _src = $('.markerCluster[src*="m1.png"]').attr('src') 409 var _imagePath = _src.substring(0, _src.indexOf('1.png')); 410 if (!pickup_oscop.markerClusters) { 411 pickup_oscop.markerClusters = new MarkerClusterer(pickup_oscop.mapa, pickup_oscop.markersArray, { 412 imagePath: _imagePath, 413 maxZoom: pickup_oscop.ClusterMaxZoom, 414 minimumClusterSize: pickup_oscop.minimumClusterSize 415 }); 416 } else { 417 pickup_oscop.markerClusters.clearMarkers() 418 pickup_oscop.markerClusters.addMarkers(pickup_oscop.markersArray);
419 } 420 pickup_oscop.setZoom(); 421 }, 300); 422 } 423 } else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) { 424 pickup_oscop.timeout += 50; 425 setTimeout(function() { 426 pickup_oscop.findAdres(headerText, streetText, cityText, moreText, moreLink, infoText, timeText, className, other, open, idek, latitude, longitude, icon); 427 }, pickup_oscop.timeout); 428 } else { 429 pickup_oscop.pickupIteration++; 430 if (pickup_oscop.pickupIteration <= pickup_oscop.pickupCount) 431 $('span.loadingMarkersComplete').text(pickup_oscop.pickupIteration); 432 if (pickup_oscop.pickupIteration >= pickup_oscop.pickupCount) { 433 setTimeout(function() { 434 $('div.loadingMap').fadeOut('normal', function() {}); 435 var _src = $('.markerCluster[src*="m1.png"]').attr('src') 436 var _imagePath = _src.substring(0, _src.indexOf('1.png') - 1); 437 if (!pickup_oscop.markerClusters) { 438 pickup_oscop.markerClusters = new MarkerClusterer(pickup_oscop.mapa, pickup_oscop.markersArray, { 439 imagePath: _imagePath, 440 maxZoom: pickup_oscop.ClusterMaxZoom, 441 minimumClusterSize: pickup_oscop.minimumClusterSize 442 }); 443 } else { 444 pickup_oscop.markerClusters.clearMarkers() 445 pickup_oscop.markerClusters.addMarkers(pickup_oscop.markersArray);
446 } 447 pickup_oscop.setZoom(); 448 }, 300); 449 } 450 } 451 }, 452 453 findAdres: function(headerText, streetText, cityText, moreText, moreLink, infoText, timeText, className, other, open, idek, latitude, longitude, icon) { 454 var adres = streetText + ' , ' + cityText; 455 if (latitude && longitude) { 456 var point = new google.maps.LatLng(latitude, longitude); 457 pickup_oscop.geokoderPrepare(point, 'OK', headerText, streetText, cityText, moreText, moreLink, infoText, timeText, className, other, open, idek, latitude, longitude, icon); 458 } else { 459 pickup_oscop.geokoder.geocode({ address: adres }, function(wyniki, status) { 460 var point = (wyniki && wyniki.length) ? wyniki[0].geometry.location : null; 461 pickup_oscop.geokoderPrepare(point, status, headerText, streetText, cityText, moreText, moreLink, infoText, timeText, className, other, open, idek, latitude, longitude, icon); 462 }); 463 } 464 }, 465 466 geolocate: function() { 467 pickup_oscop.search_lat = ''; 468 pickup_oscop.search_lng = ''; 469 if (navigator.geolocation) { 470 navigator.geolocation.getCurrentPosition(function(position) { 471 var geolocation = { lat: position.coords.latitude, lng: position.coords.longitude }; 472 var circle = new google.maps.Circle({ center: geolocation, radius: position.coords.accuracy }); 473 pickup_oscop.autocomplete.setBounds(circle.getBounds()); 474 }); 475 } 476 }, 477 478 init_pickupl_site: function() { 479 if (pickup_oscop.autocomplete) { 480 pickup_oscop.autocomplete.setComponentRestrictions({ 'country': pickup_oscop.country_code }); 481 } 482 if (typeof mapSiteType != 'undefined') 483 if (mapSiteType == 'pickup_site') { 484 var loadingMapWidth = $('div.loadingMap').width() / 2; 485 var loadingMapHeight = $('div.loadingMap').height() / 2; 486 var loadingBoxWidth = $('div.loadingBox').width() / 2; 487 var loadingBoxHeight = $('div.loadingBox').height() / 2; 488 var loadingBoxLeft = loadingMapWidth - loadingBoxWidth; 489 var loadingBoxTop = loadingMapHeight - loadingBoxHeight; 490 // pickup_oscop.google_api_key = google_api_key; 491 $('div.loadingBox').css('left', loadingBoxLeft); 492 $('div.loadingBox').css('top', loadingBoxTop); 493 $('div.loadingBox').fadeTo('normal', 1.0, function() {}); 494 } 495 }, 496 497 setPickupPoints: function(json, filter) { 498 if (!$.isEmptyObject(pickup_oscop.markersArray)) { 499 for (i in pickup_oscop.markersArray) { 500 pickup_oscop.markersArray[i].setMap(null); 501 } 502 } 503 $('#pickup_site .asideContainer_pickup').html(''); 504 if (filter) { 505 var pickupPointsFilter = []; 506 for (i in json.pickupPoints) { 507 if ($.trim(json.pickupPoints[i].address.city).toLowerCase() == $.trim(pickup_oscop.adress.locality).toLowerCase()) { 508 pickupPointsFilter.push(json.pickupPoints[i]); 509 } 510 } 511 if (pickupPointsFilter.length) { 512 json.pickupPoints = pickupPointsFilter; 513 } 514 } 515 for (i in json.pickupPoints) { 516 var pickup = json.pickupPoints[i]; 517 var pickup_clone = $('#pickup_copy').clone(); 518 pickup_clone.find('input[name=pickup_point]').attr('id', 'pickup_point_' + pickup.id); 519 pickup_clone.find('input[name=pickup_point]').attr('data-create_order', 'pickup_point'); 520 pickup_clone.find('input[name=pickup_point]').val(pickup.id); 521 pickup_clone.find('label').attr('data-latitude', pickup.coordinates.latitude); 522 pickup_clone.find('label').attr('data-longitude', pickup.coordinates.longitude); 523 pickup_clone.find('label').attr('data-id', pickup.id); 524 pickup_clone.find('label').attr('data-requires_client_number', pickup.requiresClientNumber); 525 pickup_clone.find('label').attr('for', 'pickup_point_' + pickup.id); 526 pickup_clone.find('label').hide().css('opacity', '0'); 527 if (pickup.markerIconUrl) { 528 pickup_clone.find('label').attr('data-icon', pickup.markerIconUrl); 529 pickup_clone.find('label').find('svg').replaceWith('<img src="' + pickup.markerIconUrl + '" alt="' + pickup.id + '"/>'); 530 } 531 if (pickup.coordinates.longitude) { 532 pickup_clone.find('label .map_dir').attr('href', 'https://www.google.com/maps/dir/?api=1&destination=' + pickup.coordinates.latitude + ',' + pickup.coordinates.longitude); 533 } else { 534 pickup_clone.find('label .map_dir').attr('href', 'https://maps.google.com?saddr=Current+Location&daddr=' + pickup.address.street + '+' + pickup.address.postcode + '+' + pickup.address.city); 535 } 536 pickup_clone.find('b.headerText').text(pickup.name); 537 var pickup_street = pickup.address.buildingAndHouseNumber != '' && pickup.address.buildingAndHouseNumber != null ? pickup.address.street + ' ' + pickup.address.buildingAndHouseNumber : pickup.address.street; 538 pickup_clone.find('span.streetText').text(pickup_street); 539 pickup_clone.find('span.zipcodePickup').html(pickup.address.postcode + ' <span class="cityText">' + pickup.address.city + '</span>'); 540 pickup_clone.find('div.moreText').text(pickup.location); 541 pickup_clone.find('a.moreLink').attr('href', pickup.link); 542 if (pickup.requiresClientNumber) {} else { 543 pickup_clone.find('input[name=client_courier_number]').remove(); 544 } 545 $('#pickup_site .asideContainer_pickup').append(pickup_clone.find(' > *')); 546 } 547 //console.log('showSel 504'); 548 pickup_oscop.showSel(); 549 } 550 551} 552 553// $('#locationField .btn').die('click'); 554// $('#locationField .btn').live('click', function () { 555// console.log('getLocation 520'); 556// pickup_oscop.getLocation();
557// return false; 558// }); 559// $('div.morePickup').die('click'); 560// $('div.morePickup').live('click', function () { 561// var activePoints = $('label.pickup_point.moreInfoShow') 562// $(this).parents('label.pickup_point').addClass('moreInfoShow'); 563// activePoints.removeClass('moreInfoShow'); 564// }); 565 566// $('#pickup_site [name="pickup_point"], #pickup_site [name="stock"]').die('click'); 567// $('#pickup_site [name="pickup_point"], #pickup_site [name="stock"]').live('click', function () { 568// $('#pickup_site [name="client_courier_number"]').attr('disabled', true); 569// $(this).find('+ label [name="client_courier_number"]').attr('disabled', false).focus(); 570// pickup_oscop.printDates($(this).val()); 571// }); 572 573 574 575 576function MarkerClusterer(t, e, r) { 577 this.extend(MarkerClusterer, google.maps.OverlayView), this.map_ = t, this.markers_ = [], this.clusters_ = [], this.sizes = [53, 56, 66, 78, 90], this.styles_ = [], this.ready_ = !1; 578 var s = r || {}; 579 this.gridSize_ = s.gridSize || 60, this.minClusterSize_ = s.minimumClusterSize || 2, this.maxZoom_ = s.maxZoom || null, this.styles_ = s.styles || [], this.imagePath_ = s.imagePath || this.MARKER_CLUSTER_IMAGE_PATH_, this.imageExtension_ = s.imageExtension || this.MARKER_CLUSTER_IMAGE_EXTENSION_, this.zoomOnClick_ = !0, null != s.zoomOnClick && (this.zoomOnClick_ = s.zoomOnClick), this.averageCenter_ = !1, null != s.averageCenter && (this.averageCenter_ = s.averageCenter), this.setupStyles_(), this.setMap(t), this.prevZoom_ = this.map_.getZoom(); 580 var i = this; 581 google.maps.event.addListener(this.map_, "zoom_changed", function() { 582 var t = i.map_.getZoom(), 583 e = i.map_.minZoom || 0, 584 r = Math.min(i.map_.maxZoom || 100, i.map_.mapTypes[i.map_.getMapTypeId()].maxZoom); 585 t = Math.min(Math.max(t, e), r), i.prevZoom_ != t && (i.prevZoom_ = t, i.resetViewport()) 586 }), google.maps.event.addListener(this.map_, "idle", function() { i.redraw() }), e && (e.length || Object.keys(e).length) && this.addMarkers(e, !1) 587} 588 589function Cluster(t) { this.markerClusterer_ = t, this.map_ = t.getMap(), this.gridSize_ = t.getGridSize(), this.minClusterSize_ = t.getMinClusterSize(), this.averageCenter_ = t.isAverageCenter(), this.center_ = null, this.markers_ = [], this.bounds_ = null, this.clusterIcon_ = new ClusterIcon(this, t.getStyles(), t.getGridSize()) } 590 591function ClusterIcon(t, e, r) { t.getMarkerClusterer().extend(ClusterIcon, google.maps.OverlayView), this.styles_ = e, this.padding_ = r || 0, this.cluster_ = t, this.center_ = null, this.map_ = t.getMap(), this.div_ = null, this.sums_ = null, this.visible_ = !1, this.setMap(this.map_) } 592MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_ = "../images/m", MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_ = "png", MarkerClusterer.prototype.extend = function(t, e) { return function(t) { for (var e in t.prototype) this.prototype[e] = t.prototype[e]; return this }.apply(t, [e]) }, MarkerClusterer.prototype.onAdd = function() { this.setReady_(!0) }, MarkerClusterer.prototype.draw = function() {}, MarkerClusterer.prototype.setupStyles_ = function() { 593 if (!this.styles_.length) 594 for (var t, e = 0; t = this.sizes[e]; e++) this.styles_.push({ url: this.imagePath_ + (e + 1) + "." + this.imageExtension_, height: t, width: t }) 595}, MarkerClusterer.prototype.fitMapToMarkers = function() { 596 for (var t, e = this.getMarkers(), r = new google.maps.LatLngBounds, s = 0; t = e[s]; s++) r.extend(t.getPosition()); 597 this.map_.fitBounds(r) 598}, MarkerClusterer.prototype.setStyles = function(t) { this.styles_ = t }, MarkerClusterer.prototype.getStyles = function() { return this.styles_ }, MarkerClusterer.prototype.isZoomOnClick = function() { return this.zoomOnClick_ }, MarkerClusterer.prototype.isAverageCenter = function() { return this.averageCenter_ }, MarkerClusterer.prototype.getMarkers = function() { return this.markers_ }, MarkerClusterer.prototype.getTotalMarkers = function() { return this.markers_.length }, MarkerClusterer.prototype.setMaxZoom = function(t) { this.maxZoom_ = t }, MarkerClusterer.prototype.getMaxZoom = function() { return this.maxZoom_ }, MarkerClusterer.prototype.calculator_ = function(t, e) { for (var r = 0, s = t.length, i = s; 0 !== i;) i = parseInt(i / 10, 10), r++; return { text: s, index: r = Math.min(r, e) } }, MarkerClusterer.prototype.setCalculator = function(t) { this.calculator_ = t }, MarkerClusterer.prototype.getCalculator = function() { return this.calculator_ }, MarkerClusterer.prototype.addMarkers = function(t, e) { 599 if (t.length) 600 for (var r = 0; s = t[r]; r++) this.pushMarkerTo_(s); 601 else if (Object.keys(t).length) 602 for (var s in t) this.pushMarkerTo_(t[s]); 603 e || this.redraw() 604}, MarkerClusterer.prototype.pushMarkerTo_ = function(t) { 605 if (t.isAdded = !1, t.draggable) { 606 var e = this; 607 google.maps.event.addListener(t, "dragend", function() { t.isAdded = !1, e.repaint() }) 608 } 609 this.markers_.push(t) 610}, MarkerClusterer.prototype.addMarker = function(t, e) { this.pushMarkerTo_(t), e || this.redraw() }, MarkerClusterer.prototype.removeMarker_ = function(t) { 611 var e = -1; 612 if (this.markers_.indexOf) e = this.markers_.indexOf(t); 613 else 614 for (var r, s = 0; r = this.markers_[s]; s++) 615 if (r == t) { e = s; break } return -1 != e && (t.setMap(null), this.markers_.splice(e, 1), !0) 616}, MarkerClusterer.prototype.removeMarker = function(t, e) { var r = this.removeMarker_(t); return !(e || !r) && (this.resetViewport(), this.redraw(), !0) }, MarkerClusterer.prototype.removeMarkers = function(t, e) { 617 for (var r, s = !1, i = 0; r = t[i]; i++) { 618 var o = this.removeMarker_(r); 619 s = s || o 620 } 621 if (!e && s) return this.resetViewport(), this.redraw(), !0 622}, MarkerClusterer.prototype.setReady_ = function(t) { this.ready_ || (this.ready_ = t, this.createCluster
622s_()) }, MarkerClusterer.prototype.getTotalClusters = function() { return this.clusters_.length }, MarkerClusterer.prototype.getMap = function() { return this.map_ }, MarkerClusterer.prototype.setMap = function(t) { this.map_ = t }, MarkerClusterer.prototype.getGridSize = function() { return this.gridSize_ }, MarkerClusterer.prototype.setGridSize = function(t) { this.gridSize_ = t }, MarkerClusterer.prototype.getMinClusterSize = function() { return this.minClusterSize_ }, MarkerClusterer.prototype.setMinClusterSize = function(t) { this.minClusterSize_ = t }, MarkerClusterer.prototype.getExtendedBounds = function(t) { 623 var e = this.getProjection(), 624 r = new google.maps.LatLng(t.getNorthEast().lat(), t.getNorthEast().lng()), 625 s = new google.maps.LatLng(t.getSouthWest().lat(), t.getSouthWest().lng()), 626 i = e.fromLatLngToDivPixel(r); 627 i.x += this.gridSize_, i.y -= this.gridSize_; 628 var o = e.fromLatLngToDivPixel(s); 629 o.x -= this.gridSize_, o.y += this.gridSize_; 630 var n = e.fromDivPixelToLatLng(i), 631 a = e.fromDivPixelToLatLng(o); 632 return t.extend(n), t.extend(a), t 633}, MarkerClusterer.prototype.isMarkerInBounds_ = function(t, e) { return e.contains(t.getPosition()) }, MarkerClusterer.prototype.clearMarkers = function() { this.resetViewport(!0), this.markers_ = [] }, MarkerClusterer.prototype.resetViewport = function(t) { 634 for (var e, r = 0; e = this.clusters_[r]; r++) e.remove(); 635 var s; 636 for (r = 0; s = this.markers_[r]; r++) s.isAdded = !1, t && s.setMap(null); 637 this.clusters_ = [] 638}, MarkerClusterer.prototype.repaint = function() { 639 var r = this.clusters_.slice(); 640 this.clusters_.length = 0, this.resetViewport(), this.redraw(), window.setTimeout(function() { for (var t, e = 0; t = r[e]; e++) t.remove() }, 0) 641}, MarkerClusterer.prototype.redraw = function() { this.createClusters_() }, MarkerClusterer.prototype.distanceBetweenPoints_ = function(t, e) { 642 if (!t || !e) return 0; 643 var r = (e.lat() - t.lat()) * Math.PI / 180, 644 s = (e.lng() - t.lng()) * Math.PI / 180, 645 i = Math.sin(r / 2) * Math.sin(r / 2) + Math.cos(t.lat() * Math.PI / 180) * Math.cos(e.lat() * Math.PI / 180) * Math.sin(s / 2) * Math.sin(s / 2); 646 return 6371 * (2 * Math.atan2(Math.sqrt(i), Math.sqrt(1 - i))) 647}, MarkerClusterer.prototype.addToClosestCluster_ = function(t) { 648 for (var e, r = 4e4, s = null, i = (t.getPosition(), 0); e = this.clusters_[i]; i++) { 649 var o = e.getCenter(); 650 if (o) { 651 var n = this.distanceBetweenPoints_(o, t.getPosition()); 652 n < r && (r = n, s = e) 653 } 654 } 655 s && s.isMarkerInClusterBounds(t) ? s.addMarker(t) : ((e = new Cluster(this)).addMarker(t), this.clusters_.push(e)) 656}, MarkerClusterer.prototype.createClusters_ = function() { 657 if (this.ready_) 658 for (var t, e = new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest
658(), this.map_.getBounds().getNorthEast()), r = this.getExtendedBounds(e), s = 0; t = this.markers_[s]; s++) !t.isAdded && this.isMarkerInBounds_(t, r) && this.addToClosestCluster_(t) 659}, Cluster.prototype.isMarkerAlreadyAdded = function(t) { 660 if (this.markers_.indexOf) return -1 != this.markers_.indexOf(t); 661 for (var e, r = 0; e = this.markers_[r]; r++) 662 if (e == t) return !0; 663 return !1 664}, Cluster.prototype.addMarker = function(t) { 665 if (this.isMarkerAlreadyAdded(t)) return !1; 666 if (this.center_) { 667 if (this.averageCenter_) { 668 var e = this.markers_.length + 1, 669 r = (this.center_.lat() * (e - 1) + t.getPosition().lat()) / e, 670 s = (this.center_.lng() * (e - 1) + t.getPosition().lng()) / e; 671 this.center_ = new google.maps.LatLng(r, s), this.calculateBounds_() 672 } 673 } else this.center_ = t.getPosition(), this.calculateBounds_(); 674 t.isAdded = !0, this.markers_.push(t); 675 var i = this.markers_.length; 676 if (i < this.minClusterSize_ && t.getMap() != this.map_ && t.setMap(this.map_), i == this.minClusterSize_) 677 for (var o = 0; o < i; o++) this.markers_[o].setMap(null); 678 return i >= this.minClusterSize_ && t.setMap(null), this.updateIcon(), !0 679}, Cluster.prototype.getMarkerClusterer = function() { return this.markerClusterer_ }, Cluster.prototype.getBounds = function() { for (var t, e = new google.maps.LatLngBounds(this.center_, this.center_), r = this.getMarkers(), s = 0; t = r[s]; s++) e.extend(t.getPosition()); return e }, Cluster.prototype.remove = function() { this.clusterIcon_.remove(), this.markers_.length = 0, delete this.markers_ }, Cluster.prototype.getSize = function() { return this.markers_.length }, Cluster.prototype.getMarkers = function() { return this.markers_ }, Cluster.prototype.getCenter = function() { return this.center_ }, Cluster.prototype.calculateBounds_ = function() { 680 var t = new google.maps.LatLngBounds(this.center_, this.center_); 681 this.bounds_ = this.markerClusterer_.getExtendedBounds(t) 682}, Cluster.prototype.isMarkerInClusterBounds = function(t) { return this.bounds_.contains(t.getPosition()) }, Cluster.prototype.getMap = function() { return this.map_ }, Cluster.prototype.updateIcon = function() { 683 var t = this.map_.getZoom(), 684 e = this.markerClusterer_.getMaxZoom(); 685 if (e && e < t) 686 for (var r, s = 0; r = this.markers_[s]; s++) r.setMap(this.map_); 687 else if (this.markers_.length < this.minClusterSize_) this.clusterIcon_.hide(); 688 else { 689 var i = this.markerClusterer_.getStyles().length, 690 o = this.markerClusterer_.getCalculator()(this.markers_, i); 691 this.clusterIcon_.setCenter(this.center_), this.clusterIcon_.setSums(o), this.clusterIcon_.show() 692 } 693}, ClusterIcon.prototype.triggerClusterClick = function() { 694 var t = this.cluster_.getMarkerClusterer(); 695 google.maps.event.trigger(t, "clusterclick", this.cluster_), t.isZoomOnClick() && this.map_.fitBounds(this.cluster_.getBounds()) 696}, ClusterIcon.prototype.onAdd = function() { 697 if (this.div_ = document.createElement("DIV"), this.visible_) { 698 var t = this.getPosFromLatLng_(this.center_); 699 this.div_.style.cssText = this.createCss(t), this.div_.innerHTML = this.sums_.text 700 } 701 this.getPanes().overlayMouseTarget.appendChild(this.div_); 702 var e = this; 703 google.maps.event.addDomListener(this.div_, "click", function() { e.triggerClusterClick() }) 704}, ClusterIcon.prototype.getPosFromLatLng_ = function(t) { var e = this.getProjection().fromLatLngToDivPixel(t); return e.x -= parseInt(this.width_ / 2, 10), e.y -= parseInt(this.height_ / 2, 10), e }, ClusterIcon.prototype.draw = function() { 705 if (this.visible_) { 706 var t = this.getPosFromLatLng_(this.center_); 707 this.div_.style.top = t.y + "px", this.div_.style.left = t.x + "px" 708 } 709}, ClusterIcon.prototype.hide = function() { this.div_ && (this.div_.style.display = "none"), this.visible_ = !1 }, ClusterIcon.prototype.show = function() { 710 if (this.div_) { 711 var t = this.getPosFromLatLng_(this.center_); 712 this.div_.style.cssText = this.createCss(t), this.div_.style.display = "" 713 } 714 this.visible_ = !0 715}, ClusterIcon.prototype.remove = function() { this.setMap(null) }, ClusterIcon.prototype.onRemove = function() { this.div_ && this.div_.parentNode && (this.hide(), this.div_.parentNode.removeChild(this.div_), this.div_ = null) }, ClusterIcon.prototype.setSums = function(t) { this.sums_ = t, this.text_ = t.text, this.index_ = t.index, this.div_ && (this.div_.innerHTML = t.text), this.useStyle() }, ClusterIcon.prototype.useStyle = function() { 716 var t = Math.max(0, this.sums_.index - 1); 717 t = Math.min(this.styles_.length - 1, t); 718 var e = this.styles_[t]; 719 this.url_ = e.url, this.height_ = e.height, this.width_ = e.width, this.textColor_ = e.textColor, this.anchor_ = e.anchor, this.textSize_ = e.textSize, this.backgroundPosition_ = e.backgroundPosition 720}, ClusterIcon.prototype.setCenter = function(t) { this.center_ = t }, ClusterIcon.prototype.createCss = function(t) { 721 var e = []; 722 e.push("background-image:url(" + this.url_ + ");"); 723 var r = this.backgroundPosition_ ? this.backgroundPosition_ : "0 0"; 724 e.push("background-position:" + r + ";"), "object" == typeof this.anchor_ ? ("number" == typeof this.anchor_[0] && 0 < this.anchor_[0] && this.anchor_[0] < this.height_ ? e.push("height:" + (this.height_ - this.anchor_[0]) + "px; padding-top:" + this.anchor_[0] + "px;") : e.push("height:" + this.height_ + "px; line-height:" + this.height_ + "px;"), "number" == typeof this.anchor_[1] && 0 < this.anchor_[1] && this.anchor_[1] < this.width_ ? e.push("width:"
724+ (this.width_ - this.anchor_[1]) + "px; padding-left:" + this.anchor_[1] + "px;") : e.push("width:" + this.width_ + "px; text-align:center;")) : e.push("height:" + this.height_ + "px; line-height:" + this.height_ + "px; width:" + this.width_ + "px; text-align:center;"); 725 var s = this.textColor_ ? this.textColor_ : "black", 726 i = this.textSize_ ? this.textSize_ : 11; 727 return e.push("cursor:pointer; top:" + t.y + "px; left:" + t.x + "px; color:" + s + "; position:absolute; font-size:" + i + "px; font-family:Arial,sans-serif; font-weight:bold"), e.join("") 728}; 729 730var s = document.createElement("script"); 731s.type = "text/javascript"; 732s.src = "https://maps.googleapis.com/maps/api/js?key=AIzaSyARceIhR5QaZMVJwjeF9n9QXjjWfVlvzE0&libraries=places&callback=pickup_oscop.mapInit"; 733$("head").append(s); 734 735//make sure to unhide map
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.