From b662f35c98e54abe03b5520c34248d9fc639e487 Mon Sep 17 00:00:00 2001 From: Bjorn Holine Date: Thu, 2 Apr 2015 16:34:28 -0500 Subject: [PATCH] Fixed bug with reverse geocoding not passing origin, updated location list template to use https --- dist/assets/js/plugins/storeLocator/jquery.storelocator.js | 4 ++-- .../js/plugins/storeLocator/jquery.storelocator.min.js | 4 ++-- .../storeLocator/templates/location-list-description.html | 2 +- package.json | 2 +- readme.md | 6 ++++++ src/js/jquery.storelocator.js | 2 +- storelocator.jquery.json | 2 +- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/dist/assets/js/plugins/storeLocator/jquery.storelocator.js b/dist/assets/js/plugins/storeLocator/jquery.storelocator.js index cc053f2..f653f08 100644 --- a/dist/assets/js/plugins/storeLocator/jquery.storelocator.js +++ b/dist/assets/js/plugins/storeLocator/jquery.storelocator.js @@ -1,4 +1,4 @@ -/*! jQuery Google Maps Store Locator - v2.0.6 - 2015-03-28 +/*! jQuery Google Maps Store Locator - v2.0.7 - 2015-04-02 * http://www.bjornblog.com/web/jquery-store-locator-plugin * Copyright (c) 2015 Bjorn Holine; Licensed MIT */ @@ -905,7 +905,7 @@ 'markerid': markerId, 'marker' : indicator, 'length' : distLength, - 'origin' : addressInput + 'origin' : originalOrigin })] }; }, diff --git a/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js b/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js index 72ad1c5..aa930e1 100644 --- a/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js +++ b/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js @@ -1,5 +1,5 @@ -/*! jQuery Google Maps Store Locator - v2.0.6 - 2015-03-28 +/*! jQuery Google Maps Store Locator - v2.0.7 - 2015-04-02 * http://www.bjornblog.com/web/jquery-store-locator-plugin * Copyright (c) 2015 Bjorn Holine; Licensed MIT */ -!function(a,b,c,d){"use strict";function e(b,c){g=a(b),this.element=b,this.settings=a.extend({},D,c),this._defaults=D,this._name=f,this.init()}var f="storeLocator";if("undefined"==typeof a.fn[f]){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=[],w=[],x=[],y=[],z={},A={},B={},C={},D={mapID:"bh-sl-map",locationList:"bh-sl-loc-list",formContainer:"bh-sl-form-container",formID:"bh-sl-user-location",addressID:"bh-sl-address",regionID:"bh-sl-region",mapSettings:{zoom:12,mapTypeId:google.maps.MapTypeId.ROADMAP},markerImg:null,markerDim:null,catMarkers:null,lengthUnit:"m",storeLimit:26,distanceAlert:60,dataType:"xml",dataLocation:"data/locations.xml",dataRaw:null,xmlElement:"marker",listColor1:"#ffffff",listColor2:"#eeeeee",originMarker:!1,originMarkerImg:null,originMarkerDim:null,bounceMarker:!0,slideMap:!0,modal:!1,overlay:"bh-sl-overlay",modalWindow:"bh-sl-modal-window",modalContent:"bh-sl-modal-content",closeIcon:"bh-sl-close-icon",defaultLoc:!1,defaultLat:null,defaultLng:null,autoGeocode:!1,maxDistance:!1,maxDistanceID:"bh-sl-maxdistance",fullMapStart:!1,noForm:!1,loading:!1,loadingContainer:"bh-sl-loading",featuredLocations:!1,pagination:!1,locationsPerPage:10,inlineDirections:!1,nameSearch:!1,searchID:"bh-sl-search",nameAttribute:"name",visibleMarkersList:!1,infowindowTemplatePath:"assets/js/plugins/storeLocator/templates/infowindow-description.html",listTemplatePath:"assets/js/plugins/storeLocator/templates/location-list-description.html",KMLinfowindowTemplatePath:"assets/js/plugins/storeLocator/templates/kml-infowindow-description.html",KMLlistTemplatePath:"assets/js/plugins/storeLocator/templates/kml-location-list-description.html",listTemplateID:null,infowindowTemplateID:null,taxonomyFilters:null,taxonomyFiltersContainer:"bh-sl-filters-container",exclusiveFiltering:!1,querystringParams:!1,callbackNotify:null,callbackBeforeSend:null,callbackSuccess:null,callbackModalOpen:null,callbackModalReady:null,callbackModalClose:null,callbackJsonp:null,callbackPageChange:null,callbackDirectionsRequest:null,callbackCloseDirections:null,callbackNoResults:null,callbackListClick:null,callbackMarkerClick:null,callbackFilters:null,addressErrorAlert:"Unable to find address",autoGeocodeErrorAlert:"Automatic location detection failed. Please fill in your address or zip code.",distanceErrorAlert:"Unfortunately, our closest location is more than ",mileLang:"mile",milesLang:"miles",kilometerLang:"kilometer",kilometersLang:"kilometers",noResultsTitle:"No results",noResultsDesc:"No locations were found with the given criteria. Please modify your selections or input.",nextPage:"Next »",prevPage:"« Prev"};a.extend(e.prototype,{init:function(){B.EarthRadius="km"===this.settings.lengthUnit?6367:3956,j="kml"===this.settings.dataType?"xml":this.settings.dataType,this.settings.inlineDirections===!0&&(t=new google.maps.DirectionsRenderer,u=new google.maps.DirectionsService,a("."+this.settings.locationList).prepend('
')),m=this.settings.mapSettings.zoom,Handlebars.registerHelper("niceURL",function(a){return a?a.replace("https://","").replace("http://",""):void 0}),null!==this.settings.taxonomyFilters&&this.taxonomyFiltering(),this.settings.modal===!0&&(null!==this.settings.taxonomyFilters&&a("."+this.settings.taxonomyFiltersContainer).clone(!0,!0).prependTo(g),g.wrap('
'),a("."+this.settings.modalWindow).prepend('
'),a("."+this.settings.overlay).hide()),this._loadTemplates()},destroy:function(){this.reset();var b=a("#"+this.settings.mapID);if(y.length)for(var d=0;d<=y.length;d++)google.maps.event.removeListener(y[d]);a("."+this.settings.locationList+" ul").empty(),b.hasClass("bh-sl-map-open")&&b.empty().removeClass("bh-sl-map-open"),this.settings.modal===!0&&a(". "+this.settings.overlay).remove(),b.attr("style",""),g.hide(),a.removeData(g.get(0)),a(c).off(f),g.unbind()},reset:function(){w=[],v=[],x=[],y=[],a(c).off("click."+f,"."+this.settings.locationList+" li"),a("."+this.settings.locationList+" .bh-sl-close-directions-container").length&&a(".bh-sl-close-directions-container").remove()},notify:function(a){this.settings.callbackNotify?this.settings.callbackNotify.call(this,a):alert(a)},geoCodeCalcToRadian:function(a){return a*(Math.PI/180)},geoCodeCalcDiffRadian:function(a,b){return this.geoCodeCalcToRadian(b)-this.geoCodeCalcToRadian(a)},geoCodeCalcCalcDistance:function(a,b,c,d,e){return 2*e*Math.asin(Math.min(1,Math.sqrt(Math.pow(Math.sin(this.geoCodeCalcDiffRadian(a,c)/2),2)+Math.cos(this.geoCodeCalcToRadian(a))*Math.cos(this.geoCodeCalcToRadian(c))*Math.pow(Math.sin(this.geoCodeCalcDiffRadian(b,d)/2),2))))},getQueryString:function(a){if(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b=new RegExp("[\\?&]"+a+"=([^&#]*)"),c=b.exec(location.search);return null===c?"":decodeURIComponent(c[1].replace(/\+/g," "))}},_loadTemplates:function(){var b,c=this,d='
Error: Could not load plugin templates. Check the paths and ensure they have been uploaded. Paths will be wrong if you do not run this from a web server.
';"kml"===this.settings.dataType&&null===this.settings.listTemplateID&&null===this.settings.infowindowTemplateID?a.when(a.get(this.settings.KMLinfowindowTemplatePath,function(a){b=a,i=Handlebars.compile(b)}),a.get(this.settings.KMLlistTemplatePath,function(a){b=a,h=Handlebars.compile(b)})).then(function(){c.locator()},function(){throw a("."+c.settings.formContainer).append(d),new Error("Could not load storeLocator plugin templates")}):null!==this.settings.listTemplateID&&null!==this.settings.infowindowTemplateID?(i=Handlebars.compile(a("#"+this.settings.infowindowTemplateID).html()),h=Handlebars.compile(a("#"+this.settings.listTemplateID).html()),c.locator()):a.when(a.get(this.settings.infowindowTemplatePath,function(a){b=a,i=Handlebars.compile(b)}),a.get(this.settings.listTemplatePath,function(a){b=a,h=Handlebars.compile(b)})).then(function(){c.locator()},function(){throw a("."+c.settings.formContainer).append(d),new Error("Could not load storeLocator plugin templates")})},locator:function(){this.settings.slideMap===!0&&g.hide(),this._start(),this._formEventHandler()},_formEventHandler:function(){var b=this;this.settings.noForm===!0?(a(c).on("click."+f,"."+this.settings.formContainer+" button",function(a){b.processForm(a)}),a(c).on("keyup."+f,function(c){13===c.keyCode&&a("#"+b.settings.addressID).is(":focus")&&b.processForm(c)})):a(c).on("submit."+f,"#"+this.settings.formID,function(a){b.processForm(a)})},_getData:function(b,c,d){var e=this;if(this.settings.callbackBeforeSend&&this.settings.callbackBeforeSend.call(this,b,c,d),null===e.settings.dataRaw){var f=a.Deferred();return this.settings.loading===!0&&a("."+this.settings.formContainer).append('
'),a.ajax({type:"GET",url:this.settings.dataLocation+("jsonp"===this.settings.dataType?(this.settings.dataLocation.match(/\?/)?"&":"?")+"callback=?":""),data:{origLat:b,origLng:c,origAddress:d},dataType:j,jsonpCallback:"jsonp"===this.settings.dataType?this.settings.callbackJsonp:null}).done(function(b){f.resolve(b),e.settings.loading===!0&&a("."+e.settings.formContainer+" ."+e.settings.loadingContainer).remove()}).fail(f.reject),f.promise()}return"xml"===j?a.parseXML(e.settings.dataRaw):"json"===j?a.parseJSON(e.settings.dataRaw):void 0},_start:function(){var a=this;if(this.settings.defaultLoc===!0){var b=new this.reverseGoogleGeocode(this),c=new google.maps.LatLng(this.settings.defaultLat,this.settings.defaultLng);b.geocode({latLng:c},function(b){if(null!==b){var c=b.address;C.lat=a.settings.defaultLat,C.lng=a.settings.defaultLng,C.origin=c,a.mapping(C)}else a.notify(a.settings.addressErrorAlert)})}this.settings.fullMapStart===!0&&(this.settings.querystringParams===!0&&this.getQueryString(this.settings.addressID)||this.getQueryString(this.settings.searchID)?this.processForm(null):this.mapping(null)),this.settings.autoGeocode===!0&&navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(b){a.autoGeocodeQuery(b)},function(b){a._autoGeocodeError(b)})},googleGeocode:function(a){var b=new google.maps.Geocoder;this.geocode=function(a,c){b.geocode(a,function(a,b){if(b!==google.maps.GeocoderStatus.OK)throw c(null),new Error("Geocode was not successful for the following reason: "+b);var d={};d.latitude=a[0].geometry.location.lat(),d.longitude=a[0].geometry.location.lng(),c(d)})}},reverseGoogleGeocode:function(a){var b=new google.maps.Geocoder;this.geocode=function(a,c){b.geocode(a,function(a,b){if(b!==google.maps.GeocoderStatus.OK)throw c(null),new Error("Reverse geocode was not successful for the following reason: "+b);if(a[0]){var d={};d.address=a[0].formatted_address,c(d)}})}},roundNumber:function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},isEmptyObject:function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},hasEmptyObjectVals:function(a){var b=!0;for(var c in a)a.hasOwnProperty(c)&&""!==a[c]&&0!==a[c].length&&(b=!1);return b},modalClose:function(){this.settings.callbackModalClose&&this.settings.callbackModalClose.call(this),z={},a("."+this.settings.overlay+" select").prop("selectedIndex",0),a("."+this.settings.overlay+" input").prop("checked",!1),a("."+this.settings.overlay).hide()},_createLocationVariables:function(a){var b;for(var c in w[a])w[a].hasOwnProperty(c)&&(b=w[a][c],"distance"===c&&(b=this.roundNumber(b,2)),A[c]=b)},sortNumerically:function(a){a.sort(function(a,b){return a.distanceb.distance?1:0})},filterData:function(a,b){var c=!0;for(var d in b)if(b.hasOwnProperty(d))if(this.settings.exclusiveFiltering===!0){for(var e=b[d],f=[],g=0;g0&&(c+='
  • '+this.settings.prevPage+"
  • ");for(var f=0;f'+g+"":'
  • '+g+"
  • "}return b>d&&(c+='
  • '+this.settings.nextPage+"
  • "),c},paginationSetup:function(b){var c="",d=w.length/this.settings.locationsPerPage,e=a(".bh-sl-pagination-container .bh-sl-pagination");"undefined"==typeof b&&(b=0),0===e.length?c=this._paginationOutput(b,d):(e.empty(),c=this._paginationOutput(b,d)),e.append(c)},markerImage:function(a,b,c){var d;return d="undefined"!=typeof b&&"undefined"!=typeof c?{url:a,size:new google.maps.Size(b,c),scaledSize:new google.maps.Size(b,c)}:{url:a,size:new google.maps.Size(32,32),scaledSize:new google.maps.Size(32,32)}},createMarker:function(a,b,c,d,e,f){var g,h,i,j=[];if("undefined"!=typeof f&&f.length&&(f=f.replace(/\s+/g,"")),null!==this.settings.catMarkers)if(-1!==f.indexOf(",")){j=f.split(",");for(var k=0;k26||null!==this.settings.catMarkers||null!==this.settings.markerImg?g=new google.maps.Marker({position:a,map:e,draggable:!1,icon:h}):(i={url:"https://mt.googleapis.com/vt/icon/name=icons/spotlight/spotlight-waypoint-b.png&text="+d+"&psize=16&font=fonts/Roboto-Regular.ttf&color=ff333333&ax=44&ay=48"},g=new google.maps.Marker({position:a,map:e,icon:i,draggable:!1})),g},_defineLocationData:function(b,c,d){var e="";this._createLocationVariables(b.get("id"));var f;f=A.distance<=1?"km"===this.settings.lengthUnit?this.settings.kilometerLang:this.settings.mileLang:"km"===this.settings.lengthUnit?this.settings.kilometersLang:this.settings.milesLang;var g=b.get("id");return e=-1===this.settings.storeLimit||this.settings.storeLimit>26?g+1:String.fromCharCode(d>0?"A".charCodeAt(0)+(c+g):"A".charCodeAt(0)+g),{location:[a.extend(A,{markerid:g,marker:e,length:f,origin:p})]}},listSetup:function(b,c,d){var e=this._defineLocationData(b,c,d),f=h(e);a("."+this.settings.locationList+" ul").append(f)},createInfowindow:function(b,c,d,e,f){var g=this,h=this._defineLocationData(b,e,f),j=i(h);"left"===c?(d.setContent(j),d.open(b.get("map"),b)):google.maps.event.addListener(b,"click",function(){d.setContent(j),d.open(b.get("map"),b);var c=b.get("id"),e=a("."+g.settings.locationList+" li[data-markerid="+c+"]");g.settings.callbackMarkerClick&&g.settings.callbackMarkerClick.call(this,b,c,e),a("."+g.settings.locationList+" li").removeClass("list-focus"),e.addClass("list-focus");var f=a("."+g.settings.locationList);f.animate({scrollTop:e.offset().top-f.offset().top+f.scrollTop()})})},autoGeocodeQuery:function(a){var b=this,c={},d=new this.reverseGoogleGeocode(this),e=new google.maps.LatLng(a.coords.latitude,a.coords.longitude);d.geocode({latLng:e},function(d){if(null!==d){var e=d.address;q=c.lat=a.coords.latitude,r=c.lng=a.coords.longitude,c.origin=e,b.mapping(c)}else b.notify(b.settings.addressErrorAlert)})},_autoGeocodeError:function(){this.notify(this.settings.autoGeocodeErrorAlert)},paginationChange:function(a){this.settings.callbackPageChange&&this.settings.callbackPageChange.call(this,a),C.page=a,this.mapping(C)},getAddressByMarker:function(a){var b=null;return w[a].address&&(b+=w[a].address+" "),w[a].address2&&(b+=w[a].address2+" "),w[a].city&&(b+=w[a].city+", "),w[a].state&&(b+=w[a].state+" "),w[a].postal&&(b+=w[a].postal+" "),w[a].country&&(b+=w[a].country+" "),b},clearMarkers:function(){for(var a=0;a
    ')}a(c).off("click","."+this.settings.locationList+" li .loc-directions a")},closeDirections:function(){this.settings.callbackCloseDirections&&this.settings.callbackCloseDirections.call(this),a("."+this.settings.locationList+" .adp").remove(),a("."+this.settings.locationList+" ul").fadeIn(),this.reset(),q&&r&&(this.settings.mapSettings.zoom=0===this.countFilters()?m:0,this.processForm(null)),a(c).off("click."+f,"."+this.settings.locationList+" .bh-sl-close-icon")},processForm:function(b){var c=this,d=null;"undefined"!=typeof b&&null!==b&&b.preventDefault(),this.settings.maxDistance===!0&&(d=a("#"+this.settings.maxDistanceID).val()),this.settings.querystringParams===!0&&(this.getQueryString(this.settings.addressID)||this.getQueryString(this.settings.searchID))?(p=this.getQueryString(this.settings.addressID),o=this.getQueryString(this.settings.searchID)):(p=a("#"+this.settings.addressID).val(),o=a("#"+this.settings.searchID).val());var e=a("#"+this.settings.regionID).val();if(""===p&&""===o)this._start();else if(""!==p){var f=new this.googleGeocode(this);f.geocode({address:p,region:e},function(a){null!==a?(q=a.latitude,r=a.longitude,C.lat=q,C.lng=r,C.origin=p,C.name=o,C.distance=d,c.mapping(C)):c.notify(c.settings.addressErrorAlert)})}else""!==o&&(C.name=o,c.mapping(C))},locationsSetup:function(a,b,c,d,e,f){if("undefined"!=typeof e&&(a.distance||(a.distance=this.geoCodeCalcCalcDistance(b,c,a.lat,a.lng,B.EarthRadius))),this.settings.maxDistance===!0&&d!==!0&&"undefined"!=typeof f&&null!==f){if(!(a.distance-1&&(z[f].splice(g,1),a("#"+b.settings.mapID).hasClass("bh-sl-map-open")===!0&&(q&&r?(b.settings.mapSettings.zoom=0===b.countFilters()?m:0,b.processForm()):b.mapping(C)))}}else(a(this).is("select")||a(this).is('input[type="radio"]'))&&(b.checkFilters(),d=a(this).val(),e=a(this).closest(".bh-sl-filters").attr("id"),f=b.getFilterKey(e),d?f&&(z[f]=[d],a("#"+b.settings.mapID).hasClass("bh-sl-map-open")===!0&&(q&&r?(b.settings.mapSettings.zoom=0,b.processForm()):b.mapping(C))):(f&&(z[f]=[]),b.reset(),q&&r?(b.settings.mapSettings.zoom=m,b.processForm()):b.mapping(C)))})},checkVisibleMarkers:function(b,c){var d,e,f=this;a("."+this.settings.locationList+" ul").empty(),a(b).each(function(b,g){c.getBounds().contains(g.getPosition())&&(f.listSetup(g,0,0),e=h(d),a("."+f.settings.locationList+" ul").append(e))})},mapping:function(a){var b,c,d,e,f,g=this;this.isEmptyObject(a)||(b=a.lat,c=a.lng,d=a.origin,f=a.page),"undefined"==typeof f&&(f=0),"undefined"==typeof d&&this.settings.nameSearch===!0?n=g._getData():(e=new google.maps.LatLng(b,c),"undefined"!=typeof k&&d===k&&"undefined"!=typeof l?(d=k,n=l):n=g._getData(q,r,d)),null!==g.settings.taxonomyFilters&&g.hasEmptyObjectVals(z)&&g.checkFilters(),null!==g.settings.dataRaw?g.processData(a,e,n,f):n.done(function(b){g.processData(a,e,b,f)})},processData:function(d,e,h,i){var j,m,p,q,r,t,u,A,B,C,D,E,F,G=this,H=0;this.isEmptyObject(d)||(j=d.lat,m=d.lng,p=d.origin,q=d.name,r=d.distance);var I=a("#"+G.settings.mapID),J="km"===G.settings.lengthUnit?G.settings.kilometersLang:G.settings.milesLang;if(l=n,k=p,G.settings.callbackSuccess&&G.settings.callbackSuccess.call(this),G.settings.fullMapStart===!0&&I.hasClass("bh-sl-map-open")===!1?t=!0:G.reset(),I.addClass("bh-sl-map-open"),"json"===G.settings.dataType||"jsonp"===G.settings.dataType)for(var K=0;H0)for(var Q=0;Q
    '+G.settings.noResultsTitle+'

    '+G.settings.noResultsDesc+"").hide().fadeIn(),w[0]={distance:0,lat:0,lng:0}),"undefined"!=typeof p&&G.sortNumerically(w),G.settings.featuredLocations===!0&&(v=a.grep(w,function(a){return"true"===a.featured}),x=a.grep(w,function(a){return"true"!==a.featured}),w=[],w=v.concat(x)),G.settings.maxDistance===!0&&t!==!0&&r){if("undefined"==typeof w[0]||w[0].distance>r)return void G.notify(G.settings.distanceErrorAlert+r+" "+J)}else-1!==G.settings.distanceAlert&&w[0].distance>G.settings.distanceAlert&&(G.notify(G.settings.distanceErrorAlert+G.settings.distanceAlert+" "+J),F=!0);if(G.settings.pagination===!0&&G.paginationSetup(i),G.settings.slideMap===!0&&g.slideDown(),G.settings.modal===!0&&(G.settings.callbackModalOpen&&G.settings.callbackModalOpen.call(this),a("."+G.settings.overlay).fadeIn(),a(c).on("click."+f,"."+G.settings.closeIcon+", ."+G.settings.overlay,function(){G.modalClose()}),a(c).on("click."+f,"."+G.settings.modalWindow,function(a){a.stopPropagation()}),a(c).on("keyup."+f,function(a){27===a.keyCode&&G.modalClose()})),s=-1===G.settings.storeLimit||w.lengthw.length&&(C=G.settings.locationsPerPage-(B+C-w.length)),w=w.slice(B,B+C),s=w.length):(C=s,B=0),G.settings.fullMapStart===!0&&t===!0||0===G.settings.mapSettings.zoom||"undefined"==typeof p||F===!0)D=G.settings.mapSettings,A=new google.maps.LatLngBounds;else if(G.settings.pagination===!0){var R=new google.maps.LatLng(w[0].lat,w[0].lng);0===i?(G.settings.mapSettings.center=e,D=G.settings.mapSettings):(G.settings.mapSettings.center=R,D=G.settings.mapSettings)}else G.settings.mapSettings.center=e,D=G.settings.mapSettings;var S=new google.maps.Map(c.getElementById(G.settings.mapID),D);google.maps.event.addDomListener(b,"resize",function(){var a=S.getCenter();google.maps.event.trigger(S,"resize"),S.setCenter(a)}),g.data(G.settings.mapID.replace("#",""),S);var T=new google.maps.InfoWindow;if(G.settings.originMarker===!0){var U="";if(G.settings.fullMapStart===!1&&t===!0)return;U=null!==G.settings.originMarkerImg?null===G.settings.originMarkerDim?G.markerImage(G.settings.originMarkerImg):G.markerImage(G.settings.originMarkerImg,G.settings.originMarkerDim.width,G.settings.originMarkerDim.height):{url:"https://mt.googleapis.com/vt/icon/name=icons/spotlight/spotlight-waypoint-a.png"},u=new google.maps.Marker({position:e,map:S,icon:U,draggable:!1})}a(c).on("click."+f,".bh-sl-pagination li",function(){G.paginationChange(a(this).attr("data-page"))}),G.settings.inlineDirections===!0&&"undefined"!=typeof p&&(a(c).on("click."+f,"."+G.settings.locationList+" li .loc-directions a",function(b){b.preventDefault();var c=a(this).closest("li").attr("data-markerid");G.directionsRequest(p,c,S)}),a(c).on("click."+f,"."+G.settings.locationList+" .bh-sl-close-icon",function(){G.closeDirections()}));for(var V=0;C-1>=V;V++){var W="";W=String.fromCharCode(i>0?"A".charCodeAt(0)+(B+V):"A".charCodeAt(0)+V);var X=new google.maps.LatLng(w[V].lat,w[V].lng);u=G.createMarker(X,w[V].name,w[V].address,W,S,w[V].category),u.set("id",V),y[V]=u,(G.settings.fullMapStart===!0&&t===!0||0===G.settings.mapSettings.zoom||"undefined"==typeof p||F===!0)&&A.extend(X),G.createInfowindow(u,null,T,B,i)}(G.settings.fullMapStart===!0&&t===!0||0===G.settings.mapSettings.zoom||"undefined"==typeof p||F===!0)&&S.fitBounds(A);var Y=a("."+G.settings.locationList+" ul");Y.empty(),0===w[0].lat&&0===w[0].lng?Y.append(E):a(y).each(function(a){var b=y[a];G.listSetup(b,B,i)}),a(c).on("click."+f,"."+G.settings.locationList+" li",function(){var b=a(this).data("markerid"),c=y[b];G.settings.callbackListClick&&G.settings.callbackListClick.call(this,b,c),a("."+G.settings.locationList+" li").removeClass("list-focus"),a("."+G.settings.locationList+" li[data-markerid="+b+"]").addClass("list-focus"),S.panTo(c.getPosition());var d="left";G.settings.bounceMarker===!0?(c.setAnimation(google.maps.Animation.BOUNCE),setTimeout(function(){c.setAnimation(null),G.createInfowindow(c,d,T,B,i)},700)):G.createInfowindow(c,d,T,B,i)}),a(c).on("click."+f,"."+G.settings.locationList+" li a",function(a){a.stopPropagation()}),a("."+G.settings.locationList+" ul li:even").css("background",G.settings.listColor1),a("."+G.settings.locationList+" ul li:odd").css("background",G.settings.listColor2),G.settings.visibleMarkersList===!0&&(google.maps.event.addListenerOnce(S,"idle",function(){G.checkVisibleMarkers(y,S)}),google.maps.event.addListener(S,"center_changed",function(){G.checkVisibleMarkers(y,S)}),google.maps.event.addListener(S,"zoom_changed",function(){G.checkVisibleMarkers(y,S)})),G.settings.modal===!0&&G.settings.callbackModalReady&&G.settings.callbackModalReady.call(this),G.settings.callbackFilters&&G.settings.callbackFilters.call(this,z)}}),a.fn[f]=function(b){var c=arguments;if(b===d||"object"==typeof b)return this.each(function(){a.data(this,"plugin_"+f)||a.data(this,"plugin_"+f,new e(this,b))});if("string"==typeof b&&"_"!==b[0]&&"init"!==b){var g;return this.each(function(){var d=a.data(this,"plugin_"+f);d instanceof e&&"function"==typeof d[b]&&(g=d[b].apply(d,Array.prototype.slice.call(c,1))),"destroy"===b&&a.data(this,"plugin_"+f,null)}),g!==d?g:this}}}}(jQuery,window,document); \ No newline at end of file +!function(a,b,c,d){"use strict";function e(b,c){g=a(b),this.element=b,this.settings=a.extend({},D,c),this._defaults=D,this._name=f,this.init()}var f="storeLocator";if("undefined"==typeof a.fn[f]){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=[],w=[],x=[],y=[],z={},A={},B={},C={},D={mapID:"bh-sl-map",locationList:"bh-sl-loc-list",formContainer:"bh-sl-form-container",formID:"bh-sl-user-location",addressID:"bh-sl-address",regionID:"bh-sl-region",mapSettings:{zoom:12,mapTypeId:google.maps.MapTypeId.ROADMAP},markerImg:null,markerDim:null,catMarkers:null,lengthUnit:"m",storeLimit:26,distanceAlert:60,dataType:"xml",dataLocation:"data/locations.xml",dataRaw:null,xmlElement:"marker",listColor1:"#ffffff",listColor2:"#eeeeee",originMarker:!1,originMarkerImg:null,originMarkerDim:null,bounceMarker:!0,slideMap:!0,modal:!1,overlay:"bh-sl-overlay",modalWindow:"bh-sl-modal-window",modalContent:"bh-sl-modal-content",closeIcon:"bh-sl-close-icon",defaultLoc:!1,defaultLat:null,defaultLng:null,autoGeocode:!1,maxDistance:!1,maxDistanceID:"bh-sl-maxdistance",fullMapStart:!1,noForm:!1,loading:!1,loadingContainer:"bh-sl-loading",featuredLocations:!1,pagination:!1,locationsPerPage:10,inlineDirections:!1,nameSearch:!1,searchID:"bh-sl-search",nameAttribute:"name",visibleMarkersList:!1,infowindowTemplatePath:"assets/js/plugins/storeLocator/templates/infowindow-description.html",listTemplatePath:"assets/js/plugins/storeLocator/templates/location-list-description.html",KMLinfowindowTemplatePath:"assets/js/plugins/storeLocator/templates/kml-infowindow-description.html",KMLlistTemplatePath:"assets/js/plugins/storeLocator/templates/kml-location-list-description.html",listTemplateID:null,infowindowTemplateID:null,taxonomyFilters:null,taxonomyFiltersContainer:"bh-sl-filters-container",exclusiveFiltering:!1,querystringParams:!1,callbackNotify:null,callbackBeforeSend:null,callbackSuccess:null,callbackModalOpen:null,callbackModalReady:null,callbackModalClose:null,callbackJsonp:null,callbackPageChange:null,callbackDirectionsRequest:null,callbackCloseDirections:null,callbackNoResults:null,callbackListClick:null,callbackMarkerClick:null,callbackFilters:null,addressErrorAlert:"Unable to find address",autoGeocodeErrorAlert:"Automatic location detection failed. Please fill in your address or zip code.",distanceErrorAlert:"Unfortunately, our closest location is more than ",mileLang:"mile",milesLang:"miles",kilometerLang:"kilometer",kilometersLang:"kilometers",noResultsTitle:"No results",noResultsDesc:"No locations were found with the given criteria. Please modify your selections or input.",nextPage:"Next »",prevPage:"« Prev"};a.extend(e.prototype,{init:function(){B.EarthRadius="km"===this.settings.lengthUnit?6367:3956,j="kml"===this.settings.dataType?"xml":this.settings.dataType,this.settings.inlineDirections===!0&&(t=new google.maps.DirectionsRenderer,u=new google.maps.DirectionsService,a("."+this.settings.locationList).prepend('
    ')),m=this.settings.mapSettings.zoom,Handlebars.registerHelper("niceURL",function(a){return a?a.replace("https://","").replace("http://",""):void 0}),null!==this.settings.taxonomyFilters&&this.taxonomyFiltering(),this.settings.modal===!0&&(null!==this.settings.taxonomyFilters&&a("."+this.settings.taxonomyFiltersContainer).clone(!0,!0).prependTo(g),g.wrap('
    '),a("."+this.settings.modalWindow).prepend('
    '),a("."+this.settings.overlay).hide()),this._loadTemplates()},destroy:function(){this.reset();var b=a("#"+this.settings.mapID);if(y.length)for(var d=0;d<=y.length;d++)google.maps.event.removeListener(y[d]);a("."+this.settings.locationList+" ul").empty(),b.hasClass("bh-sl-map-open")&&b.empty().removeClass("bh-sl-map-open"),this.settings.modal===!0&&a(". "+this.settings.overlay).remove(),b.attr("style",""),g.hide(),a.removeData(g.get(0)),a(c).off(f),g.unbind()},reset:function(){w=[],v=[],x=[],y=[],a(c).off("click."+f,"."+this.settings.locationList+" li"),a("."+this.settings.locationList+" .bh-sl-close-directions-container").length&&a(".bh-sl-close-directions-container").remove()},notify:function(a){this.settings.callbackNotify?this.settings.callbackNotify.call(this,a):alert(a)},geoCodeCalcToRadian:function(a){return a*(Math.PI/180)},geoCodeCalcDiffRadian:function(a,b){return this.geoCodeCalcToRadian(b)-this.geoCodeCalcToRadian(a)},geoCodeCalcCalcDistance:function(a,b,c,d,e){return 2*e*Math.asin(Math.min(1,Math.sqrt(Math.pow(Math.sin(this.geoCodeCalcDiffRadian(a,c)/2),2)+Math.cos(this.geoCodeCalcToRadian(a))*Math.cos(this.geoCodeCalcToRadian(c))*Math.pow(Math.sin(this.geoCodeCalcDiffRadian(b,d)/2),2))))},getQueryString:function(a){if(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b=new RegExp("[\\?&]"+a+"=([^&#]*)"),c=b.exec(location.search);return null===c?"":decodeURIComponent(c[1].replace(/\+/g," "))}},_loadTemplates:function(){var b,c=this,d='
    Error: Could not load plugin templates. Check the paths and ensure they have been uploaded. Paths will be wrong if you do not run this from a web server.
    ';"kml"===this.settings.dataType&&null===this.settings.listTemplateID&&null===this.settings.infowindowTemplateID?a.when(a.get(this.settings.KMLinfowindowTemplatePath,function(a){b=a,i=Handlebars.compile(b)}),a.get(this.settings.KMLlistTemplatePath,function(a){b=a,h=Handlebars.compile(b)})).then(function(){c.locator()},function(){throw a("."+c.settings.formContainer).append(d),new Error("Could not load storeLocator plugin templates")}):null!==this.settings.listTemplateID&&null!==this.settings.infowindowTemplateID?(i=Handlebars.compile(a("#"+this.settings.infowindowTemplateID).html()),h=Handlebars.compile(a("#"+this.settings.listTemplateID).html()),c.locator()):a.when(a.get(this.settings.infowindowTemplatePath,function(a){b=a,i=Handlebars.compile(b)}),a.get(this.settings.listTemplatePath,function(a){b=a,h=Handlebars.compile(b)})).then(function(){c.locator()},function(){throw a("."+c.settings.formContainer).append(d),new Error("Could not load storeLocator plugin templates")})},locator:function(){this.settings.slideMap===!0&&g.hide(),this._start(),this._formEventHandler()},_formEventHandler:function(){var b=this;this.settings.noForm===!0?(a(c).on("click."+f,"."+this.settings.formContainer+" button",function(a){b.processForm(a)}),a(c).on("keyup."+f,function(c){13===c.keyCode&&a("#"+b.settings.addressID).is(":focus")&&b.processForm(c)})):a(c).on("submit."+f,"#"+this.settings.formID,function(a){b.processForm(a)})},_getData:function(b,c,d){var e=this;if(this.settings.callbackBeforeSend&&this.settings.callbackBeforeSend.call(this,b,c,d),null===e.settings.dataRaw){var f=a.Deferred();return this.settings.loading===!0&&a("."+this.settings.formContainer).append('
    '),a.ajax({type:"GET",url:this.settings.dataLocation+("jsonp"===this.settings.dataType?(this.settings.dataLocation.match(/\?/)?"&":"?")+"callback=?":""),data:{origLat:b,origLng:c,origAddress:d},dataType:j,jsonpCallback:"jsonp"===this.settings.dataType?this.settings.callbackJsonp:null}).done(function(b){f.resolve(b),e.settings.loading===!0&&a("."+e.settings.formContainer+" ."+e.settings.loadingContainer).remove()}).fail(f.reject),f.promise()}return"xml"===j?a.parseXML(e.settings.dataRaw):"json"===j?a.parseJSON(e.settings.dataRaw):void 0},_start:function(){var a=this;if(this.settings.defaultLoc===!0){var b=new this.reverseGoogleGeocode(this),c=new google.maps.LatLng(this.settings.defaultLat,this.settings.defaultLng);b.geocode({latLng:c},function(b){if(null!==b){var c=b.address;C.lat=a.settings.defaultLat,C.lng=a.settings.defaultLng,C.origin=c,a.mapping(C)}else a.notify(a.settings.addressErrorAlert)})}this.settings.fullMapStart===!0&&(this.settings.querystringParams===!0&&this.getQueryString(this.settings.addressID)||this.getQueryString(this.settings.searchID)?this.processForm(null):this.mapping(null)),this.settings.autoGeocode===!0&&navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(b){a.autoGeocodeQuery(b)},function(b){a._autoGeocodeError(b)})},googleGeocode:function(a){var b=new google.maps.Geocoder;this.geocode=function(a,c){b.geocode(a,function(a,b){if(b!==google.maps.GeocoderStatus.OK)throw c(null),new Error("Geocode was not successful for the following reason: "+b);var d={};d.latitude=a[0].geometry.location.lat(),d.longitude=a[0].geometry.location.lng(),c(d)})}},reverseGoogleGeocode:function(a){var b=new google.maps.Geocoder;this.geocode=function(a,c){b.geocode(a,function(a,b){if(b!==google.maps.GeocoderStatus.OK)throw c(null),new Error("Reverse geocode was not successful for the following reason: "+b);if(a[0]){var d={};d.address=a[0].formatted_address,c(d)}})}},roundNumber:function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},isEmptyObject:function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},hasEmptyObjectVals:function(a){var b=!0;for(var c in a)a.hasOwnProperty(c)&&""!==a[c]&&0!==a[c].length&&(b=!1);return b},modalClose:function(){this.settings.callbackModalClose&&this.settings.callbackModalClose.call(this),z={},a("."+this.settings.overlay+" select").prop("selectedIndex",0),a("."+this.settings.overlay+" input").prop("checked",!1),a("."+this.settings.overlay).hide()},_createLocationVariables:function(a){var b;for(var c in w[a])w[a].hasOwnProperty(c)&&(b=w[a][c],"distance"===c&&(b=this.roundNumber(b,2)),A[c]=b)},sortNumerically:function(a){a.sort(function(a,b){return a.distanceb.distance?1:0})},filterData:function(a,b){var c=!0;for(var d in b)if(b.hasOwnProperty(d))if(this.settings.exclusiveFiltering===!0){for(var e=b[d],f=[],g=0;g0&&(c+='
  • '+this.settings.prevPage+"
  • ");for(var f=0;f'+g+"":'
  • '+g+"
  • "}return b>d&&(c+='
  • '+this.settings.nextPage+"
  • "),c},paginationSetup:function(b){var c="",d=w.length/this.settings.locationsPerPage,e=a(".bh-sl-pagination-container .bh-sl-pagination");"undefined"==typeof b&&(b=0),0===e.length?c=this._paginationOutput(b,d):(e.empty(),c=this._paginationOutput(b,d)),e.append(c)},markerImage:function(a,b,c){var d;return d="undefined"!=typeof b&&"undefined"!=typeof c?{url:a,size:new google.maps.Size(b,c),scaledSize:new google.maps.Size(b,c)}:{url:a,size:new google.maps.Size(32,32),scaledSize:new google.maps.Size(32,32)}},createMarker:function(a,b,c,d,e,f){var g,h,i,j=[];if("undefined"!=typeof f&&f.length&&(f=f.replace(/\s+/g,"")),null!==this.settings.catMarkers)if(-1!==f.indexOf(",")){j=f.split(",");for(var k=0;k26||null!==this.settings.catMarkers||null!==this.settings.markerImg?g=new google.maps.Marker({position:a,map:e,draggable:!1,icon:h}):(i={url:"https://mt.googleapis.com/vt/icon/name=icons/spotlight/spotlight-waypoint-b.png&text="+d+"&psize=16&font=fonts/Roboto-Regular.ttf&color=ff333333&ax=44&ay=48"},g=new google.maps.Marker({position:a,map:e,icon:i,draggable:!1})),g},_defineLocationData:function(b,c,d){var e="";this._createLocationVariables(b.get("id"));var f;f=A.distance<=1?"km"===this.settings.lengthUnit?this.settings.kilometerLang:this.settings.mileLang:"km"===this.settings.lengthUnit?this.settings.kilometersLang:this.settings.milesLang;var g=b.get("id");return e=-1===this.settings.storeLimit||this.settings.storeLimit>26?g+1:String.fromCharCode(d>0?"A".charCodeAt(0)+(c+g):"A".charCodeAt(0)+g),{location:[a.extend(A,{markerid:g,marker:e,length:f,origin:k})]}},listSetup:function(b,c,d){var e=this._defineLocationData(b,c,d),f=h(e);a("."+this.settings.locationList+" ul").append(f)},createInfowindow:function(b,c,d,e,f){var g=this,h=this._defineLocationData(b,e,f),j=i(h);"left"===c?(d.setContent(j),d.open(b.get("map"),b)):google.maps.event.addListener(b,"click",function(){d.setContent(j),d.open(b.get("map"),b);var c=b.get("id"),e=a("."+g.settings.locationList+" li[data-markerid="+c+"]");g.settings.callbackMarkerClick&&g.settings.callbackMarkerClick.call(this,b,c,e),a("."+g.settings.locationList+" li").removeClass("list-focus"),e.addClass("list-focus");var f=a("."+g.settings.locationList);f.animate({scrollTop:e.offset().top-f.offset().top+f.scrollTop()})})},autoGeocodeQuery:function(a){var b=this,c={},d=new this.reverseGoogleGeocode(this),e=new google.maps.LatLng(a.coords.latitude,a.coords.longitude);d.geocode({latLng:e},function(d){if(null!==d){var e=d.address;q=c.lat=a.coords.latitude,r=c.lng=a.coords.longitude,c.origin=e,b.mapping(c)}else b.notify(b.settings.addressErrorAlert)})},_autoGeocodeError:function(){this.notify(this.settings.autoGeocodeErrorAlert)},paginationChange:function(a){this.settings.callbackPageChange&&this.settings.callbackPageChange.call(this,a),C.page=a,this.mapping(C)},getAddressByMarker:function(a){var b=null;return w[a].address&&(b+=w[a].address+" "),w[a].address2&&(b+=w[a].address2+" "),w[a].city&&(b+=w[a].city+", "),w[a].state&&(b+=w[a].state+" "),w[a].postal&&(b+=w[a].postal+" "),w[a].country&&(b+=w[a].country+" "),b},clearMarkers:function(){for(var a=0;a
    ')}a(c).off("click","."+this.settings.locationList+" li .loc-directions a")},closeDirections:function(){this.settings.callbackCloseDirections&&this.settings.callbackCloseDirections.call(this),a("."+this.settings.locationList+" .adp").remove(),a("."+this.settings.locationList+" ul").fadeIn(),this.reset(),q&&r&&(this.settings.mapSettings.zoom=0===this.countFilters()?m:0,this.processForm(null)),a(c).off("click."+f,"."+this.settings.locationList+" .bh-sl-close-icon")},processForm:function(b){var c=this,d=null;"undefined"!=typeof b&&null!==b&&b.preventDefault(),this.settings.maxDistance===!0&&(d=a("#"+this.settings.maxDistanceID).val()),this.settings.querystringParams===!0&&(this.getQueryString(this.settings.addressID)||this.getQueryString(this.settings.searchID))?(p=this.getQueryString(this.settings.addressID),o=this.getQueryString(this.settings.searchID)):(p=a("#"+this.settings.addressID).val(),o=a("#"+this.settings.searchID).val());var e=a("#"+this.settings.regionID).val();if(""===p&&""===o)this._start();else if(""!==p){var f=new this.googleGeocode(this);f.geocode({address:p,region:e},function(a){null!==a?(q=a.latitude,r=a.longitude,C.lat=q,C.lng=r,C.origin=p,C.name=o,C.distance=d,c.mapping(C)):c.notify(c.settings.addressErrorAlert)})}else""!==o&&(C.name=o,c.mapping(C))},locationsSetup:function(a,b,c,d,e,f){if("undefined"!=typeof e&&(a.distance||(a.distance=this.geoCodeCalcCalcDistance(b,c,a.lat,a.lng,B.EarthRadius))),this.settings.maxDistance===!0&&d!==!0&&"undefined"!=typeof f&&null!==f){if(!(a.distance-1&&(z[f].splice(g,1),a("#"+b.settings.mapID).hasClass("bh-sl-map-open")===!0&&(q&&r?(b.settings.mapSettings.zoom=0===b.countFilters()?m:0,b.processForm()):b.mapping(C)))}}else(a(this).is("select")||a(this).is('input[type="radio"]'))&&(b.checkFilters(),d=a(this).val(),e=a(this).closest(".bh-sl-filters").attr("id"),f=b.getFilterKey(e),d?f&&(z[f]=[d],a("#"+b.settings.mapID).hasClass("bh-sl-map-open")===!0&&(q&&r?(b.settings.mapSettings.zoom=0,b.processForm()):b.mapping(C))):(f&&(z[f]=[]),b.reset(),q&&r?(b.settings.mapSettings.zoom=m,b.processForm()):b.mapping(C)))})},checkVisibleMarkers:function(b,c){var d,e,f=this;a("."+this.settings.locationList+" ul").empty(),a(b).each(function(b,g){c.getBounds().contains(g.getPosition())&&(f.listSetup(g,0,0),e=h(d),a("."+f.settings.locationList+" ul").append(e))})},mapping:function(a){var b,c,d,e,f,g=this;this.isEmptyObject(a)||(b=a.lat,c=a.lng,d=a.origin,f=a.page),"undefined"==typeof f&&(f=0),"undefined"==typeof d&&this.settings.nameSearch===!0?n=g._getData():(e=new google.maps.LatLng(b,c),"undefined"!=typeof k&&d===k&&"undefined"!=typeof l?(d=k,n=l):n=g._getData(q,r,d)),null!==g.settings.taxonomyFilters&&g.hasEmptyObjectVals(z)&&g.checkFilters(),null!==g.settings.dataRaw?g.processData(a,e,n,f):n.done(function(b){g.processData(a,e,b,f)})},processData:function(d,e,h,i){var j,m,p,q,r,t,u,A,B,C,D,E,F,G=this,H=0;this.isEmptyObject(d)||(j=d.lat,m=d.lng,p=d.origin,q=d.name,r=d.distance);var I=a("#"+G.settings.mapID),J="km"===G.settings.lengthUnit?G.settings.kilometersLang:G.settings.milesLang;if(l=n,k=p,G.settings.callbackSuccess&&G.settings.callbackSuccess.call(this),G.settings.fullMapStart===!0&&I.hasClass("bh-sl-map-open")===!1?t=!0:G.reset(),I.addClass("bh-sl-map-open"),"json"===G.settings.dataType||"jsonp"===G.settings.dataType)for(var K=0;H0)for(var Q=0;Q
    '+G.settings.noResultsTitle+'

    '+G.settings.noResultsDesc+"").hide().fadeIn(),w[0]={distance:0,lat:0,lng:0}),"undefined"!=typeof p&&G.sortNumerically(w),G.settings.featuredLocations===!0&&(v=a.grep(w,function(a){return"true"===a.featured}),x=a.grep(w,function(a){return"true"!==a.featured}),w=[],w=v.concat(x)),G.settings.maxDistance===!0&&t!==!0&&r){if("undefined"==typeof w[0]||w[0].distance>r)return void G.notify(G.settings.distanceErrorAlert+r+" "+J)}else-1!==G.settings.distanceAlert&&w[0].distance>G.settings.distanceAlert&&(G.notify(G.settings.distanceErrorAlert+G.settings.distanceAlert+" "+J),F=!0);if(G.settings.pagination===!0&&G.paginationSetup(i),G.settings.slideMap===!0&&g.slideDown(),G.settings.modal===!0&&(G.settings.callbackModalOpen&&G.settings.callbackModalOpen.call(this),a("."+G.settings.overlay).fadeIn(),a(c).on("click."+f,"."+G.settings.closeIcon+", ."+G.settings.overlay,function(){G.modalClose()}),a(c).on("click."+f,"."+G.settings.modalWindow,function(a){a.stopPropagation()}),a(c).on("keyup."+f,function(a){27===a.keyCode&&G.modalClose()})),s=-1===G.settings.storeLimit||w.lengthw.length&&(C=G.settings.locationsPerPage-(B+C-w.length)),w=w.slice(B,B+C),s=w.length):(C=s,B=0),G.settings.fullMapStart===!0&&t===!0||0===G.settings.mapSettings.zoom||"undefined"==typeof p||F===!0)D=G.settings.mapSettings,A=new google.maps.LatLngBounds;else if(G.settings.pagination===!0){var R=new google.maps.LatLng(w[0].lat,w[0].lng);0===i?(G.settings.mapSettings.center=e,D=G.settings.mapSettings):(G.settings.mapSettings.center=R,D=G.settings.mapSettings)}else G.settings.mapSettings.center=e,D=G.settings.mapSettings;var S=new google.maps.Map(c.getElementById(G.settings.mapID),D);google.maps.event.addDomListener(b,"resize",function(){var a=S.getCenter();google.maps.event.trigger(S,"resize"),S.setCenter(a)}),g.data(G.settings.mapID.replace("#",""),S);var T=new google.maps.InfoWindow;if(G.settings.originMarker===!0){var U="";if(G.settings.fullMapStart===!1&&t===!0)return;U=null!==G.settings.originMarkerImg?null===G.settings.originMarkerDim?G.markerImage(G.settings.originMarkerImg):G.markerImage(G.settings.originMarkerImg,G.settings.originMarkerDim.width,G.settings.originMarkerDim.height):{url:"https://mt.googleapis.com/vt/icon/name=icons/spotlight/spotlight-waypoint-a.png"},u=new google.maps.Marker({position:e,map:S,icon:U,draggable:!1})}a(c).on("click."+f,".bh-sl-pagination li",function(){G.paginationChange(a(this).attr("data-page"))}),G.settings.inlineDirections===!0&&"undefined"!=typeof p&&(a(c).on("click."+f,"."+G.settings.locationList+" li .loc-directions a",function(b){b.preventDefault();var c=a(this).closest("li").attr("data-markerid");G.directionsRequest(p,c,S)}),a(c).on("click."+f,"."+G.settings.locationList+" .bh-sl-close-icon",function(){G.closeDirections()}));for(var V=0;C-1>=V;V++){var W="";W=String.fromCharCode(i>0?"A".charCodeAt(0)+(B+V):"A".charCodeAt(0)+V);var X=new google.maps.LatLng(w[V].lat,w[V].lng);u=G.createMarker(X,w[V].name,w[V].address,W,S,w[V].category),u.set("id",V),y[V]=u,(G.settings.fullMapStart===!0&&t===!0||0===G.settings.mapSettings.zoom||"undefined"==typeof p||F===!0)&&A.extend(X),G.createInfowindow(u,null,T,B,i)}(G.settings.fullMapStart===!0&&t===!0||0===G.settings.mapSettings.zoom||"undefined"==typeof p||F===!0)&&S.fitBounds(A);var Y=a("."+G.settings.locationList+" ul");Y.empty(),0===w[0].lat&&0===w[0].lng?Y.append(E):a(y).each(function(a){var b=y[a];G.listSetup(b,B,i)}),a(c).on("click."+f,"."+G.settings.locationList+" li",function(){var b=a(this).data("markerid"),c=y[b];G.settings.callbackListClick&&G.settings.callbackListClick.call(this,b,c),a("."+G.settings.locationList+" li").removeClass("list-focus"),a("."+G.settings.locationList+" li[data-markerid="+b+"]").addClass("list-focus"),S.panTo(c.getPosition());var d="left";G.settings.bounceMarker===!0?(c.setAnimation(google.maps.Animation.BOUNCE),setTimeout(function(){c.setAnimation(null),G.createInfowindow(c,d,T,B,i)},700)):G.createInfowindow(c,d,T,B,i)}),a(c).on("click."+f,"."+G.settings.locationList+" li a",function(a){a.stopPropagation()}),a("."+G.settings.locationList+" ul li:even").css("background",G.settings.listColor1),a("."+G.settings.locationList+" ul li:odd").css("background",G.settings.listColor2),G.settings.visibleMarkersList===!0&&(google.maps.event.addListenerOnce(S,"idle",function(){G.checkVisibleMarkers(y,S)}),google.maps.event.addListener(S,"center_changed",function(){G.checkVisibleMarkers(y,S)}),google.maps.event.addListener(S,"zoom_changed",function(){G.checkVisibleMarkers(y,S)})),G.settings.modal===!0&&G.settings.callbackModalReady&&G.settings.callbackModalReady.call(this),G.settings.callbackFilters&&G.settings.callbackFilters.call(this,z)}}),a.fn[f]=function(b){var c=arguments;if(b===d||"object"==typeof b)return this.each(function(){a.data(this,"plugin_"+f)||a.data(this,"plugin_"+f,new e(this,b))});if("string"==typeof b&&"_"!==b[0]&&"init"!==b){var g;return this.each(function(){var d=a.data(this,"plugin_"+f);d instanceof e&&"function"==typeof d[b]&&(g=d[b].apply(d,Array.prototype.slice.call(c,1))),"destroy"===b&&a.data(this,"plugin_"+f,null)}),g!==d?g:this}}}}(jQuery,window,document); \ No newline at end of file diff --git a/dist/assets/js/plugins/storeLocator/templates/location-list-description.html b/dist/assets/js/plugins/storeLocator/templates/location-list-description.html index 44c7f15..dddf05d 100644 --- a/dist/assets/js/plugins/storeLocator/templates/location-list-description.html +++ b/dist/assets/js/plugins/storeLocator/templates/location-list-description.html @@ -10,7 +10,7 @@
    {{phone}}
    {{#if distance}}
    {{distance}} {{length}}
    - {{/if}} + {{/if}}
    diff --git a/package.json b/package.json index 3532843..1783a41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jquery-storelocator-plugin", - "version": "2.0.6", + "version": "2.0.7", "description": "This jQuery plugin takes advantage of Google Maps API version 3 to create an easy to implement store locator. No back-end programming is required, you just need to feed it KML, XML, or JSON data with all the location information.", "repository": { "type": "git", diff --git a/readme.md b/readme.md index 4c9adaf..e25e61d 100644 --- a/readme.md +++ b/readme.md @@ -27,6 +27,12 @@ for even faster loading. ## Changelog +### Version 2.0.7 + +* Fixed bug where reverse geocoding wasn't passing the origin to the templates (autogeocode and default location), +causing incorrect direction links. +* Updated location list directions link to use https. + ### Version 2.0.6 * Added the option to filter data exclusively rather than inclusively with the exclusiveFiltering setting. diff --git a/src/js/jquery.storelocator.js b/src/js/jquery.storelocator.js index 9027944..702b060 100644 --- a/src/js/jquery.storelocator.js +++ b/src/js/jquery.storelocator.js @@ -903,7 +903,7 @@ 'markerid': markerId, 'marker' : indicator, 'length' : distLength, - 'origin' : addressInput + 'origin' : originalOrigin })] }; }, diff --git a/storelocator.jquery.json b/storelocator.jquery.json index 5eb16fb..7168099 100644 --- a/storelocator.jquery.json +++ b/storelocator.jquery.json @@ -3,7 +3,7 @@ "title": "jQuery Google Maps Store Locator", "description": "This jQuery plugin takes advantage of Google Maps API version 3 to create an easy to implement store locator. No back-end programming is required, you just need to feed it KML, XML, or JSON data with all the location information.", "keywords": ["jquery","locator","store", "location", "locations", "maps", "map", "stores", "find"], - "version": "2.0.6", + "version": "2.0.7", "author": { "name": "Bjorn Holine", "url": "http://www.bjornblog.com/"