WP Store Locator - Version 2.2.17

Version Description

Download this release

Release Info

Developer tijmensmit
Plugin Icon 128x128 WP Store Locator
Version 2.2.17
Comparing to
See all releases

Code changes from version 2.2.16 to 2.2.17

Files changed (4) hide show
  1. js/wpsl-gmap.js +10 -0
  2. js/wpsl-gmap.min.js +1 -1
  3. readme.txt +4 -1
  4. wp-store-locator.php +2 -2
js/wpsl-gmap.js CHANGED
@@ -1136,7 +1136,17 @@ function prepareStoreSearch( latLng, infoWindow ) {
1136
  * @returns {object} response The address components if the stats add-on is active.
1137
  */
1138
  function reverseGeocode( latLng, callback ) {
 
 
1139
 
 
 
 
 
 
 
 
 
1140
  geocoder.geocode( {'latLng': latLng}, function( response, status ) {
1141
  if ( status == google.maps.GeocoderStatus.OK ) {
1142
 
1136
  * @returns {object} response The address components if the stats add-on is active.
1137
  */
1138
  function reverseGeocode( latLng, callback ) {
1139
+ var lat = latLng.lat().toFixed( 5 ),
1140
+ lng = latLng.lng().toFixed( 5 );
1141
 
1142
+ latLng.lat = function() {
1143
+ return parseFloat( lat );
1144
+ };
1145
+
1146
+ latLng.lng = function() {
1147
+ return parseFloat( lng );
1148
+ };
1149
+
1150
  geocoder.geocode( {'latLng': latLng}, function( response, status ) {
1151
  if ( status == google.maps.GeocoderStatus.OK ) {
1152
 
js/wpsl-gmap.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){var t,s,o,n,l,i,a,r,p,d,c,w,g,u,m,f=[],h=[],v=[],S={},b={},C={},L=!1,k=!1,y="undefined"!=typeof wpslSettings?wpslSettings.autoLoad:"",x={},I={enabled:void 0!==wpslSettings.collectStatistics,address_components:""};function M(e,t){W(e,0,"",!0,t),A(e,L,y,t)}function N(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function E(t,s){if(navigator.geolocation){var o,n,l=Number(wpslSettings.geoLocationTimeout);o=setInterval(function(){e(".wpsl-icon-direction").toggleClass("wpsl-active-icon")},600),n=setTimeout(function(){R(o),M(t,s)},l),navigator.geolocation.getCurrentPosition(function(l){R(o),clearTimeout(n),q(!1),T(t,l,L,s),e(".wpsl-search").addClass("wpsl-geolocation-run")},function(o){if(e(".wpsl-icon-direction").hasClass("wpsl-user-activated")&&!e(".wpsl-search").hasClass("wpsl-geolocation-run")){switch(o.code){case o.PERMISSION_DENIED:alert(wpslGeolocationErrors.denied);break;case o.POSITION_UNAVAILABLE:alert(wpslGeolocationErrors.unavailable);break;case o.TIMEOUT:alert(wpslGeolocationErrors.timeout);break;default:alert(wpslGeolocationErrors.generalError)}e(".wpsl-icon-direction").removeClass("wpsl-active-icon")}else e(".wpsl-search").hasClass("wpsl-geolocation-run")||(clearTimeout(n),M(t,s))},{maximumAge:6e4,timeout:l,enableHighAccuracy:!0})}else alert(wpslGeolocationErrors.unavailable),M(t,s)}function R(t){clearInterval(t),e(".wpsl-icon-direction").removeClass("wpsl-active-icon")}function T(e,t,o,n){if(void 0===t)M(e,n);else{var l=new google.maps.LatLng(t.coords.latitude,t.coords.longitude);x={position:t,newRequest:!0},s.setCenter(l),W(l,0,"",!0,n),A(l,o,y,n)}}function P(){void 0!==wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&void 0!==f[0]&&f[0].close()}function O(){void 0!==p&&""!==p&&(p.setMap(null),p="")}function U(t){var l,i,a,d,c;for(P(),c=t.parents("li").length>0?t.parents("li").data("store-id"):t.parents(".wpsl-info-window").data("store-id"),void 0!==p&&""!==p&&(i=p.getPosition()),b={centerLatlng:s.getCenter(),zoomLevel:s.getZoom()},l=0,d=h.length;l<d;l++)0!=h[l].storeId||void 0!==i&&""!==i?h[l].storeId==c&&(a=h[l].getPosition()):i=h[l].getPosition();i&&a?(e("#wpsl-direction-details ul").empty(),e(".wpsl-direction-before, .wpsl-direction-after").remove(),function(t,l){var i,a,d,c,w,g,u,m,f,v="";u="km"==wpslSettings.distanceUnit?"METRIC":"IMPERIAL";f={origin:t,destination:l,travelMode:wpslSettings.directionsTravelMode,unitSystem:google.maps.UnitSystem[u]},n.route(f,function(t,n){if(n==google.maps.DirectionsStatus.OK){if(o.setMap(s),o.setDirections(t),t.routes.length>0){for(c=t.routes[0],w=0;w<c.legs.length;w++)for(i=c.legs[w],g=0,a=i.steps.length;g<a;g++)d=i.steps[g],v=v+"<li><div class='wpsl-direction-index'>"+(g+1)+"</div><div class='wpsl-direction-txt'>"+d.instructions+"</div><div class='wpsl-direction-distance'>"+d.distance.text+"</div></li>";for(e("#wpsl-direction-details ul").append(v).before("<div class='wpsl-direction-before'><a class='wpsl-back' id='wpsl-direction-start' href='#'>"+wpslLabels.back+"</a><div><span class='wpsl-total-distance'>"+c.legs[0].distance.text+"</span> - <span class='wpsl-total-durations'>"+c.legs[0].duration.text+"</span></div></div>").after("<p class='wpsl-direction-after'>"+t.routes[0].copyrights+"</p>"),e("#wpsl-direction-details").show(),w=0,a=h.length;w<a;w++)h[w].setMap(null);r&&r.clearMarkers(),void 0!==p&&""!==p&&p.setMap(null),e("#wpsl-stores").hide(),1==wpslSettings.templateId&&(m=e("#wpsl-gmap").offset(),e(window).scrollTop(m.top))}}else!function(e){var t;switch(e){case"NOT_FOUND":case"ZERO_RESULTS":t=wpslLabels.noDirectionsFound;break;case"OVER_QUERY_LIMIT":t=wpslLabels.queryLimit;break;default:t=wpslLabels.generalError}alert(t)}(n)})}(i,a)):alert(wpslLabels.generalError)}function z(e,t){var s,o,n;for(s=0,o=h.length;s<o;s++)h[s].storeId==e&&(n=h[s],"start"==t?n.setAnimation(google.maps.Animation.BOUNCE):n.setAnimation(null))}function Z(e,t){W(e,0,"",!0,t),A(e,L,!1,t)}function B(s,o){t.geocode({latLng:s},function(t,s){if(s==google.maps.GeocoderStatus.OK){if(1==wpslSettings.autoLocate&&x.newRequest){var n=function(e){var t,s,o,n=e[0].address_components.length;for(o=0;o<n;o++)s=e[0].address_components[o].types,(/^postal_code$/.test(s)||/^postal_code,postal_code_prefix$/.test(s))&&(t=e[0].address_components[o].long_name);return t}(t);""!==n&&e("#wpsl-search-input").val(n),x.newRequest=!1}wpslSettings.directionRedirect&&(d=t[0].formatted_address),I.enabled&&(I.address_components=t[0].address_components),o()}else K(s)})}function A(e,t,s,o){1==wpslSettings.directionRedirect||I.enabled?B(e,function(){$(e,t,s,o)}):$(e,t,s,o)}function $(t,o,n,l){var i,a,r="",p=e("#wpsl-listing-template").html(),d=e("#wpsl-stores ul"),c=wpslSettings.url+"img/ajax-loader.gif";a=function(t,s,o){var n,l,i,a,r,p="",d=e("#wpsl-wrap").hasClass("wpsl-mobile"),c=e("#wpsl-wrap").hasClass("wpsl-default-filters"),w={action:"store_search",lat:t.lat(),lng:t.lng()};s?(w.max_results=wpslSettings.maxResults,w.search_radius=wpslSettings.searchRadius):(d||c?(n=parseInt(e("#wpsl-results .wpsl-dropdown").val()),l=parseInt(e("#wpsl-radius .wpsl-dropdown").val())):(n=parseInt(e("#wpsl-results .wpsl-selected-item").attr("data-value")),l=parseInt(e("#wpsl-radius .wpsl-selected-item").attr("data-value"))),isNaN(n)?w.max_results=wpslSettings.maxResults:w.max_results=n,isNaN(l)?w.search_radius=wpslSettings.searchRadius:w.search_radius=l,void 0!==wpslSettings.categoryIds?w.filter=wpslSettings.categoryIds:e("#wpsl-category").length>0?(p=d||c?parseInt(e("#wpsl-category .wpsl-dropdown").val()):parseInt(e("#wpsl-category .wpsl-selected-item").attr("data-value")),isNaN(p)||0===p||(w.filter=p)):e("#wpsl-checkbox-filter").length>0&&e("#wpsl-checkbox-filter input:checked").length>0&&(w.filter=e("#wpsl-checkbox-filter input:checked").map(function(){return e(this).val()}).get().join(",")),e(".wpsl-custom-dropdown").length>0&&e(".wpsl-custom-dropdown").each(function(t){i="",a="",d||c?(i=e(this).attr("name"),a=e(this).val()):(i=e(this).attr("name"),a=e(this).next(".wpsl-selected-item").attr("data-value")),i&&a&&(w[i]=a)}),e(".wpsl-custom-checkboxes").length>0&&e(".wpsl-custom-checkboxes").each(function(t){var s,o;(r=e(this).attr("data-name"))&&(w[r]=(s=e("[data-name="+r+"]"),o=[],e(s).find("input:checked").each(function(t){o.push(e(this).val())}),o.join()))}));1==o&&(void 0!==x.position?w.skip_cache=1:(w.autoload=1,void 0!==wpslSettings.categoryIds&&(w.filter=wpslSettings.categoryIds)));I.enabled&&0==o&&(w.search=e("#wpsl-search-input").val(),w.statistics=I.address_components);return w}(t,o,n),d.empty().append("<li class='wpsl-preloader'><img src='"+c+"'/>"+wpslLabels.preloader+"</li>"),e("#wpsl-wrap").removeClass("wpsl-no-results"),e.get(wpslSettings.ajaxurl,a,function(o){e(".wpsl-preloader, .no-results").remove(),o.length>0&&void 0===o.addon?(e.each(o,function(e){_.extend(o[e],G),W(new google.maps.LatLng(o[e].lat,o[e].lng),o[e].id,o[e],!1,l),r+=_.template(p)(o[e])}),e("#wpsl-result-list").off("click",".wpsl-directions"),d.empty(),d.append(r),e("#wpsl-result-list").on("click",".wpsl-directions",function(){if(1!=wpslSettings.directionRedirect)return U(e(this)),!1}),V(),e("#wpsl-result-list p:empty").remove()):(W(t,0,"",!0,l),i=function(){var e;e=void 0!==wpslSettings.noResults&&""!==wpslSettings.noResults?wpslSettings.noResults:wpslLabels.noResults;return e}(),e("#wpsl-wrap").addClass("wpsl-no-results"),d.html("<li class='wpsl-no-results-msg'>"+i+"</li>")),1==wpslSettings.runFitBounds?F():(s.setZoom(Number(wpslSettings.zoomLevel)),s.setCenter(h[0].position)),1==wpslSettings.resetMap&&(e.isEmptyObject(C)&&google.maps.event.addListenerOnce(s,"tilesloaded",function(){C={centerLatlng:s.getCenter(),zoomLevel:s.getZoom()},e("#wpsl-map-controls").addClass("wpsl-reset-exists"),e(".wpsl-icon-reset, #wpsl-reset-map").show()}),e(".wpsl-icon-reset").removeClass("wpsl-in-progress"))}),1!=wpslSettings.mouseFocus||N()||e("#wpsl-search-input").focus()}function V(){if(1==wpslSettings.markerClusters){var e,t=Number(wpslSettings.clusterZoom),o=Number(wpslSettings.clusterSize);isNaN(t)&&(t=""),isNaN(o)&&(o=""),void 0!==wpslSettings.excludeStartFromCluster&&1==wpslSettings.excludeStartFromCluster&&(e=h.slice(0)).splice(0,1),r=new MarkerClusterer(s,void 0===e?h:e,{gridSize:o,maxZoom:t})}}function W(t,o,n,l,i){var a,r,p,d;0===o?(n={store:wpslLabels.startPoint},a=S.url+wpslSettings.startMarker):a=void 0!==n.alternateMarkerUrl&&n.alternateMarkerUrl?n.alternateMarkerUrl:void 0!==n.categoryMarkerUrl&&n.categoryMarkerUrl?n.categoryMarkerUrl:S.url+wpslSettings.storeMarker,r={url:a,scaledSize:new google.maps.Size(Number(S.scaledSize[0]),Number(S.scaledSize[1])),origin:new google.maps.Point(Number(S.origin[0]),Number(S.origin[1])),anchor:new google.maps.Point(Number(S.anchor[0]),Number(S.anchor[1]))},p=new google.maps.Marker({position:t,map:s,optimized:!1,title:function(e){if(e)return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(t)})}(n.store),draggable:l,storeId:o,icon:r}),h.push(p),google.maps.event.addListener(p,"click",(d=s,function(){var s,l;0!=o?void 0!==wpslSettings.markerStreetView&&1==wpslSettings.markerStreetView?(s=t,l=function(){D(p,H(n),i,d)},(new google.maps.StreetViewService).getPanoramaByLocation(s,50,function(e,t){k=t==google.maps.StreetViewStatus.OK,l()})):D(p,H(n),i,d):D(p,wpslLabels.startPoint,i,d),google.maps.event.clearListeners(i,"domready"),google.maps.event.addListener(i,"domready",function(){var t,s;t=p,s=d,e(".wpsl-info-actions a").on("click",function(o){var n,l,i,a,r,p=Number(wpslSettings.autoZoomLevel);if(o.stopImmediatePropagation(),e(this).hasClass("wpsl-directions")){if(1==wpslSettings.directionRedirect)return!0;U(e(this))}else e(this).hasClass("wpsl-streetview")?(n=t,(i=(l=s).getStreetView()).setPosition(n.getPosition()),i.setVisible(!0),e("#wpsl-map-controls").hide(),a=i,r=l,google.maps.event.addListener(a,"visible_changed",function(){if(!a.getVisible()){var t=r.getZoom();e("#wpsl-map-controls").show(),r.setZoom(t-1),r.setZoom(t)}})):e(this).hasClass("wpsl-zoom-here")&&(s.setCenter(t.getPosition()),s.setZoom(p));return!1}),j()})})),l&&google.maps.event.addListener(p,"dragend",function(e){q(!0),s.setCenter(e.latLng),B(e.latLng),A(e.latLng,L,y=!1,i)})}(_.templateSettings={evaluate:/\<\%(.+?)\%\>/g,interpolate:/\<\%=(.+?)\%\>/g,escape:/\<\%-(.+?)\%\>/g},e(".wpsl-gmap-canvas").length&&(e("<img />").attr("src",wpslSettings.url+"img/ajax-loader.gif"),e(".wpsl-gmap-canvas").each(function(i){!function(i,p){var d,c,w,g,u,m,f,h,b=Number(wpslSettings.zoomLevel),k=Number(wpslSettings.autoZoomLevel);w=function(e){var t,s,o,n,l,i,a,r=["zoomLevel","mapType","mapTypeControl","mapStyle","streetView","scrollWheel","controlPosition"],p={zoomLevel:wpslSettings.zoomLevel,mapType:wpslSettings.mapType,mapTypeControl:wpslSettings.mapTypeControl,mapStyle:wpslSettings.mapStyle,streetView:wpslSettings.streetView,scrollWheel:wpslSettings.scrollWheel,controlPosition:wpslSettings.controlPosition,gestureHandling:wpslSettings.gestureHandling};if(void 0!==window["wpslMap_"+e]&&void 0!==window["wpslMap_"+e].shortCode)for(t=0,s=r.length;t<s;t++)void 0!==(o=window["wpslMap_"+e].shortCode[r[t]])&&(p[r[t]]=o);return p.startLatLng=(n=e,a="",void 0!==window["wpslMap_"+n]&&void 0!==window["wpslMap_"+n].locations&&(a=window["wpslMap_"+n].locations[0]),void 0!==a&&void 0!==a.lat&&void 0!==a.lng?l=new google.maps.LatLng(a.lat,a.lng):""!==wpslSettings.startLatlng?(i=wpslSettings.startLatlng.split(","),l=new google.maps.LatLng(i[0],i[1])):l=new google.maps.LatLng(0,0),l),p}(p),(h=Number(w.zoomLevel))!==b&&(k=h);B={},void 0!==wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle?(U=wpslSettings.infoBoxClearance.split(","),z=wpslSettings.infoBoxPixelOffset.split(","),B={alignBottom:!0,boxClass:wpslSettings.infoBoxClass,closeBoxMargin:wpslSettings.infoBoxCloseMargin,closeBoxURL:wpslSettings.infoBoxCloseUrl,content:"",disableAutoPan:!!Number(wpslSettings.infoBoxDisableAutoPan),enableEventPropagation:!!Number(wpslSettings.infoBoxEnableEventPropagation),infoBoxClearance:new google.maps.Size(Number(U[0]),Number(U[1])),pixelOffset:new google.maps.Size(Number(z[0]),Number(z[1])),zIndex:Number(wpslSettings.infoBoxZindex)},a=new InfoBox(B)):a=new google.maps.InfoWindow,g=a,t=new google.maps.Geocoder,o=new google.maps.DirectionsRenderer,n=new google.maps.DirectionsService,d={zoom:h,center:w.startLatLng,mapTypeId:google.maps.MapTypeId[w.mapType.toUpperCase()],mapTypeControl:!!Number(w.mapTypeControl),scrollwheel:!!Number(w.scrollWheel),streetViewControl:!!Number(w.streetView),gestureHandling:w.gestureHandling,zoomControlOptions:{position:google.maps.ControlPosition[w.controlPosition.toUpperCase()+"_TOP"]}},S=function(){var e,t=wpslSettings.markerIconProps,s={};void 0!==t.url?s.url=t.url:void 0!==t.categoryMarkerUrl?s.categoryMarkerUrl=t.categoryMarkerUrl:void 0!==t.alternateMarkerUrl?s.alternateMarkerUrl=t.alternateMarkerUrl:s.url=wpslSettings.url+"img/markers/";for(var o in t)t.hasOwnProperty(o)&&2==(e=t[o].split(",")).length&&(s[o]=e);return s}(),s=new google.maps.Map(document.getElementById(i),d),R=w.mapStyle,(R=function(e){try{var t=JSON.parse(e);if(t&&"object"==typeof t&&null!==t)return t}catch(e){}return!1}(R))&&s.setOptions({styles:R}),void 0!==window["wpslMap_"+p]&&void 0!==window["wpslMap_"+p].locations&&(m=new google.maps.LatLngBounds,f=window["wpslMap_"+p].locations,e.each(f,function(e){W(u=new google.maps.LatLng(f[e].lat,f[e].lng),f[e].id,f[e],!1,g),m.extend(u)}),f.length>1&&(J(s,k),s.fitBounds(m)),_.isArray(wpslSettings.mapTabAnchor)&&(c={map:s,bounds:m,maxZoom:k},v.push(c)));var R;var U,z,B;e("#wpsl-gmap").length&&(1==wpslSettings.autoComplete&&function(){var t,s,o,n={};void 0===wpslSettings.geocodeComponents||e.isEmptyObject(wpslSettings.geocodeComponents)||(n.componentRestrictions=wpslSettings.geocodeComponents);t=document.getElementById("wpsl-search-input"),(s=new google.maps.places.Autocomplete(t,n)).addListener("place_changed",function(){(o=s.getPlace()).geometry&&(l=o.geometry.location)})}(),!N()&&e(".wpsl-dropdown").length&&1==wpslSettings.enableStyledDropdowns?(G=Number(wpslSettings.maxDropdownHeight),e(".wpsl-dropdown").each(function(t){var s,o,n=e(this);n.$dropdownWrap=n.wrap("<div class='wpsl-dropdown'></div>").parent(),n.$selectedVal=n.val(),n.$dropdownElem=e("<div><ul/></div>").appendTo(n.$dropdownWrap),n.$dropdown=n.$dropdownElem.find("ul"),n.$options=n.$dropdownWrap.find("option"),n.hide().removeClass("wpsl-dropdown"),e.each(n.$options,function(){s=e(this).val()==n.$selectedVal?'class="wpsl-selected-dropdown"':"",n.$dropdown.append("<li data-value="+e(this).val()+" "+s+">"+e(this).text()+"</li>")}),n.$dropdownElem.before("<span data-value="+n.find(":selected").val()+" class='wpsl-selected-item'>"+n.find(":selected").text()+"</span>"),n.$dropdownItem=n.$dropdownElem.find("li"),n.$dropdownWrap.on("click",function(t){e(this).hasClass("wpsl-active")?e(this).removeClass("wpsl-active"):(Q(),e(this).toggleClass("wpsl-active"),o=0,e(this).hasClass("wpsl-active")?(n.$dropdownItem.each(function(t){o+=e(this).outerHeight()}),n.$dropdownElem.css("height",o+2+"px")):n.$dropdownElem.css("height",0),o>G&&(e(this).addClass("wpsl-scroll-required"),n.$dropdownElem.css("height",G+"px")),t.stopPropagation())}),n.$dropdownItem.on("click",function(t){n.$dropdownWrap.find(e(".wpsl-selected-item")).html(e(this).text()).attr("data-value",e(this).attr("data-value")),n.$dropdownItem.removeClass("wpsl-selected-dropdown"),e(this).addClass("wpsl-selected-dropdown"),Q(),t.stopPropagation()})}),e(document).click(function(){Q()})):(e("#wpsl-search-wrap select").show(),N()?e("#wpsl-wrap").addClass("wpsl-mobile"):e("#wpsl-wrap").addClass("wpsl-default-filters")),e(".wpsl-search").hasClass("wpsl-widget")||(1==wpslSettings.autoLocate?E(w.startLatLng,g):1==wpslSettings.autoLoad&&M(w.startLatLng,g)),1!=wpslSettings.mouseFocus||N()||e("#wpsl-search-input").focus(),D=g,e("#wpsl-search-btn").unbind("click").bind("click",function(s){return e("#wpsl-search-input").removeClass(),e("#wpsl-search-input").val()?(e("#wpsl-result-list ul").empty(),e("#wpsl-stores").show(),e(".wpsl-direction-before, .wpsl-direction-after").remove(),e("#wpsl-direction-details").hide(),L=!1,P(),q(!1),O(),1==wpslSettings.autoComplete&&void 0!==l?Z(l,D):(o=D,n={address:e("#wpsl-search-input").val()},void 0===wpslSettings.geocodeComponents||e.isEmptyObject(wpslSettings.geocodeComponents)||(n.componentRestrictions=wpslSettings.geocodeComponents),t.geocode(n,function(e,t){t==google.maps.GeocoderStatus.OK?(I.enabled&&(I.address_components=e[0].address_components),Z(e[0].geometry.location,o)):K(t)}))):e("#wpsl-search-input").addClass("wpsl-error").focus(),!1;var o,n}),A=w,$=s,V=g,google.maps.event.addListenerOnce($,"tilesloaded",function(){var t,o;e(".gm-style").append(wpslSettings.mapControls),e(".wpsl-icon-reset, #wpsl-reset-map").length>0&&(t=A.startLatLng,o=V,e(".wpsl-icon-reset, #wpsl-reset-map").on("click",function(){e(this).hasClass("wpsl-in-progress")||(1==wpslSettings.autoLoad&&(y=1),s.getCenter().lat()===C.centerLatlng.lat()&&s.getCenter().lng()===C.centerLatlng.lng()&&s.getZoom()===C.zoomLevel||(q(!1),e("#wpsl-search-input").val("").removeClass(),e(".wpsl-icon-reset").addClass("wpsl-in-progress"),r&&r.clearMarkers(),O(),function(){var t,s,o,n,l,i,a,r,p=e("#wpsl-wrap").hasClass("wpsl-default-filters"),d=[wpslSettings.searchRadius+" "+wpslSettings.distanceUnit,wpslSettings.maxResults],c=["wpsl-radius","wpsl-results"];for(t=0,s=c.length;t<s;t++)e("#"+c[t]+" select").val(parseInt(d[t])),e("#"+c[t]+" li").removeClass(),"wpsl-radius"==c[t]?o=wpslSettings.searchRadius:"wpsl-results"==c[t]&&(o=wpslSettings.maxResults),e("#"+c[t]+" li").each(function(){e(this).text()===d[t]&&(e(this).addClass("wpsl-selected-dropdown"),e("#"+c[t]+" .wpsl-selected-item").html(d[t]).attr("data-value",o))});e("#wpsl-category").length&&(e("#wpsl-category select").val(0),e("#wpsl-category li").removeClass(),e("#wpsl-category li:first-child").addClass("wpsl-selected-dropdown"),n=e("#wpsl-category li:first-child").text(),e("#wpsl-category .wpsl-selected-item").html(n).attr("data-value",0)),e(".wpsl-custom-dropdown").length>0&&e(".wpsl-custom-dropdown").each(function(t){p?e(this).find("option").removeAttr("selected"):(l=e(this).siblings("div"),i=l.find("li:first-child"),a=i.text(),r=i.attr("data-value"),l.find("li").removeClass(),l.prev().html(a).attr("data-value",r))})}(),1==wpslSettings.autoLocate?T(t,x.position,!0,o):M(t,o)),e("#wpsl-stores").show(),e("#wpsl-direction-details").hide())}),e(".wpsl-icon-reset").hide()),e(".wpsl-icon-direction").on("click",function(){e(this).addClass("wpsl-user-activated"),E(A.startLatLng,V)})}),e(".wpsl-search").hasClass("wpsl-widget")&&(e("#wpsl-search-btn").trigger("click"),e(".wpsl-search").removeClass("wpsl-widget")));var A,$,V;var D;var G;void 0!==wpslSettings.markerZoomTo&&1==wpslSettings.markerZoomTo&&google.maps.event.addListener(s,"zoom_changed",function(){j()})}(e(this).attr("id"),i)}),function(){var t,o;if(_.isArray(wpslSettings.mapTabAnchor))for(t=0,o=v.length;t<o;t++)Y(v[t],wpslSettings.mapTabAnchor[t],t);else e("a[href='#"+wpslSettings.mapTabAnchor+"']").length&&Y(s,wpslSettings.mapTabAnchor)}()),e("#wpsl-result-list").on("click",".wpsl-back",function(){var t,n;for(o.setMap(null),t=0,n=h.length;t<n;t++)h[t].setMap(s);return void 0!==p&&""!==p&&p.setMap(s),r&&V(),s.setCenter(b.centerLatlng),s.setZoom(b.zoomLevel),e(".wpsl-direction-before, .wpsl-direction-after").remove(),e("#wpsl-stores").show(),e("#wpsl-direction-details").hide(),!1}),e("#wpsl-gmap").length&&("bounce"==wpslSettings.markerEffect?(e("#wpsl-stores").on("mouseenter","li",function(){z(e(this).data("store-id"),"start")}),e("#wpsl-stores").on("mouseleave","li",function(){z(e(this).data("store-id"),"stop")})):"info_window"==wpslSettings.markerEffect&&e("#wpsl-stores").on("mouseenter","li",function(){var t,o;for(t=0,o=h.length;t<o;t++)h[t].storeId==e(this).data("store-id")&&(google.maps.event.trigger(h[t],"click"),s.setCenter(h[t].position))})),void 0!==wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters)&&google.maps.event.addListener(s,"zoom_changed",function(){google.maps.event.addListenerOnce(s,"idle",function(){if(void 0!==r&&(c=r.clusters_).length)for(u=0,w=c.length;u<w;u++)for(m=0,g=c[u].markers_.length;m<g;m++)if(c[u].markers_[m].storeId==i){a.getVisible()&&null===c[u].markers_[m].map?a.setVisible(!1):a.getVisible()||null===c[u].markers_[m].map||a.setVisible(!0);break}})});function D(e,t,s,o){f.length=0,s.setContent(t),s.open(o,e),f.push(s),void 0!==wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters&&(i=e.storeId,s.setVisible(!0))}function j(){s.getZoom()>=wpslSettings.autoZoomLevel?e(".wpsl-zoom-here").hide():e(".wpsl-zoom-here").show()}var G={formatPhoneNumber:function(e){return(1==wpslSettings.phoneUrl&&N()||1==wpslSettings.clickableDetails)&&(e="<a href='tel:"+G.formatClickablePhoneNumber(e)+"'>"+e+"</a>"),e},formatClickablePhoneNumber:function(e){return-1!=e.indexOf("+")&&-1!=e.indexOf("(0)")&&(e=e.replace("(0)","")),e.replace(/(-| |\(|\)|\.|)/g,"")},formatEmail:function(e){return 1==wpslSettings.clickableDetails&&(e="<a href='mailto:"+e+"'>"+e+"</a>"),e},createInfoWindowActions:function(t){var s,o="",n="";return e("#wpsl-gmap").length&&(k&&(o="<a class='wpsl-streetview' href='#'>"+wpslLabels.streetView+"</a>"),1==wpslSettings.markerZoomTo&&(n="<a class='wpsl-zoom-here' href='#'>"+wpslLabels.zoomHere+"</a>"),s="<div class='wpsl-info-actions'>"+G.createDirectionUrl(t)+o+n+"</div>"),s},createDirectionUrl:function(t){var s,o,n={};return 1==wpslSettings.directionRedirect?(void 0===d&&(d=""),n.target="target='_blank'",void 0!==t?n.src=e("[data-store-id="+t+"] .wpsl-directions").attr("href"):(o=this.zip?this.zip+", ":"",s=this.address+", "+this.city+", "+o+this.country,n.src="https://www.google.com/maps/dir/?api=1&origin="+G.rfc3986EncodeURIComponent(d)+"&destination="+G.rfc3986EncodeURIComponent(s)+"&travelmode="+wpslSettings.directionsTravelMode.toLowerCase())):n={src:"#",target:""},"<a class='wpsl-directions' "+n.target+" href='"+n.src+"'>"+wpslLabels.directions+"</a>"},rfc3986EncodeURIComponent:function(e){return encodeURIComponent(e).replace(/[!'()*]/g,escape)}};function H(t){var s;return s=e("#wpsl-base-gmap_0").length?e("#wpsl-cpt-info-window-template").html():e("#wpsl-info-window-template").html(),_.template(s)(t)}function F(){var e,t,o=Number(wpslSettings.autoZoomLevel),n=new google.maps.LatLngBounds;for(J(s,o),e=0,t=h.length;e<t;e++)n.extend(h[e].position);s.fitBounds(n)}function q(e){var t,s;if(o.setMap(null),h){for(s=0,t=h.length;s<t;s++)e?1!=h[s].draggable?h[s].setMap(null):p=h[s]:h[s].setMap(null);h.length=0}r&&r.clearMarkers()}function K(e){var t;switch(e){case"ZERO_RESULTS":t=wpslLabels.noResults;break;case"OVER_QUERY_LIMIT":t=wpslLabels.queryLimit;break;default:t=wpslLabels.generalError}alert(t)}function Q(){e(".wpsl-dropdown").removeClass("wpsl-active"),e(".wpsl-dropdown div").css("height",0)}function Y(t,s,o){var n,l,i,a,r,p=!!Number(wpslSettings.mapTabAnchorReturn),d=e("a[href='#"+s+"']");i=void 0!==t.maxZoom?t.maxZoom:Number(wpslSettings.autoZoomLevel),void 0!==o&&0==o&&d.addClass("wpsl-fitbounds"),d.on("click",function(){return setTimeout(function(){void 0!==t.map?(a=t.bounds,r=t.map):r=t,n=r.getZoom(),l=r.getCenter(),google.maps.event.trigger(r,"resize"),d.hasClass("wpsl-fitbounds")||(J(r,i),r.setZoom(n),r.setCenter(l),void 0!==a?r.fitBounds(a):F(),d.addClass("wpsl-fitbounds"))},50),p})}function J(e,t){google.maps.event.addListenerOnce(e,"bounds_changed",function(){google.maps.event.addListenerOnce(e,"idle",function(){this.getZoom()>t&&this.setZoom(t)})})}e("#wpsl-stores").on("click",".wpsl-store-details",function(){var t,s,o=e(this).parents("li"),n=o.data("store-id");if("info window"==wpslSettings.moreInfoLocation)for(t=0,s=h.length;t<s;t++)h[t].storeId==n&&google.maps.event.trigger(h[t],"click");else o.find(".wpsl-more-info-listings").is(":visible")?e(this).removeClass("wpsl-active-details"):e(this).addClass("wpsl-active-details"),o.siblings().find(".wpsl-store-details").removeClass("wpsl-active-details"),o.siblings().find(".wpsl-more-info-listings").hide(),o.find(".wpsl-more-info-listings").toggle();if("default"!=wpslSettings.templateId||"store listings"==wpslSettings.moreInfoLocation)return!1})});
1
+ jQuery(document).ready(function(e){var t,s,o,n,l,i,a,r,p,d,c,w,g,u,m,f=[],h=[],v=[],S={},b={},C={},L=!1,k=!1,y="undefined"!=typeof wpslSettings?wpslSettings.autoLoad:"",x={},I={enabled:void 0!==wpslSettings.collectStatistics,address_components:""};function M(e,t){W(e,0,"",!0,t),A(e,L,y,t)}function N(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function E(t,s){if(navigator.geolocation){var o,n,l=Number(wpslSettings.geoLocationTimeout);o=setInterval(function(){e(".wpsl-icon-direction").toggleClass("wpsl-active-icon")},600),n=setTimeout(function(){R(o),M(t,s)},l),navigator.geolocation.getCurrentPosition(function(l){R(o),clearTimeout(n),q(!1),T(t,l,L,s),e(".wpsl-search").addClass("wpsl-geolocation-run")},function(o){if(e(".wpsl-icon-direction").hasClass("wpsl-user-activated")&&!e(".wpsl-search").hasClass("wpsl-geolocation-run")){switch(o.code){case o.PERMISSION_DENIED:alert(wpslGeolocationErrors.denied);break;case o.POSITION_UNAVAILABLE:alert(wpslGeolocationErrors.unavailable);break;case o.TIMEOUT:alert(wpslGeolocationErrors.timeout);break;default:alert(wpslGeolocationErrors.generalError)}e(".wpsl-icon-direction").removeClass("wpsl-active-icon")}else e(".wpsl-search").hasClass("wpsl-geolocation-run")||(clearTimeout(n),M(t,s))},{maximumAge:6e4,timeout:l,enableHighAccuracy:!0})}else alert(wpslGeolocationErrors.unavailable),M(t,s)}function R(t){clearInterval(t),e(".wpsl-icon-direction").removeClass("wpsl-active-icon")}function T(e,t,o,n){if(void 0===t)M(e,n);else{var l=new google.maps.LatLng(t.coords.latitude,t.coords.longitude);x={position:t,newRequest:!0},s.setCenter(l),W(l,0,"",!0,n),A(l,o,y,n)}}function P(){void 0!==wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&void 0!==f[0]&&f[0].close()}function O(){void 0!==p&&""!==p&&(p.setMap(null),p="")}function U(t){var l,i,a,d,c;for(P(),c=t.parents("li").length>0?t.parents("li").data("store-id"):t.parents(".wpsl-info-window").data("store-id"),void 0!==p&&""!==p&&(i=p.getPosition()),b={centerLatlng:s.getCenter(),zoomLevel:s.getZoom()},l=0,d=h.length;l<d;l++)0!=h[l].storeId||void 0!==i&&""!==i?h[l].storeId==c&&(a=h[l].getPosition()):i=h[l].getPosition();i&&a?(e("#wpsl-direction-details ul").empty(),e(".wpsl-direction-before, .wpsl-direction-after").remove(),function(t,l){var i,a,d,c,w,g,u,m,f,v="";u="km"==wpslSettings.distanceUnit?"METRIC":"IMPERIAL";f={origin:t,destination:l,travelMode:wpslSettings.directionsTravelMode,unitSystem:google.maps.UnitSystem[u]},n.route(f,function(t,n){if(n==google.maps.DirectionsStatus.OK){if(o.setMap(s),o.setDirections(t),t.routes.length>0){for(c=t.routes[0],w=0;w<c.legs.length;w++)for(i=c.legs[w],g=0,a=i.steps.length;g<a;g++)d=i.steps[g],v=v+"<li><div class='wpsl-direction-index'>"+(g+1)+"</div><div class='wpsl-direction-txt'>"+d.instructions+"</div><div class='wpsl-direction-distance'>"+d.distance.text+"</div></li>";for(e("#wpsl-direction-details ul").append(v).before("<div class='wpsl-direction-before'><a class='wpsl-back' id='wpsl-direction-start' href='#'>"+wpslLabels.back+"</a><div><span class='wpsl-total-distance'>"+c.legs[0].distance.text+"</span> - <span class='wpsl-total-durations'>"+c.legs[0].duration.text+"</span></div></div>").after("<p class='wpsl-direction-after'>"+t.routes[0].copyrights+"</p>"),e("#wpsl-direction-details").show(),w=0,a=h.length;w<a;w++)h[w].setMap(null);r&&r.clearMarkers(),void 0!==p&&""!==p&&p.setMap(null),e("#wpsl-stores").hide(),1==wpslSettings.templateId&&(m=e("#wpsl-gmap").offset(),e(window).scrollTop(m.top))}}else!function(e){var t;switch(e){case"NOT_FOUND":case"ZERO_RESULTS":t=wpslLabels.noDirectionsFound;break;case"OVER_QUERY_LIMIT":t=wpslLabels.queryLimit;break;default:t=wpslLabels.generalError}alert(t)}(n)})}(i,a)):alert(wpslLabels.generalError)}function z(e,t){var s,o,n;for(s=0,o=h.length;s<o;s++)h[s].storeId==e&&(n=h[s],"start"==t?n.setAnimation(google.maps.Animation.BOUNCE):n.setAnimation(null))}function Z(e,t){W(e,0,"",!0,t),A(e,L,!1,t)}function B(s,o){var n=s.lat().toFixed(5),l=s.lng().toFixed(5);s.lat=function(){return parseFloat(n)},s.lng=function(){return parseFloat(l)},t.geocode({latLng:s},function(t,s){if(s==google.maps.GeocoderStatus.OK){if(1==wpslSettings.autoLocate&&x.newRequest){var n=function(e){var t,s,o,n=e[0].address_components.length;for(o=0;o<n;o++)s=e[0].address_components[o].types,(/^postal_code$/.test(s)||/^postal_code,postal_code_prefix$/.test(s))&&(t=e[0].address_components[o].long_name);return t}(t);""!==n&&e("#wpsl-search-input").val(n),x.newRequest=!1}wpslSettings.directionRedirect&&(d=t[0].formatted_address),I.enabled&&(I.address_components=t[0].address_components),o()}else K(s)})}function A(e,t,s,o){1==wpslSettings.directionRedirect||I.enabled?B(e,function(){$(e,t,s,o)}):$(e,t,s,o)}function $(t,o,n,l){var i,a,r="",p=e("#wpsl-listing-template").html(),d=e("#wpsl-stores ul"),c=wpslSettings.url+"img/ajax-loader.gif";a=function(t,s,o){var n,l,i,a,r,p="",d=e("#wpsl-wrap").hasClass("wpsl-mobile"),c=e("#wpsl-wrap").hasClass("wpsl-default-filters"),w={action:"store_search",lat:t.lat(),lng:t.lng()};s?(w.max_results=wpslSettings.maxResults,w.search_radius=wpslSettings.searchRadius):(d||c?(n=parseInt(e("#wpsl-results .wpsl-dropdown").val()),l=parseInt(e("#wpsl-radius .wpsl-dropdown").val())):(n=parseInt(e("#wpsl-results .wpsl-selected-item").attr("data-value")),l=parseInt(e("#wpsl-radius .wpsl-selected-item").attr("data-value"))),isNaN(n)?w.max_results=wpslSettings.maxResults:w.max_results=n,isNaN(l)?w.search_radius=wpslSettings.searchRadius:w.search_radius=l,void 0!==wpslSettings.categoryIds?w.filter=wpslSettings.categoryIds:e("#wpsl-category").length>0?(p=d||c?parseInt(e("#wpsl-category .wpsl-dropdown").val()):parseInt(e("#wpsl-category .wpsl-selected-item").attr("data-value")),isNaN(p)||0===p||(w.filter=p)):e("#wpsl-checkbox-filter").length>0&&e("#wpsl-checkbox-filter input:checked").length>0&&(w.filter=e("#wpsl-checkbox-filter input:checked").map(function(){return e(this).val()}).get().join(",")),e(".wpsl-custom-dropdown").length>0&&e(".wpsl-custom-dropdown").each(function(t){i="",a="",d||c?(i=e(this).attr("name"),a=e(this).val()):(i=e(this).attr("name"),a=e(this).next(".wpsl-selected-item").attr("data-value")),i&&a&&(w[i]=a)}),e(".wpsl-custom-checkboxes").length>0&&e(".wpsl-custom-checkboxes").each(function(t){var s,o;(r=e(this).attr("data-name"))&&(w[r]=(s=e("[data-name="+r+"]"),o=[],e(s).find("input:checked").each(function(t){o.push(e(this).val())}),o.join()))}));1==o&&(void 0!==x.position?w.skip_cache=1:(w.autoload=1,void 0!==wpslSettings.categoryIds&&(w.filter=wpslSettings.categoryIds)));I.enabled&&0==o&&(w.search=e("#wpsl-search-input").val(),w.statistics=I.address_components);return w}(t,o,n),d.empty().append("<li class='wpsl-preloader'><img src='"+c+"'/>"+wpslLabels.preloader+"</li>"),e("#wpsl-wrap").removeClass("wpsl-no-results"),e.get(wpslSettings.ajaxurl,a,function(o){e(".wpsl-preloader, .no-results").remove(),o.length>0&&void 0===o.addon?(e.each(o,function(e){_.extend(o[e],j),W(new google.maps.LatLng(o[e].lat,o[e].lng),o[e].id,o[e],!1,l),r+=_.template(p)(o[e])}),e("#wpsl-result-list").off("click",".wpsl-directions"),d.empty(),d.append(r),e("#wpsl-result-list").on("click",".wpsl-directions",function(){if(1!=wpslSettings.directionRedirect)return U(e(this)),!1}),V(),e("#wpsl-result-list p:empty").remove()):(W(t,0,"",!0,l),i=function(){var e;e=void 0!==wpslSettings.noResults&&""!==wpslSettings.noResults?wpslSettings.noResults:wpslLabels.noResults;return e}(),e("#wpsl-wrap").addClass("wpsl-no-results"),d.html("<li class='wpsl-no-results-msg'>"+i+"</li>")),1==wpslSettings.runFitBounds?H():(s.setZoom(Number(wpslSettings.zoomLevel)),s.setCenter(h[0].position)),1==wpslSettings.resetMap&&(e.isEmptyObject(C)&&google.maps.event.addListenerOnce(s,"tilesloaded",function(){C={centerLatlng:s.getCenter(),zoomLevel:s.getZoom()},e("#wpsl-map-controls").addClass("wpsl-reset-exists"),e(".wpsl-icon-reset, #wpsl-reset-map").show()}),e(".wpsl-icon-reset").removeClass("wpsl-in-progress"))}),1!=wpslSettings.mouseFocus||N()||e("#wpsl-search-input").focus()}function V(){if(1==wpslSettings.markerClusters){var e,t=Number(wpslSettings.clusterZoom),o=Number(wpslSettings.clusterSize);isNaN(t)&&(t=""),isNaN(o)&&(o=""),void 0!==wpslSettings.excludeStartFromCluster&&1==wpslSettings.excludeStartFromCluster&&(e=h.slice(0)).splice(0,1),r=new MarkerClusterer(s,void 0===e?h:e,{gridSize:o,maxZoom:t})}}function W(t,o,n,l,i){var a,r,p,d;0===o?(n={store:wpslLabels.startPoint},a=S.url+wpslSettings.startMarker):a=void 0!==n.alternateMarkerUrl&&n.alternateMarkerUrl?n.alternateMarkerUrl:void 0!==n.categoryMarkerUrl&&n.categoryMarkerUrl?n.categoryMarkerUrl:S.url+wpslSettings.storeMarker,r={url:a,scaledSize:new google.maps.Size(Number(S.scaledSize[0]),Number(S.scaledSize[1])),origin:new google.maps.Point(Number(S.origin[0]),Number(S.origin[1])),anchor:new google.maps.Point(Number(S.anchor[0]),Number(S.anchor[1]))},p=new google.maps.Marker({position:t,map:s,optimized:!1,title:function(e){if(e)return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(t)})}(n.store),draggable:l,storeId:o,icon:r}),h.push(p),google.maps.event.addListener(p,"click",(d=s,function(){var s,l;0!=o?void 0!==wpslSettings.markerStreetView&&1==wpslSettings.markerStreetView?(s=t,l=function(){D(p,G(n),i,d)},(new google.maps.StreetViewService).getPanoramaByLocation(s,50,function(e,t){k=t==google.maps.StreetViewStatus.OK,l()})):D(p,G(n),i,d):D(p,wpslLabels.startPoint,i,d),google.maps.event.clearListeners(i,"domready"),google.maps.event.addListener(i,"domready",function(){var t,s;t=p,s=d,e(".wpsl-info-actions a").on("click",function(o){var n,l,i,a,r,p=Number(wpslSettings.autoZoomLevel);if(o.stopImmediatePropagation(),e(this).hasClass("wpsl-directions")){if(1==wpslSettings.directionRedirect)return!0;U(e(this))}else e(this).hasClass("wpsl-streetview")?(n=t,(i=(l=s).getStreetView()).setPosition(n.getPosition()),i.setVisible(!0),e("#wpsl-map-controls").hide(),a=i,r=l,google.maps.event.addListener(a,"visible_changed",function(){if(!a.getVisible()){var t=r.getZoom();e("#wpsl-map-controls").show(),r.setZoom(t-1),r.setZoom(t)}})):e(this).hasClass("wpsl-zoom-here")&&(s.setCenter(t.getPosition()),s.setZoom(p));return!1}),F()})})),l&&google.maps.event.addListener(p,"dragend",function(e){q(!0),s.setCenter(e.latLng),B(e.latLng),A(e.latLng,L,y=!1,i)})}(_.templateSettings={evaluate:/\<\%(.+?)\%\>/g,interpolate:/\<\%=(.+?)\%\>/g,escape:/\<\%-(.+?)\%\>/g},e(".wpsl-gmap-canvas").length&&(e("<img />").attr("src",wpslSettings.url+"img/ajax-loader.gif"),e(".wpsl-gmap-canvas").each(function(i){!function(i,p){var d,c,w,g,u,m,f,h,b=Number(wpslSettings.zoomLevel),k=Number(wpslSettings.autoZoomLevel);w=function(e){var t,s,o,n,l,i,a,r=["zoomLevel","mapType","mapTypeControl","mapStyle","streetView","scrollWheel","controlPosition"],p={zoomLevel:wpslSettings.zoomLevel,mapType:wpslSettings.mapType,mapTypeControl:wpslSettings.mapTypeControl,mapStyle:wpslSettings.mapStyle,streetView:wpslSettings.streetView,scrollWheel:wpslSettings.scrollWheel,controlPosition:wpslSettings.controlPosition,gestureHandling:wpslSettings.gestureHandling};if(void 0!==window["wpslMap_"+e]&&void 0!==window["wpslMap_"+e].shortCode)for(t=0,s=r.length;t<s;t++)void 0!==(o=window["wpslMap_"+e].shortCode[r[t]])&&(p[r[t]]=o);return p.startLatLng=(n=e,a="",void 0!==window["wpslMap_"+n]&&void 0!==window["wpslMap_"+n].locations&&(a=window["wpslMap_"+n].locations[0]),void 0!==a&&void 0!==a.lat&&void 0!==a.lng?l=new google.maps.LatLng(a.lat,a.lng):""!==wpslSettings.startLatlng?(i=wpslSettings.startLatlng.split(","),l=new google.maps.LatLng(i[0],i[1])):l=new google.maps.LatLng(0,0),l),p}(p),(h=Number(w.zoomLevel))!==b&&(k=h);B={},void 0!==wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle?(U=wpslSettings.infoBoxClearance.split(","),z=wpslSettings.infoBoxPixelOffset.split(","),B={alignBottom:!0,boxClass:wpslSettings.infoBoxClass,closeBoxMargin:wpslSettings.infoBoxCloseMargin,closeBoxURL:wpslSettings.infoBoxCloseUrl,content:"",disableAutoPan:!!Number(wpslSettings.infoBoxDisableAutoPan),enableEventPropagation:!!Number(wpslSettings.infoBoxEnableEventPropagation),infoBoxClearance:new google.maps.Size(Number(U[0]),Number(U[1])),pixelOffset:new google.maps.Size(Number(z[0]),Number(z[1])),zIndex:Number(wpslSettings.infoBoxZindex)},a=new InfoBox(B)):a=new google.maps.InfoWindow,g=a,t=new google.maps.Geocoder,o=new google.maps.DirectionsRenderer,n=new google.maps.DirectionsService,d={zoom:h,center:w.startLatLng,mapTypeId:google.maps.MapTypeId[w.mapType.toUpperCase()],mapTypeControl:!!Number(w.mapTypeControl),scrollwheel:!!Number(w.scrollWheel),streetViewControl:!!Number(w.streetView),gestureHandling:w.gestureHandling,zoomControlOptions:{position:google.maps.ControlPosition[w.controlPosition.toUpperCase()+"_TOP"]}},S=function(){var e,t=wpslSettings.markerIconProps,s={};void 0!==t.url?s.url=t.url:void 0!==t.categoryMarkerUrl?s.categoryMarkerUrl=t.categoryMarkerUrl:void 0!==t.alternateMarkerUrl?s.alternateMarkerUrl=t.alternateMarkerUrl:s.url=wpslSettings.url+"img/markers/";for(var o in t)t.hasOwnProperty(o)&&2==(e=t[o].split(",")).length&&(s[o]=e);return s}(),s=new google.maps.Map(document.getElementById(i),d),R=w.mapStyle,(R=function(e){try{var t=JSON.parse(e);if(t&&"object"==typeof t&&null!==t)return t}catch(e){}return!1}(R))&&s.setOptions({styles:R}),void 0!==window["wpslMap_"+p]&&void 0!==window["wpslMap_"+p].locations&&(m=new google.maps.LatLngBounds,f=window["wpslMap_"+p].locations,e.each(f,function(e){W(u=new google.maps.LatLng(f[e].lat,f[e].lng),f[e].id,f[e],!1,g),m.extend(u)}),f.length>1&&(J(s,k),s.fitBounds(m)),_.isArray(wpslSettings.mapTabAnchor)&&(c={map:s,bounds:m,maxZoom:k},v.push(c)));var R;var U,z,B;e("#wpsl-gmap").length&&(1==wpslSettings.autoComplete&&function(){var t,s,o,n={};void 0===wpslSettings.geocodeComponents||e.isEmptyObject(wpslSettings.geocodeComponents)||(n.componentRestrictions=wpslSettings.geocodeComponents);t=document.getElementById("wpsl-search-input"),(s=new google.maps.places.Autocomplete(t,n)).addListener("place_changed",function(){(o=s.getPlace()).geometry&&(l=o.geometry.location)})}(),!N()&&e(".wpsl-dropdown").length&&1==wpslSettings.enableStyledDropdowns?(j=Number(wpslSettings.maxDropdownHeight),e(".wpsl-dropdown").each(function(t){var s,o,n=e(this);n.$dropdownWrap=n.wrap("<div class='wpsl-dropdown'></div>").parent(),n.$selectedVal=n.val(),n.$dropdownElem=e("<div><ul/></div>").appendTo(n.$dropdownWrap),n.$dropdown=n.$dropdownElem.find("ul"),n.$options=n.$dropdownWrap.find("option"),n.hide().removeClass("wpsl-dropdown"),e.each(n.$options,function(){s=e(this).val()==n.$selectedVal?'class="wpsl-selected-dropdown"':"",n.$dropdown.append("<li data-value="+e(this).val()+" "+s+">"+e(this).text()+"</li>")}),n.$dropdownElem.before("<span data-value="+n.find(":selected").val()+" class='wpsl-selected-item'>"+n.find(":selected").text()+"</span>"),n.$dropdownItem=n.$dropdownElem.find("li"),n.$dropdownWrap.on("click",function(t){e(this).hasClass("wpsl-active")?e(this).removeClass("wpsl-active"):(Q(),e(this).toggleClass("wpsl-active"),o=0,e(this).hasClass("wpsl-active")?(n.$dropdownItem.each(function(t){o+=e(this).outerHeight()}),n.$dropdownElem.css("height",o+2+"px")):n.$dropdownElem.css("height",0),o>j&&(e(this).addClass("wpsl-scroll-required"),n.$dropdownElem.css("height",j+"px")),t.stopPropagation())}),n.$dropdownItem.on("click",function(t){n.$dropdownWrap.find(e(".wpsl-selected-item")).html(e(this).text()).attr("data-value",e(this).attr("data-value")),n.$dropdownItem.removeClass("wpsl-selected-dropdown"),e(this).addClass("wpsl-selected-dropdown"),Q(),t.stopPropagation()})}),e(document).click(function(){Q()})):(e("#wpsl-search-wrap select").show(),N()?e("#wpsl-wrap").addClass("wpsl-mobile"):e("#wpsl-wrap").addClass("wpsl-default-filters")),e(".wpsl-search").hasClass("wpsl-widget")||(1==wpslSettings.autoLocate?E(w.startLatLng,g):1==wpslSettings.autoLoad&&M(w.startLatLng,g)),1!=wpslSettings.mouseFocus||N()||e("#wpsl-search-input").focus(),D=g,e("#wpsl-search-btn").unbind("click").bind("click",function(s){return e("#wpsl-search-input").removeClass(),e("#wpsl-search-input").val()?(e("#wpsl-result-list ul").empty(),e("#wpsl-stores").show(),e(".wpsl-direction-before, .wpsl-direction-after").remove(),e("#wpsl-direction-details").hide(),L=!1,P(),q(!1),O(),1==wpslSettings.autoComplete&&void 0!==l?Z(l,D):(o=D,n={address:e("#wpsl-search-input").val()},void 0===wpslSettings.geocodeComponents||e.isEmptyObject(wpslSettings.geocodeComponents)||(n.componentRestrictions=wpslSettings.geocodeComponents),t.geocode(n,function(e,t){t==google.maps.GeocoderStatus.OK?(I.enabled&&(I.address_components=e[0].address_components),Z(e[0].geometry.location,o)):K(t)}))):e("#wpsl-search-input").addClass("wpsl-error").focus(),!1;var o,n}),A=w,$=s,V=g,google.maps.event.addListenerOnce($,"tilesloaded",function(){var t,o;e(".gm-style").append(wpslSettings.mapControls),e(".wpsl-icon-reset, #wpsl-reset-map").length>0&&(t=A.startLatLng,o=V,e(".wpsl-icon-reset, #wpsl-reset-map").on("click",function(){e(this).hasClass("wpsl-in-progress")||(1==wpslSettings.autoLoad&&(y=1),s.getCenter().lat()===C.centerLatlng.lat()&&s.getCenter().lng()===C.centerLatlng.lng()&&s.getZoom()===C.zoomLevel||(q(!1),e("#wpsl-search-input").val("").removeClass(),e(".wpsl-icon-reset").addClass("wpsl-in-progress"),r&&r.clearMarkers(),O(),function(){var t,s,o,n,l,i,a,r,p=e("#wpsl-wrap").hasClass("wpsl-default-filters"),d=[wpslSettings.searchRadius+" "+wpslSettings.distanceUnit,wpslSettings.maxResults],c=["wpsl-radius","wpsl-results"];for(t=0,s=c.length;t<s;t++)e("#"+c[t]+" select").val(parseInt(d[t])),e("#"+c[t]+" li").removeClass(),"wpsl-radius"==c[t]?o=wpslSettings.searchRadius:"wpsl-results"==c[t]&&(o=wpslSettings.maxResults),e("#"+c[t]+" li").each(function(){e(this).text()===d[t]&&(e(this).addClass("wpsl-selected-dropdown"),e("#"+c[t]+" .wpsl-selected-item").html(d[t]).attr("data-value",o))});e("#wpsl-category").length&&(e("#wpsl-category select").val(0),e("#wpsl-category li").removeClass(),e("#wpsl-category li:first-child").addClass("wpsl-selected-dropdown"),n=e("#wpsl-category li:first-child").text(),e("#wpsl-category .wpsl-selected-item").html(n).attr("data-value",0)),e(".wpsl-custom-dropdown").length>0&&e(".wpsl-custom-dropdown").each(function(t){p?e(this).find("option").removeAttr("selected"):(l=e(this).siblings("div"),i=l.find("li:first-child"),a=i.text(),r=i.attr("data-value"),l.find("li").removeClass(),l.prev().html(a).attr("data-value",r))})}(),1==wpslSettings.autoLocate?T(t,x.position,!0,o):M(t,o)),e("#wpsl-stores").show(),e("#wpsl-direction-details").hide())}),e(".wpsl-icon-reset").hide()),e(".wpsl-icon-direction").on("click",function(){e(this).addClass("wpsl-user-activated"),E(A.startLatLng,V)})}),e(".wpsl-search").hasClass("wpsl-widget")&&(e("#wpsl-search-btn").trigger("click"),e(".wpsl-search").removeClass("wpsl-widget")));var A,$,V;var D;var j;void 0!==wpslSettings.markerZoomTo&&1==wpslSettings.markerZoomTo&&google.maps.event.addListener(s,"zoom_changed",function(){F()})}(e(this).attr("id"),i)}),function(){var t,o;if(_.isArray(wpslSettings.mapTabAnchor))for(t=0,o=v.length;t<o;t++)Y(v[t],wpslSettings.mapTabAnchor[t],t);else e("a[href='#"+wpslSettings.mapTabAnchor+"']").length&&Y(s,wpslSettings.mapTabAnchor)}()),e("#wpsl-result-list").on("click",".wpsl-back",function(){var t,n;for(o.setMap(null),t=0,n=h.length;t<n;t++)h[t].setMap(s);return void 0!==p&&""!==p&&p.setMap(s),r&&V(),s.setCenter(b.centerLatlng),s.setZoom(b.zoomLevel),e(".wpsl-direction-before, .wpsl-direction-after").remove(),e("#wpsl-stores").show(),e("#wpsl-direction-details").hide(),!1}),e("#wpsl-gmap").length&&("bounce"==wpslSettings.markerEffect?(e("#wpsl-stores").on("mouseenter","li",function(){z(e(this).data("store-id"),"start")}),e("#wpsl-stores").on("mouseleave","li",function(){z(e(this).data("store-id"),"stop")})):"info_window"==wpslSettings.markerEffect&&e("#wpsl-stores").on("mouseenter","li",function(){var t,o;for(t=0,o=h.length;t<o;t++)h[t].storeId==e(this).data("store-id")&&(google.maps.event.trigger(h[t],"click"),s.setCenter(h[t].position))})),void 0!==wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters)&&google.maps.event.addListener(s,"zoom_changed",function(){google.maps.event.addListenerOnce(s,"idle",function(){if(void 0!==r&&(c=r.clusters_).length)for(u=0,w=c.length;u<w;u++)for(m=0,g=c[u].markers_.length;m<g;m++)if(c[u].markers_[m].storeId==i){a.getVisible()&&null===c[u].markers_[m].map?a.setVisible(!1):a.getVisible()||null===c[u].markers_[m].map||a.setVisible(!0);break}})});function D(e,t,s,o){f.length=0,s.setContent(t),s.open(o,e),f.push(s),void 0!==wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters&&(i=e.storeId,s.setVisible(!0))}function F(){s.getZoom()>=wpslSettings.autoZoomLevel?e(".wpsl-zoom-here").hide():e(".wpsl-zoom-here").show()}var j={formatPhoneNumber:function(e){return(1==wpslSettings.phoneUrl&&N()||1==wpslSettings.clickableDetails)&&(e="<a href='tel:"+j.formatClickablePhoneNumber(e)+"'>"+e+"</a>"),e},formatClickablePhoneNumber:function(e){return-1!=e.indexOf("+")&&-1!=e.indexOf("(0)")&&(e=e.replace("(0)","")),e.replace(/(-| |\(|\)|\.|)/g,"")},formatEmail:function(e){return 1==wpslSettings.clickableDetails&&(e="<a href='mailto:"+e+"'>"+e+"</a>"),e},createInfoWindowActions:function(t){var s,o="",n="";return e("#wpsl-gmap").length&&(k&&(o="<a class='wpsl-streetview' href='#'>"+wpslLabels.streetView+"</a>"),1==wpslSettings.markerZoomTo&&(n="<a class='wpsl-zoom-here' href='#'>"+wpslLabels.zoomHere+"</a>"),s="<div class='wpsl-info-actions'>"+j.createDirectionUrl(t)+o+n+"</div>"),s},createDirectionUrl:function(t){var s,o,n={};return 1==wpslSettings.directionRedirect?(void 0===d&&(d=""),n.target="target='_blank'",void 0!==t?n.src=e("[data-store-id="+t+"] .wpsl-directions").attr("href"):(o=this.zip?this.zip+", ":"",s=this.address+", "+this.city+", "+o+this.country,n.src="https://www.google.com/maps/dir/?api=1&origin="+j.rfc3986EncodeURIComponent(d)+"&destination="+j.rfc3986EncodeURIComponent(s)+"&travelmode="+wpslSettings.directionsTravelMode.toLowerCase())):n={src:"#",target:""},"<a class='wpsl-directions' "+n.target+" href='"+n.src+"'>"+wpslLabels.directions+"</a>"},rfc3986EncodeURIComponent:function(e){return encodeURIComponent(e).replace(/[!'()*]/g,escape)}};function G(t){var s;return s=e("#wpsl-base-gmap_0").length?e("#wpsl-cpt-info-window-template").html():e("#wpsl-info-window-template").html(),_.template(s)(t)}function H(){var e,t,o=Number(wpslSettings.autoZoomLevel),n=new google.maps.LatLngBounds;for(J(s,o),e=0,t=h.length;e<t;e++)n.extend(h[e].position);s.fitBounds(n)}function q(e){var t,s;if(o.setMap(null),h){for(s=0,t=h.length;s<t;s++)e?1!=h[s].draggable?h[s].setMap(null):p=h[s]:h[s].setMap(null);h.length=0}r&&r.clearMarkers()}function K(e){var t;switch(e){case"ZERO_RESULTS":t=wpslLabels.noResults;break;case"OVER_QUERY_LIMIT":t=wpslLabels.queryLimit;break;default:t=wpslLabels.generalError}alert(t)}function Q(){e(".wpsl-dropdown").removeClass("wpsl-active"),e(".wpsl-dropdown div").css("height",0)}function Y(t,s,o){var n,l,i,a,r,p=!!Number(wpslSettings.mapTabAnchorReturn),d=e("a[href='#"+s+"']");i=void 0!==t.maxZoom?t.maxZoom:Number(wpslSettings.autoZoomLevel),void 0!==o&&0==o&&d.addClass("wpsl-fitbounds"),d.on("click",function(){return setTimeout(function(){void 0!==t.map?(a=t.bounds,r=t.map):r=t,n=r.getZoom(),l=r.getCenter(),google.maps.event.trigger(r,"resize"),d.hasClass("wpsl-fitbounds")||(J(r,i),r.setZoom(n),r.setCenter(l),void 0!==a?r.fitBounds(a):H(),d.addClass("wpsl-fitbounds"))},50),p})}function J(e,t){google.maps.event.addListenerOnce(e,"bounds_changed",function(){google.maps.event.addListenerOnce(e,"idle",function(){this.getZoom()>t&&this.setZoom(t)})})}e("#wpsl-stores").on("click",".wpsl-store-details",function(){var t,s,o=e(this).parents("li"),n=o.data("store-id");if("info window"==wpslSettings.moreInfoLocation)for(t=0,s=h.length;t<s;t++)h[t].storeId==n&&google.maps.event.trigger(h[t],"click");else o.find(".wpsl-more-info-listings").is(":visible")?e(this).removeClass("wpsl-active-details"):e(this).addClass("wpsl-active-details"),o.siblings().find(".wpsl-store-details").removeClass("wpsl-active-details"),o.siblings().find(".wpsl-more-info-listings").hide(),o.find(".wpsl-more-info-listings").toggle();if("default"!=wpslSettings.templateId||"store listings"==wpslSettings.moreInfoLocation)return!1})});
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://www.paypal.me/tijmensmit
5
  Tags: google maps, store locator, business locations, geocoding, stores, geo, zipcode locator, dealer locater, geocode, gmaps, google map, google map plugin, location finder, map tools, shop locator, wp google map
6
  Requires at least: 3.7
7
  Tested up to: 4.9.8
8
- Stable tag: 2.2.16
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
11
 
@@ -126,6 +126,9 @@ If you find a plugin or theme that causes a conflict, please report it on the [s
126
 
127
  == Changelog ==
128
 
 
 
 
129
  = 2.2.16, August 14, 2018 =
130
  * Changed: Set the Google Maps API version to 3.33 to prevent [weekly API updates](https://developers.google.com/maps/documentation/javascript/versions) from suddenly breaking the map. You can overwrite the version number with the wpsl_gmap_api_version filter.
131
 
5
  Tags: google maps, store locator, business locations, geocoding, stores, geo, zipcode locator, dealer locater, geocode, gmaps, google map, google map plugin, location finder, map tools, shop locator, wp google map
6
  Requires at least: 3.7
7
  Tested up to: 4.9.8
8
+ Stable tag: 2.2.17
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
11
 
126
 
127
  == Changelog ==
128
 
129
+ = 2.2.17, September 16, 2018 =
130
+ * Changed: Truncated the used coordinates to 5 decimals in the JS script to workaround this [https://issuetracker.google.com/issues/115484101#comment3](reverse geocoding bug). This bug resulted in a 'No results found' error ( based on the used WPSL settings ) if you searched for major cities like Los Angeles.
131
+
132
  = 2.2.16, August 14, 2018 =
133
  * Changed: Set the Google Maps API version to 3.33 to prevent [weekly API updates](https://developers.google.com/maps/documentation/javascript/versions) from suddenly breaking the map. You can overwrite the version number with the wpsl_gmap_api_version filter.
134
 
wp-store-locator.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Store Locator
4
  Description: An easy to use location management system that enables users to search for nearby physical stores
5
  Author: Tijmen Smit
6
  Author URI: https://wpstorelocator.co/
7
- Version: 2.2.16
8
  Text Domain: wpsl
9
  Domain Path: /languages/
10
  License: GPL v3
@@ -61,7 +61,7 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
61
  public function define_constants() {
62
 
63
  if ( !defined( 'WPSL_VERSION_NUM' ) )
64
- define( 'WPSL_VERSION_NUM', '2.2.16' );
65
 
66
  if ( !defined( 'WPSL_URL' ) )
67
  define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );
4
  Description: An easy to use location management system that enables users to search for nearby physical stores
5
  Author: Tijmen Smit
6
  Author URI: https://wpstorelocator.co/
7
+ Version: 2.2.17
8
  Text Domain: wpsl
9
  Domain Path: /languages/
10
  License: GPL v3
61
  public function define_constants() {
62
 
63
  if ( !defined( 'WPSL_VERSION_NUM' ) )
64
+ define( 'WPSL_VERSION_NUM', '2.2.17' );
65
 
66
  if ( !defined( 'WPSL_URL' ) )
67
  define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );