From e65f63f1209f4a91ec37492902b13e7c2d914a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Holine?= Date: Fri, 14 Jul 2023 23:57:48 -0700 Subject: [PATCH 1/5] Run maybeDisableFilterOptions on fullmapstart and defaultlocation, fixed additional radio and select field disabling issues --- src/js/jquery.storelocator.js | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/js/jquery.storelocator.js b/src/js/jquery.storelocator.js index 018e425..268c94a 100644 --- a/src/js/jquery.storelocator.js +++ b/src/js/jquery.storelocator.js @@ -2850,6 +2850,7 @@ maybeDisableFilterOptions: function() { this.writeDebug('maybeDisableFilterOptions'); var availableValues = []; + var disabledValues = []; var _this = this; // Initially reset any input/option fields that were previously disabled. @@ -2878,7 +2879,8 @@ if ( (typeof addressInput === 'undefined' || addressInput === '') && ($(this).prop('tagName') === 'OPTION' || $(this).prop('type') === 'radio') && - _this.hasSingleGroupFilterVal(filters, key) + _this.hasSingleGroupFilterVal(filters, key) && + Array.from(new Set(originalFilterVals[key].split(','))).includes($(this).val()) ) { return; } @@ -2888,11 +2890,27 @@ (typeof addressInput !== 'undefined' || addressInput !== '') && ($(this).prop('tagName') === 'OPTION' || $(this).prop('type') === 'radio') && _this.hasSingleGroupFilterVal(filters, key) && - Array.from(new Set(originalFilterVals[key].split(','))).indexOf($(this).val()) !== -1 + Array.from(new Set(originalFilterVals[key].split(','))).includes($(this).val()) && + _this.countFilters() === 1 + ) { + return; + } + + // Keep radio button available values after one filter has been selected. + if ( + $(this).prop('type') === 'radio' && + _this.hasSingleGroupFilterVal(filters, key) && + _this.countFilters() > 1 && + disabledValues.hasOwnProperty(key) && + Array.from(new Set(originalFilterVals[key].split(','))).includes($(this).val()) && + ! Array.from(new Set(disabledValues[key].split(','))).includes($(this).val()) ) { return; } + // Track disabled values. + disabledValues[key] = $(this).val(); + $(this).attr('disabled', true); } }); @@ -3173,7 +3191,11 @@ } // Disable filter inputs if there are no locations with the values left. - if (firstRun !== true && this.settings.taxonomyFilters !== null && this.settings.exclusiveFiltering === false) { + if ( + (firstRun !== true && _this.settings.exclusiveFiltering === false) || + (_this.settings.fullMapStart === true && _this.settings.exclusiveFiltering === false) || + (_this.settings.defaultLoc === true && _this.settings.exclusiveFiltering === false) + ) { _this.maybeDisableFilterOptions(); } From 50cec88ba056e4b081ed0baf8a673a778d70fd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Holine?= Date: Sat, 22 Jul 2023 22:27:30 -0700 Subject: [PATCH 2/5] Keep radio button available values after one filter has been selected. --- .../storeLocator/jquery.storelocator.js | 30 ++++++++++++++++--- .../storeLocator/jquery.storelocator.min.js | 4 +-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/dist/assets/js/plugins/storeLocator/jquery.storelocator.js b/dist/assets/js/plugins/storeLocator/jquery.storelocator.js index d8a7ded..835be51 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 - v3.1.12 - 2023-06-19 +/*! jQuery Google Maps Store Locator - v3.1.12 - 2023-07-22 * http://www.bjornblog.com/web/jquery-store-locator-plugin * Copyright (c) 2023 Bjorn Holine; Licensed MIT */ @@ -2854,6 +2854,7 @@ maybeDisableFilterOptions: function() { this.writeDebug('maybeDisableFilterOptions'); var availableValues = []; + var disabledValues = []; var _this = this; // Initially reset any input/option fields that were previously disabled. @@ -2882,7 +2883,8 @@ if ( (typeof addressInput === 'undefined' || addressInput === '') && ($(this).prop('tagName') === 'OPTION' || $(this).prop('type') === 'radio') && - _this.hasSingleGroupFilterVal(filters, key) + _this.hasSingleGroupFilterVal(filters, key) && + Array.from(new Set(originalFilterVals[key].split(','))).includes($(this).val()) ) { return; } @@ -2892,11 +2894,27 @@ (typeof addressInput !== 'undefined' || addressInput !== '') && ($(this).prop('tagName') === 'OPTION' || $(this).prop('type') === 'radio') && _this.hasSingleGroupFilterVal(filters, key) && - Array.from(new Set(originalFilterVals[key].split(','))).indexOf($(this).val()) !== -1 + Array.from(new Set(originalFilterVals[key].split(','))).includes($(this).val()) && + _this.countFilters() === 1 + ) { + return; + } + + // Keep radio button available values after one filter has been selected. + if ( + $(this).prop('type') === 'radio' && + _this.hasSingleGroupFilterVal(filters, key) && + _this.countFilters() > 1 && + disabledValues.hasOwnProperty(key) && + Array.from(new Set(originalFilterVals[key].split(','))).includes($(this).val()) && + ! Array.from(new Set(disabledValues[key].split(','))).includes($(this).val()) ) { return; } + // Track disabled values. + disabledValues[key] = $(this).val(); + $(this).attr('disabled', true); } }); @@ -3177,7 +3195,11 @@ } // Disable filter inputs if there are no locations with the values left. - if (firstRun !== true && this.settings.taxonomyFilters !== null && this.settings.exclusiveFiltering === false) { + if ( + (firstRun !== true && _this.settings.exclusiveFiltering === false) || + (_this.settings.fullMapStart === true && _this.settings.exclusiveFiltering === false) || + (_this.settings.defaultLoc === true && _this.settings.exclusiveFiltering === false) + ) { _this.maybeDisableFilterOptions(); } diff --git a/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js b/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js index 4f19972..497335a 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 - v3.1.12 - 2023-06-19 +/*! jQuery Google Maps Store Locator - v3.1.12 - 2023-07-22 * http://www.bjornblog.com/web/jquery-store-locator-plugin * Copyright (c) 2023 Bjorn Holine; Licensed MIT */ -!function(E,N,_,t){"use strict";var j,a,r,c,z,Q,V,q,U,H,l,g,K,i,n,s,o,W,J,$,h,Z,X,Y,tt,et,u,d,st,p,it="storeLocator";function m(t,e){j=E(t),this.element=t,this.settings=E.extend({},p,e),this._defaults=p,this._name=it,this.init()}void 0===E.fn[it]&&"undefined"!=typeof google&&(p={ajaxData:null,altDistanceNoResult:!(st={}),autoComplete:!(d={}),autoCompleteDisableListener:!(u={}),autoCompleteOptions:{},autoGeocode:!(et={}),bounceMarker:!0,catMarkers:null,dataLocation:"data/locations.json",dataRaw:null,dataType:"json",debug:!(tt=[]),defaultLat:null,defaultLng:null,defaultLoc:!(Y=[]),disableAlphaMarkers:!(X=[]),distanceAlert:60,dragSearch:!(Z=[]),exclusiveFiltering:!1,exclusiveTax:null,featuredDistance:null,featuredLocations:!1,fullMapStart:!1,fullMapStartBlank:!1,fullMapStartListLimit:!1,infoBubble:null,inlineDirections:!1,lengthUnit:"m",listColor1:"#ffffff",listColor2:"#eeeeee",loading:!1,locationsPerPage:10,mapSettings:{mapTypeId:google.maps.MapTypeId.ROADMAP,zoom:12},markerCluster:null,markerImg:null,markerDim:null,maxDistance:!1,modal:!1,nameAttribute:"name",nameSearch:!1,noForm:!1,openNearest:!1,originMarker:!1,originMarkerDim:null,originMarkerImg:null,pagination:!1,querystringParams:!1,selectedMarkerImg:null,selectedMarkerImgDim:null,sessionStorage:!1,slideMap:!0,sortBy:null,storeLimit:26,taxonomyFilters:null,visibleMarkersList:!1,xmlElement:"marker",addressID:"bh-sl-address",closeIcon:"bh-sl-close-icon",formContainer:"bh-sl-form-container",formID:"bh-sl-user-location",geocodeID:null,lengthSwapID:"bh-sl-length-swap",loadingContainer:"bh-sl-loading",locationList:"bh-sl-loc-list",mapID:"bh-sl-map",maxDistanceID:"bh-sl-maxdistance",modalContent:"bh-sl-modal-content",modalWindow:"bh-sl-modal-window",orderID:"bh-sl-order",overlay:"bh-sl-overlay",regionID:"bh-sl-region",searchID:"bh-sl-search",sortID:"bh-sl-sort",taxonomyFiltersContainer:"bh-sl-filters-container",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,callbackAutoGeoSuccess:null,callbackBeforeSend:null,callbackCloseDirections:null,callbackCreateMarker:null,callbackDirectionsRequest:null,callbackFilters:null,callbackFormVals:null,callbackGeocodeRestrictions:null,callbackJsonp:null,callbackListClick:null,callbackMapSet:null,callbackMarkerClick:null,callbackModalClose:null,callbackModalOpen:null,callbackModalReady:null,callbackNearestLoc:null,callbackNoResults:null,callbackNotify:null,callbackOrder:null,callbackPageChange:null,callbackRegion:null,callbackSorting:null,callbackSuccess: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 ",kilometerLang:"kilometer",kilometersLang:"kilometers",mileLang:"mile",milesLang:"miles",noResultsTitle:"No results",noResultsDesc:"No locations were found with the given criteria. Please modify your selections or input.",nextPage:"Next »",prevPage:"« Prev"},E.extend(m.prototype,{init:function(){var t,e=this;this.writeDebug("init"),"km"===this.settings.lengthUnit?d.EarthRadius=6367:d.EarthRadius=3956,c="kml"===this.settings.dataType?"xml":this.settings.dataType,!0===this.settings.inlineDirections&&E("."+this.settings.locationList).prepend('
'),V=this.settings.mapSettings.zoom,Handlebars.registerHelper("niceURL",function(t){if(t)return t.replace("https://","").replace("http://","")}),null!==this.settings.taxonomyFilters&&this.taxonomyFiltering(),this.sorting(),this.order(),!0===this.settings.modal&&(null!==this.settings.taxonomyFilters&&E("."+this.settings.taxonomyFiltersContainer).clone(!0,!0).prependTo(j),j.wrap('
'),E("."+this.settings.modalWindow).prepend('
'),E("."+this.settings.overlay).hide()),!0===this.settings.autoComplete&&(t=_.getElementById(this.settings.addressID),t=new google.maps.places.Autocomplete(t,this.settings.autoCompleteOptions),!0===this.settings.autoComplete)&&!0!==this.settings.autoCompleteDisableListener&&t.addListener("place_changed",function(t){e.processForm(t)}),this._loadTemplates()},destroy:function(){this.writeDebug("destroy"),this.reset();var t=E("#"+this.settings.mapID);if(tt.length)for(var e=0;e<=tt.length;e++)google.maps.event.removeListener(tt[e]);E("."+this.settings.locationList+" ul").empty(),t.hasClass("bh-sl-map-open")&&t.empty().removeClass("bh-sl-map-open"),!0===this.settings.modal&&E(". "+this.settings.overlay).remove(),t.attr("style",""),j.hide(),E.removeData(j.get(0)),E(_).off(it),j.unbind()},reset:function(){var t;this.writeDebug("reset"),X=[],Z=[],Y=[],W=!(tt=[]),E(_).off("click."+it,"."+this.settings.locationList+" li"),E("."+this.settings.locationList+" .bh-sl-close-directions-container").length&&E(".bh-sl-close-directions-container").remove(),!0===this.settings.inlineDirections&&(0<(t=E("."+this.settings.locationList+" .adp")).length&&(t.remove(),E("."+this.settings.locationList+" ul").fadeIn()),E(_).off("click","."+this.settings.locationList+" li .loc-directions a")),!0===this.settings.pagination&&E(_).off("click."+it,".bh-sl-pagination li")},formFiltersReset:function(){var t,e;this.writeDebug("formFiltersReset"),null!==this.settings.taxonomyFilters&&(t=E("."+this.settings.taxonomyFiltersContainer+" input"),e=E("."+this.settings.taxonomyFiltersContainer+" select"),"object"==typeof t)&&(t.each(function(){(E(this).is('input[type="checkbox"]')||E(this).is('input[type="radio"]'))&&E(this).prop("checked",!1)}),e.each(function(){E(this).prop("selectedIndex",0)}))},mapReload:function(){this.writeDebug("mapReload"),this.reset(),J=!0,null!==this.settings.taxonomyFilters&&(this.formFiltersReset(),this.resetDisabledFilterVals(),this.taxonomyFiltersInit()),l&&g?(this.settings.mapSettings.zoom=V,this.processForm()):this.mapping(st)},notify:function(t){this.writeDebug("notify",t),this.settings.callbackNotify?this.settings.callbackNotify.call(this,t):alert(t)},geoCodeCalcToRadian:function(t){return this.writeDebug("geoCodeCalcToRadian",t),t*(Math.PI/180)},geoCodeCalcDiffRadian:function(t,e){return this.writeDebug("geoCodeCalcDiffRadian",arguments),this.geoCodeCalcToRadian(e)-this.geoCodeCalcToRadian(t)},geoCodeCalcCalcDistance:function(t,e,s,i,n){return this.writeDebug("geoCodeCalcCalcDistance",arguments),2*n*Math.asin(Math.min(1,Math.sqrt(Math.pow(Math.sin(this.geoCodeCalcDiffRadian(t,s)/2),2)+Math.cos(this.geoCodeCalcToRadian(t))*Math.cos(this.geoCodeCalcToRadian(s))*Math.pow(Math.sin(this.geoCodeCalcDiffRadian(e,i)/2),2))))},inRange:function(t,e,s){return this.writeDebug("inRange",arguments),e=Math.abs(e),isFinite(e)&&t<=e&&e<=s},coordinatesInRange:function(t,e){return this.writeDebug("coordinatesInRange",arguments),this.inRange(-90,t,90)&&this.inRange(-180,e,180)},getQueryString:function(t){if(this.writeDebug("getQueryString",t),t)return t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),null===(t=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search))?"":decodeURIComponent(t[1].replace(/\+/g," "))},getMap:function(){return this.map},_loadTemplates:function(){this.writeDebug("_loadTemplates");var e,t=this,s='
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?E.when(E.get(this.settings.KMLinfowindowTemplatePath,function(t){e=t,r=Handlebars.compile(e)}),E.get(this.settings.KMLlistTemplatePath,function(t){e=t,a=Handlebars.compile(e)})).then(function(){t.locator()},function(){throw E("."+t.settings.formContainer).append(s),new Error("Could not load storeLocator plugin templates")}):null!==this.settings.listTemplateID&&null!==this.settings.infowindowTemplateID?(r=Handlebars.compile(E("#"+this.settings.infowindowTemplateID).html()),a=Handlebars.compile(E("#"+this.settings.listTemplateID).html()),t.locator()):E.when(E.get(this.settings.infowindowTemplatePath,function(t){e=t,r=Handlebars.compile(e)}),E.get(this.settings.listTemplatePath,function(t){e=t,a=Handlebars.compile(e)})).then(function(){t.locator()},function(){throw E("."+t.settings.formContainer).append(s),new Error("Could not load storeLocator plugin templates")})},locator:function(){this.writeDebug("locator"),!0===this.settings.slideMap&&j.hide(),this._start(),this._formEventHandler()},_formEventHandler:function(){this.writeDebug("_formEventHandler");var e=this;!0===this.settings.noForm?(E(_).on("click."+it,"."+this.settings.formContainer+" button",function(t){e.processForm(t)}),E(_).on("keydown."+it,function(t){13===t.keyCode&&E("#"+e.settings.addressID).is(":focus")&&e.processForm(t)})):E(_).on("submit."+it,"#"+this.settings.formID,function(t){e.processForm(t)}),E(".bh-sl-reset").length&&E("#"+this.settings.mapID).length&&E(_).on("click."+it,".bh-sl-reset",function(){e.mapReload()}),E("#"+this.settings.addressID).on("change."+it,function(){h=t,""!==E.trim(E("#"+e.settings.addressID).val())||void 0!==U&&""!==U||null!==e.settings.taxonomyFilters&&!1===e.settings.exclusiveFiltering&&(z=g=l=t,st={},e.resetDisabledFilterVals(),e.taxonomyFiltersInit(),e.mapping(null))})},_getData:function(t,e,s,i,n){this.writeDebug("_getData",arguments);var a,o=this,r="",l="",g="";return void 0!==i&&void 0!==i.geometry.bounds&&(g=i.formatted_address,r=JSON.stringify(i.geometry.bounds.getNorthEast()),l=JSON.stringify(i.geometry.bounds.getSouthWest())),this.settings.callbackBeforeSend&&this.settings.callbackBeforeSend.call(this,t,e,s,g,r,l,n),null!==o.settings.dataRaw?"xml"===c?E.parseXML(o.settings.dataRaw):"json"===c?Array.isArray&&Array.isArray(o.settings.dataRaw)?o.settings.dataRaw:"string"==typeof o.settings.dataRaw?JSON.parse(o.settings.dataRaw):[]:void 0:(a=E.Deferred(),!0===this.settings.loading&&E("."+this.settings.formContainer).append('
'),i={origLat:t,origLng:e,origAddress:s,formattedAddress:g,boundsNorthEast:r,boundsSouthWest:l},null!==this.settings.ajaxData&&"object"==typeof this.settings.ajaxData&&E.extend(i,this.settings.ajaxData),E.ajax({type:"GET",url:this.settings.dataLocation+("jsonp"===this.settings.dataType?(this.settings.dataLocation.match(/\?/)?"&":"?")+"callback=?":""),data:i,dataType:c,jsonpCallback:"jsonp"===this.settings.dataType?this.settings.callbackJsonp:null}).done(function(t){a.resolve(t),!0===o.settings.loading&&E("."+o.settings.formContainer+" ."+o.settings.loadingContainer).remove()}).fail(a.reject),a.promise())},_start:function(){this.writeDebug("_start");var t,e,s=this,i=this.settings.autoGeocode;!1!==s.settings.fullMapStartBlank?(E("#"+s.settings.mapID).addClass("bh-sl-map-open"),(e=s.settings.mapSettings).zoom=s.settings.fullMapStartBlank,t=new google.maps.LatLng(this.settings.defaultLat,this.settings.defaultLng),e.center=t,s.map=new google.maps.Map(_.getElementById(s.settings.mapID),e),N.addEventListener("resize",function(){var t=s.map.getCenter();google.maps.event.trigger(s.map,"resize"),s.map.setCenter(t)}),s.settings.fullMapStartBlank=!1,e.zoom=V):(!0===this.settings.defaultLoc&&this.defaultLocation(),""!==E.trim(E("#"+this.settings.addressID).val())?(s.writeDebug("Using Address Field"),s.processForm(null),i=!1):!0===this.settings.fullMapStart&&!1===this.settings.defaultLoc&&(!0===this.settings.querystringParams&&this.getQueryString(this.settings.addressID)||!0===this.settings.querystringParams&&this.getQueryString(this.settings.searchID)||!0===this.settings.querystringParams&&this.getQueryString(this.settings.maxDistanceID)?(s.writeDebug("Using Query String"),this.processForm(null),i=!1):this.mapping(null))),!0===this.settings.autoGeocode&&!0===i&&(s.writeDebug("Auto Geo"),s.htmlGeocode()),null!==this.settings.autoGeocode&&(s.writeDebug("Button Geo"),E(_).on("click."+it,"#"+this.settings.geocodeID,function(){s.htmlGeocode()}))},htmlGeocode:function(){this.writeDebug("htmlGeocode",arguments);var e=this;if(!0===e.settings.sessionStorage&&N.sessionStorage&&N.sessionStorage.getItem("myGeo"))return e.writeDebug("Using Session Saved Values for GEO"),e.autoGeocodeQuery(JSON.parse(N.sessionStorage.getItem("myGeo"))),!1;navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(t){e.writeDebug("Current Position Result");t={coords:{latitude:t.coords.latitude,longitude:t.coords.longitude,accuracy:t.coords.accuracy}};!0===e.settings.sessionStorage&&N.sessionStorage&&N.sessionStorage.setItem("myGeo",JSON.stringify(t)),e.settings.callbackAutoGeoSuccess&&e.settings.callbackAutoGeoSuccess.call(this,t),e.autoGeocodeQuery(t)},function(t){e._autoGeocodeError(t)})},googleGeocode:function(t){t.writeDebug("googleGeocode",arguments);var e=new google.maps.Geocoder;this.geocode=function(t,s){e.geocode(t,function(t,e){if(e!==google.maps.GeocoderStatus.OK)throw s(null),new Error("Geocode was not successful for the following reason: "+e);e={};e.latitude=t[0].geometry.location.lat(),e.longitude=t[0].geometry.location.lng(),e.geocodeResult=t[0],s(e)})}},reverseGoogleGeocode:function(t){t.writeDebug("reverseGoogleGeocode",arguments);var e=new google.maps.Geocoder;this.geocode=function(t,s){e.geocode(t,function(t,e){if(e!==google.maps.GeocoderStatus.OK)throw s(null),new Error("Reverse geocode was not successful for the following reason: "+e);t[0]&&((e={}).address=t[0].formatted_address,e.fullResult=t[0],s(e))})}},roundNumber:function(t,e){return this.writeDebug("roundNumber",arguments),Math.round(t*Math.pow(10,e))/Math.pow(10,e)},isEmptyObject:function(t){for(var e in this.writeDebug("isEmptyObject",arguments),t)if(t.hasOwnProperty(e))return!1;return!0},hasEmptyObjectVals:function(t){this.writeDebug("hasEmptyObjectVals",arguments);var e,s=!0;for(e in t)t.hasOwnProperty(e)&&""!==t[e]&&0!==t[e].length&&(s=!1);return s},hasSingleGroupFilterVal:function(t,e){this.writeDebug("hasSingleGroupFilterVal",arguments);t=Object.assign({},t);return!this.hasEmptyObjectVals(t[e])},modalClose:function(){this.writeDebug("modalClose"),this.settings.callbackModalClose&&this.settings.callbackModalClose.call(this),et={},E("."+this.settings.overlay+" select").prop("selectedIndex",0),E("."+this.settings.overlay+" input").prop("checked",!1),E("."+this.settings.overlay).hide()},_createLocationVariables:function(t){var e,s;for(s in this.writeDebug("_createLocationVariables",arguments),u={},X[t])X[t].hasOwnProperty(s)&&(e=X[t][s],"distance"!==s&&"altdistance"!==s||(e=this.roundNumber(e,2)),u[s]=e)},sortAlpha:function(t){this.writeDebug("sortAlpha",arguments);var s=this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"name";this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return e[s].toLowerCase().localeCompare(t[s].toLowerCase())}):t.sort(function(t,e){return t[s].toLowerCase().localeCompare(e[s].toLowerCase())})},sortDate:function(t){this.writeDebug("sortDate",arguments);var s=this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"date";this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return new Date(e[s]).getTime()-new Date(t[s]).getTime()}):t.sort(function(t,e){return new Date(t[s]).getTime()-new Date(e[s]).getTime()})},sortNumerically:function(t,e){this.writeDebug("sortNumerically",arguments);var s=null!==this.settings.sortBy&&this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"distance";void 0!==e&&!0===e&&(s="distance"),null!==this.settings.sortBy&&this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return e[s]t[s]?1:0}):t.sort(function(t,e){return t[s]e[s]?1:0})},sortCustom:function(t){this.writeDebug("sortCustom",arguments),this.settings.sortBy.hasOwnProperty("method")&&"alpha"===this.settings.sortBy.method.toString()?this.sortAlpha(t):this.settings.sortBy.hasOwnProperty("method")&&"date"===this.settings.sortBy.method.toString()?this.sortDate(t):this.sortNumerically(t)},filterMatching:function(t,e,s){return this.writeDebug("inclusiveFilter",arguments),void 0!==e&&(s=!0===(s=void 0===s||s)?t.join(""):t.join("|"),!!new RegExp(s,"i").test(e.replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g,"")))},filterData:function(t,e){this.writeDebug("filterData",arguments);var s,i=!0;for(s in e)if(e.hasOwnProperty(s)){for(var n=[],a=0;a'+this.settings.prevPage+"");for(var n=0;n'+a+"":'
  • '+a+"
  • "}return i'+this.settings.nextPage+""),s},paginationSetup:function(t){this.writeDebug("paginationSetup",arguments);var e="",s=E(".bh-sl-pagination-container .bh-sl-pagination"),i=-1===this.settings.storeLimit||X.length ul").append(e)},changeSelectedMarker:function(t){var e;void 0!==o&&o.setIcon(s),e=null===this.settings.selectedMarkerImgDim?this.markerImage(this.settings.selectedMarkerImg):this.markerImage(this.settings.selectedMarkerImg,this.settings.selectedMarkerImgDim.width,this.settings.selectedMarkerImgDim.height),s=t.icon,t.setIcon(e),o=t},createInfowindow:function(s,t,i,e,n){this.writeDebug("createInfowindow",arguments);var a=this,e=this._defineLocationData(s,e,n),o=r(e);"left"===t?(i.setContent(o),i.open(s.get("map"),s)):google.maps.event.addListener(s,"click",function(){i.setContent(o),i.open(s.get("map"),s);var t=s.get("id"),e=E("."+a.settings.locationList+" li[data-markerid="+t+"]");0
    ')),E(_).off("click","."+this.settings.locationList+" li .loc-directions a")},closeDirections:function(){this.writeDebug("closeDirections"),this.settings.callbackCloseDirections&&this.settings.callbackCloseDirections.call(this),this.reset(),l&&g&&(0===this.countFilters()?this.settings.mapSettings.zoom=V:this.settings.mapSettings.zoom=0,this.processForm(null)),E(_).off("click."+it,"."+this.settings.locationList+" .bh-sl-close-icon")},lengthUnitSwap:function(t){this.writeDebug("lengthUnitSwap",arguments),"alt-distance"===t.val()?(E("."+this.settings.locationList+" .loc-alt-dist").show(),E("."+this.settings.locationList+" .loc-default-dist").hide()):"default-distance"===t.val()&&(E("."+this.settings.locationList+" .loc-default-dist").show(),E("."+this.settings.locationList+" .loc-alt-dist").hide())},processForm:function(t){this.writeDebug("processForm",arguments);var e=this,s=null,i={},n=E("#"+this.settings.addressID),a=E("#"+this.settings.searchID),o=E("#"+this.settings.maxDistanceID),r="";null!=t&&t.preventDefault(),E("."+e.settings.formContainer+" input, ."+e.settings.formContainer+" select").blur(),!0===this.settings.querystringParams&&(this.getQueryString(this.settings.addressID)||this.getQueryString(this.settings.searchID)||this.getQueryString(this.settings.maxDistanceID))?(H=this.getQueryString(this.settings.addressID),U=this.getQueryString(this.settings.searchID),s=this.getQueryString(this.settings.maxDistanceID),""!==n.val()&&(H=n.val()),""!==a.val()&&(U=a.val()),""!==o.val()&&(s=o.val())):(H=n.val()||"",U=a.val()||"",!0===this.settings.maxDistance&&(s=o.val()||"")),r=this.settings.callbackRegion?this.settings.callbackRegion.call(this,H,U,s):E("#"+this.settings.regionID).val(),this.settings.callbackFormVals&&this.settings.callbackFormVals.call(this,H,U,s,r),void 0!==r&&(i={country:r}),"function"==typeof this.settings.callbackGeocodeRestrictions&&(i=this.settings.callbackGeocodeRestrictions.call(this,H,U,s)),""===H&&""===U&&!0!==this.settings.autoGeocode?this._start():""!==H?(""===U&&et.hasOwnProperty("name")&&delete et.name,void 0!==z&&void 0!==l&&void 0!==g&&H===z?(st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,e.mapping(st)):new this.googleGeocode(this).geocode({address:H,componentRestrictions:i,region:r},function(t){null!==t?(l=t.latitude,g=t.longitude,st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,st.geocodeResult=t.geocodeResult,e.mapping(st)):e.notify(e.settings.addressErrorAlert)})):""!==U?(""===H&&delete st.origin,st.name=U,e.mapping(st)):!0===this.settings.autoGeocode&&(st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,e.mapping(st))},locationsSetup:function(t,e,s,i,n){this.writeDebug("locationsSetup",arguments),void 0===i||t.distance||(t.distance=this.geoCodeCalcCalcDistance(e,s,t.lat,t.lng,d.EarthRadius),"m"===this.settings.lengthUnit?t.altdistance=1.609344*parseFloat(t.distance):"km"===this.settings.lengthUnit&&(t.altdistance=parseFloat(t.distance)/1.609344)),this.coordinatesInRange(t.lat,t.lng)?!0===this.settings.maxDistance&&null!=n?t.distance<=n?X.push(t):this.writeDebug("locationsSetup","location ignored because it is out of maxDistance: "+n,t):!0!==this.settings.maxDistance||!0!==this.settings.querystringParams||null==n||t.distance<=n?X.push(t):this.writeDebug("locationsSetup","location ignored because it is out of maxDistance: "+n,t):this.writeDebug("locationsSetup","location ignored because coordinates out of range: "+n,t)},sorting:function(){this.writeDebug("sorting",arguments);var s=this,i=E("#"+s.settings.mapID),t=E("#"+s.settings.sortID);0!==t.length&&t.on("change."+it,function(t){var e;t.stopPropagation(),!0===s.settings.pagination&&s.paginationChange(0),t=void 0!==E(this).find(":selected").attr("data-method")?E(this).find(":selected").attr("data-method"):"distance",e=E(this).val(),s.settings.sortBy.method=t,s.settings.sortBy.prop=e,s.settings.callbackSorting&&s.settings.callbackSorting.call(this,s.settings.sortBy),i.hasClass("bh-sl-map-open")&&s.mapping(st)})},order:function(){this.writeDebug("order",arguments);var e=this,s=E("#"+e.settings.mapID),t=E("#"+e.settings.orderID);0!==t.length&&t.on("change."+it,function(t){t.stopPropagation(),!0===e.settings.pagination&&e.paginationChange(0),e.settings.sortBy.order=E(this).val(),e.settings.callbackOrder&&e.settings.callbackOrder.call(this,e.settings.order),s.hasClass("bh-sl-map-open")&&e.mapping(st)})},countFilters:function(){this.writeDebug("countFilters");var t=0;if(!this.isEmptyObject(et))for(var e in et)et.hasOwnProperty(e)&&(t+=et[e].length);return t},_existingCheckedFilters:function(e){this.writeDebug("_existingCheckedFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" input[type=checkbox]").each(function(){var t;E(this).prop("checked")&&void 0!==(t=E(this).val())&&""!==t&&-1===et[e].indexOf(t)&&et[e].push(t)})},_existingSelectedFilters:function(e){this.writeDebug("_existingSelectedFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" select").each(function(){var t=E(this).val();void 0!==t&&""!==t&&-1===et[e].indexOf(t)&&(et[e]=[t])})},_existingRadioFilters:function(e){this.writeDebug("_existingRadioFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" input[type=radio]").each(function(){var t;E(this).prop("checked")&&void 0!==(t=E(this).val())&&""!==t&&-1===et[e].indexOf(t)&&(et[e]=[t])})},checkFilters:function(){for(var t in this.writeDebug("checkFilters"),this.settings.taxonomyFilters)this.settings.taxonomyFilters.hasOwnProperty(t)&&(this._existingCheckedFilters(t),this._existingSelectedFilters(t),this._existingRadioFilters(t))},selectQueryStringFilters:function(t,e){this.writeDebug("selectQueryStringFilters",arguments);var s=E("#"+this.settings.taxonomyFilters[t]);if(s.find('input[type="checkbox"]').length)for(var i=0;i ul").append(i))}),E("."+this.settings.locationList+" ul li:even").css("background",this.settings.listColor1),E("."+this.settings.locationList+" ul li:odd").css("background",this.settings.listColor2)},dragSearch:function(t){this.writeDebug("dragSearch",arguments);var e=t.getCenter(),s=this,t=(this.settings.mapSettings.zoom=t.getZoom(),l=st.lat=e.lat(),g=st.lng=e.lng(),new this.reverseGoogleGeocode(this)),e=new google.maps.LatLng(st.lat,st.lng);t.geocode({latLng:e},function(t){null!==t?(st.origin=H=t.address,s.mapping(st)):s.notify(s.settings.addressErrorAlert)})},emptyResult:function(){this.writeDebug("emptyResult",arguments);var t=E("."+this.settings.locationList+" ul"),e=this.settings.mapSettings;this.map=new google.maps.Map(_.getElementById(this.settings.mapID),e),this.settings.callbackNoResults&&this.settings.callbackNoResults.call(this,this.map,e),t.empty(),e=E('
  • '+this.settings.noResultsTitle+'

    '+this.settings.noResultsDesc+"
  • ").hide().fadeIn(),t.append(e),t=l&&g?new google.maps.LatLng(l,g):new google.maps.LatLng(0,0),this.map.setCenter(t),V&&this.map.setZoom(V)},originMarker:function(t,e,s){var i;this.writeDebug("originMarker",arguments),!0===this.settings.originMarker&&(i="",void 0!==e)&&(i=null!==this.settings.originMarkerImg?null===this.settings.originMarkerDim?this.markerImage(this.settings.originMarkerImg):this.markerImage(this.settings.originMarkerImg,this.settings.originMarkerDim.width,this.settings.originMarkerDim.height):{url:"https://mt.googleapis.com/vt/icon/name=icons/spotlight/spotlight-waypoint-a.png"},new google.maps.Marker({position:s,map:t,icon:i,draggable:!1}))},modalWindow:function(){var e;this.writeDebug("modalWindow"),!0===this.settings.modal&&((e=this).settings.callbackModalOpen&&e.settings.callbackModalOpen.call(this),E("."+e.settings.overlay).fadeIn(),E(_).on("click."+it,"."+e.settings.closeIcon+", ."+e.settings.overlay,function(){e.modalClose()}),E(_).on("click."+it,"."+e.settings.modalWindow,function(t){t.stopPropagation()}),E(_).on("keyup."+it,function(t){27===t.keyCode&&e.modalClose()}))},openNearestLocation:function(t,e,s,i){var n,a;this.writeDebug("openNearestLocation",arguments),!0!==this.settings.openNearest||void 0===t||void 0===z||!0===this.settings.fullMapStart&&!0===W&&!1===this.settings.querystringParams||!0===this.settings.defaultLoc&&!0===W&&!1===this.settings.querystringParams||((n=this).settings.callbackNearestLoc&&n.settings.callbackNearestLoc.call(this,n.map,t,e,s,i),t=t.hasOwnProperty("markerid")?t.markerid:0,a=tt[t],n.createInfowindow(a,"left",e,s,i),a=E("."+n.settings.locationList),e=E("."+n.settings.locationList+" li[data-markerid="+t+"]"),E("."+n.settings.locationList+" li").removeClass("list-focus"),e.addClass("list-focus"),a.animate({scrollTop:e.offset().top-a.offset().top+a.scrollTop()}))},listClick:function(s,i,n,a){this.writeDebug("listClick",arguments);var o=this;E(_).on("click."+it,"."+o.settings.locationList+" li",function(){var t=E(this).data("markerid"),e=tt[t];o.settings.callbackListClick&&o.settings.callbackListClick.call(this,t,e,X[t],s),s.panTo(e.getPosition());o.createInfowindow(e,"left",i,n,a),null!==o.settings.selectedMarkerImg&&o.changeSelectedMarker(e),E("."+o.settings.locationList+" li").removeClass("list-focus"),E("."+o.settings.locationList+" li[data-markerid="+t+"]").addClass("list-focus")}),E(_).on("click."+it,"."+o.settings.locationList+" li a",function(t){t.stopPropagation()})},resultsTotalCount:function(t){this.writeDebug("resultsTotalCount",arguments);var e=E(".bh-sl-total-results");void 0===t||t<=0||0===e.length||e.text(t)},inlineDirections:function(e,s){var i;this.writeDebug("inlineDirections",arguments),!0===this.settings.inlineDirections&&void 0!==s&&(i=this,E(_).on("click."+it,"."+i.settings.locationList+" li .loc-directions a",function(t){t.preventDefault();t=E(this).closest("li").attr("data-markerid");i.directionsRequest(s,parseInt(t),e),E(_).on("click."+it,"."+i.settings.locationList+" .bh-sl-close-icon",function(){i.closeDirections()})}))},visibleMarkersList:function(t,e){var s;this.writeDebug("visibleMarkersList",arguments),!0===this.settings.visibleMarkersList&&(s=this,google.maps.event.addListenerOnce(t,"idle",function(){s.checkVisibleMarkers(e,t)}),google.maps.event.addListener(t,"center_changed",function(){s.checkVisibleMarkers(e,t)}),google.maps.event.addListener(t,"zoom_changed",function(){s.checkVisibleMarkers(e,t)}))},featuredDistanceRestriction:function(){this.writeDebug("featuredDistanceRestriction",arguments);var e=this;return Z=E.grep(Z,function(t){if(t.hasOwnProperty("distance"))return parseFloat(t.distance)<=parseFloat(e.settings.featuredDistance)})},featuredRestrictions:function(t){return this.writeDebug("featuredRestrictions",arguments),Z=null!==this.settings.featuredDistance&&null!==this.settings.featuredDistance?this.featuredDistanceRestriction(t):Z},mapping:function(e){this.writeDebug("mapping",arguments);var t,s,i,n,a,o,r=this;this.isEmptyObject(e)||(t=e.lat,s=e.lng,i=e.geocodeResult,n=e.origin,o=e.page),!0!==r.settings.pagination||void 0!==o&&z===H||(o=0),q=void 0===n&&!0===this.settings.nameSearch?r._getData():(a=new google.maps.LatLng(t,s),void 0!==z&&n===z&&void 0!==Q?(n=z,Q):r._getData(l,g,n,i,e)),null!==r.settings.taxonomyFilters&&r.hasEmptyObjectVals(et)&&r.checkFilters(),null!==r.settings.dataRaw?r.processData(e,a,q,o):q.done(function(t){r.processData(e,a,t,o)})},resetDisabledFilterVals:function(){for(var t in this.writeDebug("resetDisabledFilterVals"),this.settings.taxonomyFilters)if(this.settings.taxonomyFilters.hasOwnProperty(t))for(var e=0;er)&&m.notify(m.settings.distanceErrorAlert+r+" "+D);else{if(void 0===X[0])throw m.emptyResult(),new Error("No locations found. Please check the dataLocation setting and path.");-1!==m.settings.distanceAlert&&X[0].distance>m.settings.distanceAlert&&(m.notify(m.settings.distanceErrorAlert+m.settings.distanceAlert+" "+D),h=!0)}void 0!==X[0]&&(d=X[0])}if(!0===m.settings.featuredLocations&&(Z=E.grep(X,function(t){if(t.hasOwnProperty("featured"))return"true"===t.featured}),Z=m.featuredRestrictions(t),Y=E.grep(X,function(t){if(t.hasOwnProperty("featured"))return"true"!==t.featured}),X=[],X=Z.concat(Y)),!0!==W&&null!==this.settings.taxonomyFilters&&!1===this.settings.exclusiveFiltering&&m.maybeDisableFilterOptions(),!0===m.settings.slideMap&&j.slideDown(),!0===m.settings.pagination&&m.paginationSetup(i),!0===m.settings.altDistanceNoResult&&d.distance>m.settings.distanceAlert)m.emptyResult();else if(m.isEmptyObject(X)||"none"===X[0].result)m.emptyResult();else{m.modalWindow(),K=-1===m.settings.storeLimit||X.lengthX.length&&(c=m.settings.locationsPerPage-(g+c-X.length)),X=X.slice(g,g+c),K=X.length):(c=K,g=0),m.resultsTotalCount(X.length),!0===m.settings.fullMapStart&&!0===W&&!0!==m.settings.querystringParams||0===m.settings.mapSettings.zoom||void 0===o||!0===h||!0===m.settings.maxDistance&&!1===W&&0m.settings.fullMapStartListLimit)for(var G=0;G li:even").css("background",m.settings.listColor1),E("."+m.settings.locationList+" ul > li:odd").css("background",m.settings.listColor2),m.visibleMarkersList(m.map,tt),!0===m.settings.querystringParams&&(D=E("#"+m.settings.addressID),P=E("#"+m.settings.searchID),void 0!==st&&st.hasOwnProperty("origin")&&""===D.val()&&D.val(st.origin),void 0!==st)&&st.hasOwnProperty("name")&&""===P.val()&&P.val(st.name),!0===m.settings.modal&&m.settings.callbackModalReady&&m.settings.callbackModalReady.call(this,t),m.settings.callbackFilters&&m.settings.callbackFilters.call(this,et,t)}},writeDebug:function(){N.console&&this.settings.debug&&(Function.prototype.bind?this.writeDebug=Function.prototype.bind.call(console.log,console,"StoreLocator :"):this.writeDebug=function(){arguments[0]="StoreLocator : "+arguments[0],Function.prototype.apply.call(console.log,console,arguments)},this.writeDebug.apply(this,arguments))}}),E.fn[it]=function(e){var s,i=arguments;return e===t||"object"==typeof e?this.each(function(){E.data(this,"plugin_"+it)||E.data(this,"plugin_"+it,new m(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?(this.each(function(){var t=E.data(this,"plugin_"+it);t instanceof m&&"function"==typeof t[e]&&(s=t[e].apply(t,Array.prototype.slice.call(i,1))),"destroy"===e&&E.data(this,"plugin_"+it,null)}),s!==t?s:this):void 0})}(jQuery,window,document); \ No newline at end of file +!function(E,N,_,t){"use strict";var j,a,r,c,z,Q,V,q,U,H,l,g,K,i,n,s,o,W,J,$,h,Z,X,Y,tt,et,u,d,st,p,it="storeLocator";function m(t,e){j=E(t),this.element=t,this.settings=E.extend({},p,e),this._defaults=p,this._name=it,this.init()}void 0===E.fn[it]&&"undefined"!=typeof google&&(p={ajaxData:null,altDistanceNoResult:!(st={}),autoComplete:!(d={}),autoCompleteDisableListener:!(u={}),autoCompleteOptions:{},autoGeocode:!(et={}),bounceMarker:!0,catMarkers:null,dataLocation:"data/locations.json",dataRaw:null,dataType:"json",debug:!(tt=[]),defaultLat:null,defaultLng:null,defaultLoc:!(Y=[]),disableAlphaMarkers:!(X=[]),distanceAlert:60,dragSearch:!(Z=[]),exclusiveFiltering:!1,exclusiveTax:null,featuredDistance:null,featuredLocations:!1,fullMapStart:!1,fullMapStartBlank:!1,fullMapStartListLimit:!1,infoBubble:null,inlineDirections:!1,lengthUnit:"m",listColor1:"#ffffff",listColor2:"#eeeeee",loading:!1,locationsPerPage:10,mapSettings:{mapTypeId:google.maps.MapTypeId.ROADMAP,zoom:12},markerCluster:null,markerImg:null,markerDim:null,maxDistance:!1,modal:!1,nameAttribute:"name",nameSearch:!1,noForm:!1,openNearest:!1,originMarker:!1,originMarkerDim:null,originMarkerImg:null,pagination:!1,querystringParams:!1,selectedMarkerImg:null,selectedMarkerImgDim:null,sessionStorage:!1,slideMap:!0,sortBy:null,storeLimit:26,taxonomyFilters:null,visibleMarkersList:!1,xmlElement:"marker",addressID:"bh-sl-address",closeIcon:"bh-sl-close-icon",formContainer:"bh-sl-form-container",formID:"bh-sl-user-location",geocodeID:null,lengthSwapID:"bh-sl-length-swap",loadingContainer:"bh-sl-loading",locationList:"bh-sl-loc-list",mapID:"bh-sl-map",maxDistanceID:"bh-sl-maxdistance",modalContent:"bh-sl-modal-content",modalWindow:"bh-sl-modal-window",orderID:"bh-sl-order",overlay:"bh-sl-overlay",regionID:"bh-sl-region",searchID:"bh-sl-search",sortID:"bh-sl-sort",taxonomyFiltersContainer:"bh-sl-filters-container",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,callbackAutoGeoSuccess:null,callbackBeforeSend:null,callbackCloseDirections:null,callbackCreateMarker:null,callbackDirectionsRequest:null,callbackFilters:null,callbackFormVals:null,callbackGeocodeRestrictions:null,callbackJsonp:null,callbackListClick:null,callbackMapSet:null,callbackMarkerClick:null,callbackModalClose:null,callbackModalOpen:null,callbackModalReady:null,callbackNearestLoc:null,callbackNoResults:null,callbackNotify:null,callbackOrder:null,callbackPageChange:null,callbackRegion:null,callbackSorting:null,callbackSuccess: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 ",kilometerLang:"kilometer",kilometersLang:"kilometers",mileLang:"mile",milesLang:"miles",noResultsTitle:"No results",noResultsDesc:"No locations were found with the given criteria. Please modify your selections or input.",nextPage:"Next »",prevPage:"« Prev"},E.extend(m.prototype,{init:function(){var t,e=this;this.writeDebug("init"),"km"===this.settings.lengthUnit?d.EarthRadius=6367:d.EarthRadius=3956,c="kml"===this.settings.dataType?"xml":this.settings.dataType,!0===this.settings.inlineDirections&&E("."+this.settings.locationList).prepend('
    '),V=this.settings.mapSettings.zoom,Handlebars.registerHelper("niceURL",function(t){if(t)return t.replace("https://","").replace("http://","")}),null!==this.settings.taxonomyFilters&&this.taxonomyFiltering(),this.sorting(),this.order(),!0===this.settings.modal&&(null!==this.settings.taxonomyFilters&&E("."+this.settings.taxonomyFiltersContainer).clone(!0,!0).prependTo(j),j.wrap('
    '),E("."+this.settings.modalWindow).prepend('
    '),E("."+this.settings.overlay).hide()),!0===this.settings.autoComplete&&(t=_.getElementById(this.settings.addressID),t=new google.maps.places.Autocomplete(t,this.settings.autoCompleteOptions),!0===this.settings.autoComplete)&&!0!==this.settings.autoCompleteDisableListener&&t.addListener("place_changed",function(t){e.processForm(t)}),this._loadTemplates()},destroy:function(){this.writeDebug("destroy"),this.reset();var t=E("#"+this.settings.mapID);if(tt.length)for(var e=0;e<=tt.length;e++)google.maps.event.removeListener(tt[e]);E("."+this.settings.locationList+" ul").empty(),t.hasClass("bh-sl-map-open")&&t.empty().removeClass("bh-sl-map-open"),!0===this.settings.modal&&E(". "+this.settings.overlay).remove(),t.attr("style",""),j.hide(),E.removeData(j.get(0)),E(_).off(it),j.unbind()},reset:function(){var t;this.writeDebug("reset"),X=[],Z=[],Y=[],W=!(tt=[]),E(_).off("click."+it,"."+this.settings.locationList+" li"),E("."+this.settings.locationList+" .bh-sl-close-directions-container").length&&E(".bh-sl-close-directions-container").remove(),!0===this.settings.inlineDirections&&(0<(t=E("."+this.settings.locationList+" .adp")).length&&(t.remove(),E("."+this.settings.locationList+" ul").fadeIn()),E(_).off("click","."+this.settings.locationList+" li .loc-directions a")),!0===this.settings.pagination&&E(_).off("click."+it,".bh-sl-pagination li")},formFiltersReset:function(){var t,e;this.writeDebug("formFiltersReset"),null!==this.settings.taxonomyFilters&&(t=E("."+this.settings.taxonomyFiltersContainer+" input"),e=E("."+this.settings.taxonomyFiltersContainer+" select"),"object"==typeof t)&&(t.each(function(){(E(this).is('input[type="checkbox"]')||E(this).is('input[type="radio"]'))&&E(this).prop("checked",!1)}),e.each(function(){E(this).prop("selectedIndex",0)}))},mapReload:function(){this.writeDebug("mapReload"),this.reset(),J=!0,null!==this.settings.taxonomyFilters&&(this.formFiltersReset(),this.resetDisabledFilterVals(),this.taxonomyFiltersInit()),l&&g?(this.settings.mapSettings.zoom=V,this.processForm()):this.mapping(st)},notify:function(t){this.writeDebug("notify",t),this.settings.callbackNotify?this.settings.callbackNotify.call(this,t):alert(t)},geoCodeCalcToRadian:function(t){return this.writeDebug("geoCodeCalcToRadian",t),t*(Math.PI/180)},geoCodeCalcDiffRadian:function(t,e){return this.writeDebug("geoCodeCalcDiffRadian",arguments),this.geoCodeCalcToRadian(e)-this.geoCodeCalcToRadian(t)},geoCodeCalcCalcDistance:function(t,e,s,i,n){return this.writeDebug("geoCodeCalcCalcDistance",arguments),2*n*Math.asin(Math.min(1,Math.sqrt(Math.pow(Math.sin(this.geoCodeCalcDiffRadian(t,s)/2),2)+Math.cos(this.geoCodeCalcToRadian(t))*Math.cos(this.geoCodeCalcToRadian(s))*Math.pow(Math.sin(this.geoCodeCalcDiffRadian(e,i)/2),2))))},inRange:function(t,e,s){return this.writeDebug("inRange",arguments),e=Math.abs(e),isFinite(e)&&t<=e&&e<=s},coordinatesInRange:function(t,e){return this.writeDebug("coordinatesInRange",arguments),this.inRange(-90,t,90)&&this.inRange(-180,e,180)},getQueryString:function(t){if(this.writeDebug("getQueryString",t),t)return t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),null===(t=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search))?"":decodeURIComponent(t[1].replace(/\+/g," "))},getMap:function(){return this.map},_loadTemplates:function(){this.writeDebug("_loadTemplates");var e,t=this,s='
    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?E.when(E.get(this.settings.KMLinfowindowTemplatePath,function(t){e=t,r=Handlebars.compile(e)}),E.get(this.settings.KMLlistTemplatePath,function(t){e=t,a=Handlebars.compile(e)})).then(function(){t.locator()},function(){throw E("."+t.settings.formContainer).append(s),new Error("Could not load storeLocator plugin templates")}):null!==this.settings.listTemplateID&&null!==this.settings.infowindowTemplateID?(r=Handlebars.compile(E("#"+this.settings.infowindowTemplateID).html()),a=Handlebars.compile(E("#"+this.settings.listTemplateID).html()),t.locator()):E.when(E.get(this.settings.infowindowTemplatePath,function(t){e=t,r=Handlebars.compile(e)}),E.get(this.settings.listTemplatePath,function(t){e=t,a=Handlebars.compile(e)})).then(function(){t.locator()},function(){throw E("."+t.settings.formContainer).append(s),new Error("Could not load storeLocator plugin templates")})},locator:function(){this.writeDebug("locator"),!0===this.settings.slideMap&&j.hide(),this._start(),this._formEventHandler()},_formEventHandler:function(){this.writeDebug("_formEventHandler");var e=this;!0===this.settings.noForm?(E(_).on("click."+it,"."+this.settings.formContainer+" button",function(t){e.processForm(t)}),E(_).on("keydown."+it,function(t){13===t.keyCode&&E("#"+e.settings.addressID).is(":focus")&&e.processForm(t)})):E(_).on("submit."+it,"#"+this.settings.formID,function(t){e.processForm(t)}),E(".bh-sl-reset").length&&E("#"+this.settings.mapID).length&&E(_).on("click."+it,".bh-sl-reset",function(){e.mapReload()}),E("#"+this.settings.addressID).on("change."+it,function(){h=t,""!==E.trim(E("#"+e.settings.addressID).val())||void 0!==U&&""!==U||null!==e.settings.taxonomyFilters&&!1===e.settings.exclusiveFiltering&&(z=g=l=t,st={},e.resetDisabledFilterVals(),e.taxonomyFiltersInit(),e.mapping(null))})},_getData:function(t,e,s,i,n){this.writeDebug("_getData",arguments);var a,o=this,r="",l="",g="";return void 0!==i&&void 0!==i.geometry.bounds&&(g=i.formatted_address,r=JSON.stringify(i.geometry.bounds.getNorthEast()),l=JSON.stringify(i.geometry.bounds.getSouthWest())),this.settings.callbackBeforeSend&&this.settings.callbackBeforeSend.call(this,t,e,s,g,r,l,n),null!==o.settings.dataRaw?"xml"===c?E.parseXML(o.settings.dataRaw):"json"===c?Array.isArray&&Array.isArray(o.settings.dataRaw)?o.settings.dataRaw:"string"==typeof o.settings.dataRaw?JSON.parse(o.settings.dataRaw):[]:void 0:(a=E.Deferred(),!0===this.settings.loading&&E("."+this.settings.formContainer).append('
    '),i={origLat:t,origLng:e,origAddress:s,formattedAddress:g,boundsNorthEast:r,boundsSouthWest:l},null!==this.settings.ajaxData&&"object"==typeof this.settings.ajaxData&&E.extend(i,this.settings.ajaxData),E.ajax({type:"GET",url:this.settings.dataLocation+("jsonp"===this.settings.dataType?(this.settings.dataLocation.match(/\?/)?"&":"?")+"callback=?":""),data:i,dataType:c,jsonpCallback:"jsonp"===this.settings.dataType?this.settings.callbackJsonp:null}).done(function(t){a.resolve(t),!0===o.settings.loading&&E("."+o.settings.formContainer+" ."+o.settings.loadingContainer).remove()}).fail(a.reject),a.promise())},_start:function(){this.writeDebug("_start");var t,e,s=this,i=this.settings.autoGeocode;!1!==s.settings.fullMapStartBlank?(E("#"+s.settings.mapID).addClass("bh-sl-map-open"),(e=s.settings.mapSettings).zoom=s.settings.fullMapStartBlank,t=new google.maps.LatLng(this.settings.defaultLat,this.settings.defaultLng),e.center=t,s.map=new google.maps.Map(_.getElementById(s.settings.mapID),e),N.addEventListener("resize",function(){var t=s.map.getCenter();google.maps.event.trigger(s.map,"resize"),s.map.setCenter(t)}),s.settings.fullMapStartBlank=!1,e.zoom=V):(!0===this.settings.defaultLoc&&this.defaultLocation(),""!==E.trim(E("#"+this.settings.addressID).val())?(s.writeDebug("Using Address Field"),s.processForm(null),i=!1):!0===this.settings.fullMapStart&&!1===this.settings.defaultLoc&&(!0===this.settings.querystringParams&&this.getQueryString(this.settings.addressID)||!0===this.settings.querystringParams&&this.getQueryString(this.settings.searchID)||!0===this.settings.querystringParams&&this.getQueryString(this.settings.maxDistanceID)?(s.writeDebug("Using Query String"),this.processForm(null),i=!1):this.mapping(null))),!0===this.settings.autoGeocode&&!0===i&&(s.writeDebug("Auto Geo"),s.htmlGeocode()),null!==this.settings.autoGeocode&&(s.writeDebug("Button Geo"),E(_).on("click."+it,"#"+this.settings.geocodeID,function(){s.htmlGeocode()}))},htmlGeocode:function(){this.writeDebug("htmlGeocode",arguments);var e=this;if(!0===e.settings.sessionStorage&&N.sessionStorage&&N.sessionStorage.getItem("myGeo"))return e.writeDebug("Using Session Saved Values for GEO"),e.autoGeocodeQuery(JSON.parse(N.sessionStorage.getItem("myGeo"))),!1;navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(t){e.writeDebug("Current Position Result");t={coords:{latitude:t.coords.latitude,longitude:t.coords.longitude,accuracy:t.coords.accuracy}};!0===e.settings.sessionStorage&&N.sessionStorage&&N.sessionStorage.setItem("myGeo",JSON.stringify(t)),e.settings.callbackAutoGeoSuccess&&e.settings.callbackAutoGeoSuccess.call(this,t),e.autoGeocodeQuery(t)},function(t){e._autoGeocodeError(t)})},googleGeocode:function(t){t.writeDebug("googleGeocode",arguments);var e=new google.maps.Geocoder;this.geocode=function(t,s){e.geocode(t,function(t,e){if(e!==google.maps.GeocoderStatus.OK)throw s(null),new Error("Geocode was not successful for the following reason: "+e);e={};e.latitude=t[0].geometry.location.lat(),e.longitude=t[0].geometry.location.lng(),e.geocodeResult=t[0],s(e)})}},reverseGoogleGeocode:function(t){t.writeDebug("reverseGoogleGeocode",arguments);var e=new google.maps.Geocoder;this.geocode=function(t,s){e.geocode(t,function(t,e){if(e!==google.maps.GeocoderStatus.OK)throw s(null),new Error("Reverse geocode was not successful for the following reason: "+e);t[0]&&((e={}).address=t[0].formatted_address,e.fullResult=t[0],s(e))})}},roundNumber:function(t,e){return this.writeDebug("roundNumber",arguments),Math.round(t*Math.pow(10,e))/Math.pow(10,e)},isEmptyObject:function(t){for(var e in this.writeDebug("isEmptyObject",arguments),t)if(t.hasOwnProperty(e))return!1;return!0},hasEmptyObjectVals:function(t){this.writeDebug("hasEmptyObjectVals",arguments);var e,s=!0;for(e in t)t.hasOwnProperty(e)&&""!==t[e]&&0!==t[e].length&&(s=!1);return s},hasSingleGroupFilterVal:function(t,e){this.writeDebug("hasSingleGroupFilterVal",arguments);t=Object.assign({},t);return!this.hasEmptyObjectVals(t[e])},modalClose:function(){this.writeDebug("modalClose"),this.settings.callbackModalClose&&this.settings.callbackModalClose.call(this),et={},E("."+this.settings.overlay+" select").prop("selectedIndex",0),E("."+this.settings.overlay+" input").prop("checked",!1),E("."+this.settings.overlay).hide()},_createLocationVariables:function(t){var e,s;for(s in this.writeDebug("_createLocationVariables",arguments),u={},X[t])X[t].hasOwnProperty(s)&&(e=X[t][s],"distance"!==s&&"altdistance"!==s||(e=this.roundNumber(e,2)),u[s]=e)},sortAlpha:function(t){this.writeDebug("sortAlpha",arguments);var s=this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"name";this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return e[s].toLowerCase().localeCompare(t[s].toLowerCase())}):t.sort(function(t,e){return t[s].toLowerCase().localeCompare(e[s].toLowerCase())})},sortDate:function(t){this.writeDebug("sortDate",arguments);var s=this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"date";this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return new Date(e[s]).getTime()-new Date(t[s]).getTime()}):t.sort(function(t,e){return new Date(t[s]).getTime()-new Date(e[s]).getTime()})},sortNumerically:function(t,e){this.writeDebug("sortNumerically",arguments);var s=null!==this.settings.sortBy&&this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"distance";void 0!==e&&!0===e&&(s="distance"),null!==this.settings.sortBy&&this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return e[s]t[s]?1:0}):t.sort(function(t,e){return t[s]e[s]?1:0})},sortCustom:function(t){this.writeDebug("sortCustom",arguments),this.settings.sortBy.hasOwnProperty("method")&&"alpha"===this.settings.sortBy.method.toString()?this.sortAlpha(t):this.settings.sortBy.hasOwnProperty("method")&&"date"===this.settings.sortBy.method.toString()?this.sortDate(t):this.sortNumerically(t)},filterMatching:function(t,e,s){return this.writeDebug("inclusiveFilter",arguments),void 0!==e&&(s=!0===(s=void 0===s||s)?t.join(""):t.join("|"),!!new RegExp(s,"i").test(e.replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g,"")))},filterData:function(t,e){this.writeDebug("filterData",arguments);var s,i=!0;for(s in e)if(e.hasOwnProperty(s)){for(var n=[],a=0;a'+this.settings.prevPage+"");for(var n=0;n'+a+"":'
  • '+a+"
  • "}return i'+this.settings.nextPage+""),s},paginationSetup:function(t){this.writeDebug("paginationSetup",arguments);var e="",s=E(".bh-sl-pagination-container .bh-sl-pagination"),i=-1===this.settings.storeLimit||X.length ul").append(e)},changeSelectedMarker:function(t){var e;void 0!==o&&o.setIcon(s),e=null===this.settings.selectedMarkerImgDim?this.markerImage(this.settings.selectedMarkerImg):this.markerImage(this.settings.selectedMarkerImg,this.settings.selectedMarkerImgDim.width,this.settings.selectedMarkerImgDim.height),s=t.icon,t.setIcon(e),o=t},createInfowindow:function(s,t,i,e,n){this.writeDebug("createInfowindow",arguments);var a=this,e=this._defineLocationData(s,e,n),o=r(e);"left"===t?(i.setContent(o),i.open(s.get("map"),s)):google.maps.event.addListener(s,"click",function(){i.setContent(o),i.open(s.get("map"),s);var t=s.get("id"),e=E("."+a.settings.locationList+" li[data-markerid="+t+"]");0
    ')),E(_).off("click","."+this.settings.locationList+" li .loc-directions a")},closeDirections:function(){this.writeDebug("closeDirections"),this.settings.callbackCloseDirections&&this.settings.callbackCloseDirections.call(this),this.reset(),l&&g&&(0===this.countFilters()?this.settings.mapSettings.zoom=V:this.settings.mapSettings.zoom=0,this.processForm(null)),E(_).off("click."+it,"."+this.settings.locationList+" .bh-sl-close-icon")},lengthUnitSwap:function(t){this.writeDebug("lengthUnitSwap",arguments),"alt-distance"===t.val()?(E("."+this.settings.locationList+" .loc-alt-dist").show(),E("."+this.settings.locationList+" .loc-default-dist").hide()):"default-distance"===t.val()&&(E("."+this.settings.locationList+" .loc-default-dist").show(),E("."+this.settings.locationList+" .loc-alt-dist").hide())},processForm:function(t){this.writeDebug("processForm",arguments);var e=this,s=null,i={},n=E("#"+this.settings.addressID),a=E("#"+this.settings.searchID),o=E("#"+this.settings.maxDistanceID),r="";null!=t&&t.preventDefault(),E("."+e.settings.formContainer+" input, ."+e.settings.formContainer+" select").blur(),!0===this.settings.querystringParams&&(this.getQueryString(this.settings.addressID)||this.getQueryString(this.settings.searchID)||this.getQueryString(this.settings.maxDistanceID))?(H=this.getQueryString(this.settings.addressID),U=this.getQueryString(this.settings.searchID),s=this.getQueryString(this.settings.maxDistanceID),""!==n.val()&&(H=n.val()),""!==a.val()&&(U=a.val()),""!==o.val()&&(s=o.val())):(H=n.val()||"",U=a.val()||"",!0===this.settings.maxDistance&&(s=o.val()||"")),r=this.settings.callbackRegion?this.settings.callbackRegion.call(this,H,U,s):E("#"+this.settings.regionID).val(),this.settings.callbackFormVals&&this.settings.callbackFormVals.call(this,H,U,s,r),void 0!==r&&(i={country:r}),"function"==typeof this.settings.callbackGeocodeRestrictions&&(i=this.settings.callbackGeocodeRestrictions.call(this,H,U,s)),""===H&&""===U&&!0!==this.settings.autoGeocode?this._start():""!==H?(""===U&&et.hasOwnProperty("name")&&delete et.name,void 0!==z&&void 0!==l&&void 0!==g&&H===z?(st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,e.mapping(st)):new this.googleGeocode(this).geocode({address:H,componentRestrictions:i,region:r},function(t){null!==t?(l=t.latitude,g=t.longitude,st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,st.geocodeResult=t.geocodeResult,e.mapping(st)):e.notify(e.settings.addressErrorAlert)})):""!==U?(""===H&&delete st.origin,st.name=U,e.mapping(st)):!0===this.settings.autoGeocode&&(st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,e.mapping(st))},locationsSetup:function(t,e,s,i,n){this.writeDebug("locationsSetup",arguments),void 0===i||t.distance||(t.distance=this.geoCodeCalcCalcDistance(e,s,t.lat,t.lng,d.EarthRadius),"m"===this.settings.lengthUnit?t.altdistance=1.609344*parseFloat(t.distance):"km"===this.settings.lengthUnit&&(t.altdistance=parseFloat(t.distance)/1.609344)),this.coordinatesInRange(t.lat,t.lng)?!0===this.settings.maxDistance&&null!=n?t.distance<=n?X.push(t):this.writeDebug("locationsSetup","location ignored because it is out of maxDistance: "+n,t):!0!==this.settings.maxDistance||!0!==this.settings.querystringParams||null==n||t.distance<=n?X.push(t):this.writeDebug("locationsSetup","location ignored because it is out of maxDistance: "+n,t):this.writeDebug("locationsSetup","location ignored because coordinates out of range: "+n,t)},sorting:function(){this.writeDebug("sorting",arguments);var s=this,i=E("#"+s.settings.mapID),t=E("#"+s.settings.sortID);0!==t.length&&t.on("change."+it,function(t){var e;t.stopPropagation(),!0===s.settings.pagination&&s.paginationChange(0),t=void 0!==E(this).find(":selected").attr("data-method")?E(this).find(":selected").attr("data-method"):"distance",e=E(this).val(),s.settings.sortBy.method=t,s.settings.sortBy.prop=e,s.settings.callbackSorting&&s.settings.callbackSorting.call(this,s.settings.sortBy),i.hasClass("bh-sl-map-open")&&s.mapping(st)})},order:function(){this.writeDebug("order",arguments);var e=this,s=E("#"+e.settings.mapID),t=E("#"+e.settings.orderID);0!==t.length&&t.on("change."+it,function(t){t.stopPropagation(),!0===e.settings.pagination&&e.paginationChange(0),e.settings.sortBy.order=E(this).val(),e.settings.callbackOrder&&e.settings.callbackOrder.call(this,e.settings.order),s.hasClass("bh-sl-map-open")&&e.mapping(st)})},countFilters:function(){this.writeDebug("countFilters");var t=0;if(!this.isEmptyObject(et))for(var e in et)et.hasOwnProperty(e)&&(t+=et[e].length);return t},_existingCheckedFilters:function(e){this.writeDebug("_existingCheckedFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" input[type=checkbox]").each(function(){var t;E(this).prop("checked")&&void 0!==(t=E(this).val())&&""!==t&&-1===et[e].indexOf(t)&&et[e].push(t)})},_existingSelectedFilters:function(e){this.writeDebug("_existingSelectedFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" select").each(function(){var t=E(this).val();void 0!==t&&""!==t&&-1===et[e].indexOf(t)&&(et[e]=[t])})},_existingRadioFilters:function(e){this.writeDebug("_existingRadioFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" input[type=radio]").each(function(){var t;E(this).prop("checked")&&void 0!==(t=E(this).val())&&""!==t&&-1===et[e].indexOf(t)&&(et[e]=[t])})},checkFilters:function(){for(var t in this.writeDebug("checkFilters"),this.settings.taxonomyFilters)this.settings.taxonomyFilters.hasOwnProperty(t)&&(this._existingCheckedFilters(t),this._existingSelectedFilters(t),this._existingRadioFilters(t))},selectQueryStringFilters:function(t,e){this.writeDebug("selectQueryStringFilters",arguments);var s=E("#"+this.settings.taxonomyFilters[t]);if(s.find('input[type="checkbox"]').length)for(var i=0;i ul").append(i))}),E("."+this.settings.locationList+" ul li:even").css("background",this.settings.listColor1),E("."+this.settings.locationList+" ul li:odd").css("background",this.settings.listColor2)},dragSearch:function(t){this.writeDebug("dragSearch",arguments);var e=t.getCenter(),s=this,t=(this.settings.mapSettings.zoom=t.getZoom(),l=st.lat=e.lat(),g=st.lng=e.lng(),new this.reverseGoogleGeocode(this)),e=new google.maps.LatLng(st.lat,st.lng);t.geocode({latLng:e},function(t){null!==t?(st.origin=H=t.address,s.mapping(st)):s.notify(s.settings.addressErrorAlert)})},emptyResult:function(){this.writeDebug("emptyResult",arguments);var t=E("."+this.settings.locationList+" ul"),e=this.settings.mapSettings;this.map=new google.maps.Map(_.getElementById(this.settings.mapID),e),this.settings.callbackNoResults&&this.settings.callbackNoResults.call(this,this.map,e),t.empty(),e=E('
  • '+this.settings.noResultsTitle+'

    '+this.settings.noResultsDesc+"
  • ").hide().fadeIn(),t.append(e),t=l&&g?new google.maps.LatLng(l,g):new google.maps.LatLng(0,0),this.map.setCenter(t),V&&this.map.setZoom(V)},originMarker:function(t,e,s){var i;this.writeDebug("originMarker",arguments),!0===this.settings.originMarker&&(i="",void 0!==e)&&(i=null!==this.settings.originMarkerImg?null===this.settings.originMarkerDim?this.markerImage(this.settings.originMarkerImg):this.markerImage(this.settings.originMarkerImg,this.settings.originMarkerDim.width,this.settings.originMarkerDim.height):{url:"https://mt.googleapis.com/vt/icon/name=icons/spotlight/spotlight-waypoint-a.png"},new google.maps.Marker({position:s,map:t,icon:i,draggable:!1}))},modalWindow:function(){var e;this.writeDebug("modalWindow"),!0===this.settings.modal&&((e=this).settings.callbackModalOpen&&e.settings.callbackModalOpen.call(this),E("."+e.settings.overlay).fadeIn(),E(_).on("click."+it,"."+e.settings.closeIcon+", ."+e.settings.overlay,function(){e.modalClose()}),E(_).on("click."+it,"."+e.settings.modalWindow,function(t){t.stopPropagation()}),E(_).on("keyup."+it,function(t){27===t.keyCode&&e.modalClose()}))},openNearestLocation:function(t,e,s,i){var n,a;this.writeDebug("openNearestLocation",arguments),!0!==this.settings.openNearest||void 0===t||void 0===z||!0===this.settings.fullMapStart&&!0===W&&!1===this.settings.querystringParams||!0===this.settings.defaultLoc&&!0===W&&!1===this.settings.querystringParams||((n=this).settings.callbackNearestLoc&&n.settings.callbackNearestLoc.call(this,n.map,t,e,s,i),t=t.hasOwnProperty("markerid")?t.markerid:0,a=tt[t],n.createInfowindow(a,"left",e,s,i),a=E("."+n.settings.locationList),e=E("."+n.settings.locationList+" li[data-markerid="+t+"]"),E("."+n.settings.locationList+" li").removeClass("list-focus"),e.addClass("list-focus"),a.animate({scrollTop:e.offset().top-a.offset().top+a.scrollTop()}))},listClick:function(s,i,n,a){this.writeDebug("listClick",arguments);var o=this;E(_).on("click."+it,"."+o.settings.locationList+" li",function(){var t=E(this).data("markerid"),e=tt[t];o.settings.callbackListClick&&o.settings.callbackListClick.call(this,t,e,X[t],s),s.panTo(e.getPosition());o.createInfowindow(e,"left",i,n,a),null!==o.settings.selectedMarkerImg&&o.changeSelectedMarker(e),E("."+o.settings.locationList+" li").removeClass("list-focus"),E("."+o.settings.locationList+" li[data-markerid="+t+"]").addClass("list-focus")}),E(_).on("click."+it,"."+o.settings.locationList+" li a",function(t){t.stopPropagation()})},resultsTotalCount:function(t){this.writeDebug("resultsTotalCount",arguments);var e=E(".bh-sl-total-results");void 0===t||t<=0||0===e.length||e.text(t)},inlineDirections:function(e,s){var i;this.writeDebug("inlineDirections",arguments),!0===this.settings.inlineDirections&&void 0!==s&&(i=this,E(_).on("click."+it,"."+i.settings.locationList+" li .loc-directions a",function(t){t.preventDefault();t=E(this).closest("li").attr("data-markerid");i.directionsRequest(s,parseInt(t),e),E(_).on("click."+it,"."+i.settings.locationList+" .bh-sl-close-icon",function(){i.closeDirections()})}))},visibleMarkersList:function(t,e){var s;this.writeDebug("visibleMarkersList",arguments),!0===this.settings.visibleMarkersList&&(s=this,google.maps.event.addListenerOnce(t,"idle",function(){s.checkVisibleMarkers(e,t)}),google.maps.event.addListener(t,"center_changed",function(){s.checkVisibleMarkers(e,t)}),google.maps.event.addListener(t,"zoom_changed",function(){s.checkVisibleMarkers(e,t)}))},featuredDistanceRestriction:function(){this.writeDebug("featuredDistanceRestriction",arguments);var e=this;return Z=E.grep(Z,function(t){if(t.hasOwnProperty("distance"))return parseFloat(t.distance)<=parseFloat(e.settings.featuredDistance)})},featuredRestrictions:function(t){return this.writeDebug("featuredRestrictions",arguments),Z=null!==this.settings.featuredDistance&&null!==this.settings.featuredDistance?this.featuredDistanceRestriction(t):Z},mapping:function(e){this.writeDebug("mapping",arguments);var t,s,i,n,a,o,r=this;this.isEmptyObject(e)||(t=e.lat,s=e.lng,i=e.geocodeResult,n=e.origin,o=e.page),!0!==r.settings.pagination||void 0!==o&&z===H||(o=0),q=void 0===n&&!0===this.settings.nameSearch?r._getData():(a=new google.maps.LatLng(t,s),void 0!==z&&n===z&&void 0!==Q?(n=z,Q):r._getData(l,g,n,i,e)),null!==r.settings.taxonomyFilters&&r.hasEmptyObjectVals(et)&&r.checkFilters(),null!==r.settings.dataRaw?r.processData(e,a,q,o):q.done(function(t){r.processData(e,a,t,o)})},resetDisabledFilterVals:function(){for(var t in this.writeDebug("resetDisabledFilterVals"),this.settings.taxonomyFilters)if(this.settings.taxonomyFilters.hasOwnProperty(t))for(var e=0;er)&&m.notify(m.settings.distanceErrorAlert+r+" "+w);else{if(void 0===X[0])throw m.emptyResult(),new Error("No locations found. Please check the dataLocation setting and path.");-1!==m.settings.distanceAlert&&X[0].distance>m.settings.distanceAlert&&(m.notify(m.settings.distanceErrorAlert+m.settings.distanceAlert+" "+w),h=!0)}void 0!==X[0]&&(d=X[0])}if(!0===m.settings.featuredLocations&&(Z=E.grep(X,function(t){if(t.hasOwnProperty("featured"))return"true"===t.featured}),Z=m.featuredRestrictions(t),Y=E.grep(X,function(t){if(t.hasOwnProperty("featured"))return"true"!==t.featured}),X=[],X=Z.concat(Y)),(!0!==W&&!1===m.settings.exclusiveFiltering||!0===m.settings.fullMapStart&&!1===m.settings.exclusiveFiltering||!0===m.settings.defaultLoc&&!1===m.settings.exclusiveFiltering)&&m.maybeDisableFilterOptions(),!0===m.settings.slideMap&&j.slideDown(),!0===m.settings.pagination&&m.paginationSetup(i),!0===m.settings.altDistanceNoResult&&d.distance>m.settings.distanceAlert)m.emptyResult();else if(m.isEmptyObject(X)||"none"===X[0].result)m.emptyResult();else{m.modalWindow(),K=-1===m.settings.storeLimit||X.lengthX.length&&(c=m.settings.locationsPerPage-(g+c-X.length)),X=X.slice(g,g+c),K=X.length):(c=K,g=0),m.resultsTotalCount(X.length),!0===m.settings.fullMapStart&&!0===W&&!0!==m.settings.querystringParams||0===m.settings.mapSettings.zoom||void 0===o||!0===h||!0===m.settings.maxDistance&&!1===W&&0m.settings.fullMapStartListLimit)for(var G=0;G li:even").css("background",m.settings.listColor1),E("."+m.settings.locationList+" ul > li:odd").css("background",m.settings.listColor2),m.visibleMarkersList(m.map,tt),!0===m.settings.querystringParams&&(w=E("#"+m.settings.addressID),P=E("#"+m.settings.searchID),void 0!==st&&st.hasOwnProperty("origin")&&""===w.val()&&w.val(st.origin),void 0!==st)&&st.hasOwnProperty("name")&&""===P.val()&&P.val(st.name),!0===m.settings.modal&&m.settings.callbackModalReady&&m.settings.callbackModalReady.call(this,t),m.settings.callbackFilters&&m.settings.callbackFilters.call(this,et,t)}},writeDebug:function(){N.console&&this.settings.debug&&(Function.prototype.bind?this.writeDebug=Function.prototype.bind.call(console.log,console,"StoreLocator :"):this.writeDebug=function(){arguments[0]="StoreLocator : "+arguments[0],Function.prototype.apply.call(console.log,console,arguments)},this.writeDebug.apply(this,arguments))}}),E.fn[it]=function(e){var s,i=arguments;return e===t||"object"==typeof e?this.each(function(){E.data(this,"plugin_"+it)||E.data(this,"plugin_"+it,new m(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?(this.each(function(){var t=E.data(this,"plugin_"+it);t instanceof m&&"function"==typeof t[e]&&(s=t[e].apply(t,Array.prototype.slice.call(i,1))),"destroy"===e&&E.data(this,"plugin_"+it,null)}),s!==t?s:this):void 0})}(jQuery,window,document); \ No newline at end of file From 26ade28a320240c06a7a6f7b4f2c53d5f3e08194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Holine?= Date: Mon, 24 Jul 2023 23:30:47 -0700 Subject: [PATCH 3/5] Fix filter disabling functionality by globally tracking the disabled values --- .../storeLocator/jquery.storelocator.js | 28 +++++++++++++------ .../storeLocator/jquery.storelocator.min.js | 4 +-- src/js/jquery.storelocator.js | 26 +++++++++++------ 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/dist/assets/js/plugins/storeLocator/jquery.storelocator.js b/dist/assets/js/plugins/storeLocator/jquery.storelocator.js index 835be51..2e32be1 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 - v3.1.12 - 2023-07-22 +/*! jQuery Google Maps Store Locator - v3.1.12 - 2023-07-24 * http://www.bjornblog.com/web/jquery-store-locator-plugin * Copyright (c) 2023 Bjorn Holine; Licensed MIT */ @@ -15,7 +15,7 @@ // Variables used across multiple methods var $this, map, listTemplate, infowindowTemplate, dataTypeRead, originalOrigin, originalData, originalZoom, dataRequest, searchInput, addressInput, olat, olng, storeNum, directionsDisplay, directionsService, prevSelectedMarkerBefore, prevSelectedMarkerAfter, firstRun, reload, nameAttrs, originalFilterVals; var featuredset = [], locationset = [], normalset = [], markers = []; - var filters = {}, locationData = {}, GeoCodeCalc = {}, mappingObj = {}; + var filters = {}, locationData = {}, GeoCodeCalc = {}, mappingObj = {}, disabledFilterVals = {}; // Create the defaults once. DO NOT change these settings in this file - settings should be overridden in the plugin call var defaults = { @@ -565,6 +565,7 @@ // Track changes to the address search field. $('#' + this.settings.addressID).on('change.'+pluginName, function () { originalFilterVals = undefined; + disabledFilterVals = {}; // Unset origin tracking if input field is removed. if ( @@ -2854,7 +2855,6 @@ maybeDisableFilterOptions: function() { this.writeDebug('maybeDisableFilterOptions'); var availableValues = []; - var disabledValues = []; var _this = this; // Initially reset any input/option fields that were previously disabled. @@ -2877,7 +2877,12 @@ for (var i = 0; i < _this.settings.taxonomyFilters[key].length; i++) { if (_this.settings.taxonomyFilters.hasOwnProperty(key)) { $('#' + _this.settings.taxonomyFilters[key] + ' input, #' + _this.settings.taxonomyFilters[key] + ' option').each(function () { - if ($(this).val() !== '' && Array.from(new Set(availableValues[key].split(','))).indexOf($(this).val()) === -1) { + + // Initial determination of values that should be disabled. + if ($(this).val() !== '' && ! Array.from(new Set(availableValues[key].split(','))).includes($(this).val())) { + if (! disabledFilterVals.hasOwnProperty(key)) { + disabledFilterVals[key] = []; + } // Handle select options and radio button values when there is no address input. if ( @@ -2900,20 +2905,25 @@ return; } - // Keep radio button available values after one filter has been selected. + // Keep select options and radio button available values after one filter has been selected. if ( - $(this).prop('type') === 'radio' && + ($(this).prop('tagName') === 'OPTION' || $(this).prop('type') === 'radio') && _this.hasSingleGroupFilterVal(filters, key) && _this.countFilters() > 1 && - disabledValues.hasOwnProperty(key) && Array.from(new Set(originalFilterVals[key].split(','))).includes($(this).val()) && - ! Array.from(new Set(disabledValues[key].split(','))).includes($(this).val()) + ! disabledFilterVals[key].includes($(this).val()) ) { return; } // Track disabled values. - disabledValues[key] = $(this).val(); + if ( + disabledFilterVals.hasOwnProperty(key) && + Array.isArray(disabledFilterVals[key]) && + ! disabledFilterVals[key].includes($(this).val()) + ) { + disabledFilterVals[key].push($(this).val()); + } $(this).attr('disabled', true); } diff --git a/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js b/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js index 497335a..4c0eb2d 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 - v3.1.12 - 2023-07-22 +/*! jQuery Google Maps Store Locator - v3.1.12 - 2023-07-24 * http://www.bjornblog.com/web/jquery-store-locator-plugin * Copyright (c) 2023 Bjorn Holine; Licensed MIT */ -!function(E,N,_,t){"use strict";var j,a,r,c,z,Q,V,q,U,H,l,g,K,i,n,s,o,W,J,$,h,Z,X,Y,tt,et,u,d,st,p,it="storeLocator";function m(t,e){j=E(t),this.element=t,this.settings=E.extend({},p,e),this._defaults=p,this._name=it,this.init()}void 0===E.fn[it]&&"undefined"!=typeof google&&(p={ajaxData:null,altDistanceNoResult:!(st={}),autoComplete:!(d={}),autoCompleteDisableListener:!(u={}),autoCompleteOptions:{},autoGeocode:!(et={}),bounceMarker:!0,catMarkers:null,dataLocation:"data/locations.json",dataRaw:null,dataType:"json",debug:!(tt=[]),defaultLat:null,defaultLng:null,defaultLoc:!(Y=[]),disableAlphaMarkers:!(X=[]),distanceAlert:60,dragSearch:!(Z=[]),exclusiveFiltering:!1,exclusiveTax:null,featuredDistance:null,featuredLocations:!1,fullMapStart:!1,fullMapStartBlank:!1,fullMapStartListLimit:!1,infoBubble:null,inlineDirections:!1,lengthUnit:"m",listColor1:"#ffffff",listColor2:"#eeeeee",loading:!1,locationsPerPage:10,mapSettings:{mapTypeId:google.maps.MapTypeId.ROADMAP,zoom:12},markerCluster:null,markerImg:null,markerDim:null,maxDistance:!1,modal:!1,nameAttribute:"name",nameSearch:!1,noForm:!1,openNearest:!1,originMarker:!1,originMarkerDim:null,originMarkerImg:null,pagination:!1,querystringParams:!1,selectedMarkerImg:null,selectedMarkerImgDim:null,sessionStorage:!1,slideMap:!0,sortBy:null,storeLimit:26,taxonomyFilters:null,visibleMarkersList:!1,xmlElement:"marker",addressID:"bh-sl-address",closeIcon:"bh-sl-close-icon",formContainer:"bh-sl-form-container",formID:"bh-sl-user-location",geocodeID:null,lengthSwapID:"bh-sl-length-swap",loadingContainer:"bh-sl-loading",locationList:"bh-sl-loc-list",mapID:"bh-sl-map",maxDistanceID:"bh-sl-maxdistance",modalContent:"bh-sl-modal-content",modalWindow:"bh-sl-modal-window",orderID:"bh-sl-order",overlay:"bh-sl-overlay",regionID:"bh-sl-region",searchID:"bh-sl-search",sortID:"bh-sl-sort",taxonomyFiltersContainer:"bh-sl-filters-container",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,callbackAutoGeoSuccess:null,callbackBeforeSend:null,callbackCloseDirections:null,callbackCreateMarker:null,callbackDirectionsRequest:null,callbackFilters:null,callbackFormVals:null,callbackGeocodeRestrictions:null,callbackJsonp:null,callbackListClick:null,callbackMapSet:null,callbackMarkerClick:null,callbackModalClose:null,callbackModalOpen:null,callbackModalReady:null,callbackNearestLoc:null,callbackNoResults:null,callbackNotify:null,callbackOrder:null,callbackPageChange:null,callbackRegion:null,callbackSorting:null,callbackSuccess: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 ",kilometerLang:"kilometer",kilometersLang:"kilometers",mileLang:"mile",milesLang:"miles",noResultsTitle:"No results",noResultsDesc:"No locations were found with the given criteria. Please modify your selections or input.",nextPage:"Next »",prevPage:"« Prev"},E.extend(m.prototype,{init:function(){var t,e=this;this.writeDebug("init"),"km"===this.settings.lengthUnit?d.EarthRadius=6367:d.EarthRadius=3956,c="kml"===this.settings.dataType?"xml":this.settings.dataType,!0===this.settings.inlineDirections&&E("."+this.settings.locationList).prepend('
    '),V=this.settings.mapSettings.zoom,Handlebars.registerHelper("niceURL",function(t){if(t)return t.replace("https://","").replace("http://","")}),null!==this.settings.taxonomyFilters&&this.taxonomyFiltering(),this.sorting(),this.order(),!0===this.settings.modal&&(null!==this.settings.taxonomyFilters&&E("."+this.settings.taxonomyFiltersContainer).clone(!0,!0).prependTo(j),j.wrap('
    '),E("."+this.settings.modalWindow).prepend('
    '),E("."+this.settings.overlay).hide()),!0===this.settings.autoComplete&&(t=_.getElementById(this.settings.addressID),t=new google.maps.places.Autocomplete(t,this.settings.autoCompleteOptions),!0===this.settings.autoComplete)&&!0!==this.settings.autoCompleteDisableListener&&t.addListener("place_changed",function(t){e.processForm(t)}),this._loadTemplates()},destroy:function(){this.writeDebug("destroy"),this.reset();var t=E("#"+this.settings.mapID);if(tt.length)for(var e=0;e<=tt.length;e++)google.maps.event.removeListener(tt[e]);E("."+this.settings.locationList+" ul").empty(),t.hasClass("bh-sl-map-open")&&t.empty().removeClass("bh-sl-map-open"),!0===this.settings.modal&&E(". "+this.settings.overlay).remove(),t.attr("style",""),j.hide(),E.removeData(j.get(0)),E(_).off(it),j.unbind()},reset:function(){var t;this.writeDebug("reset"),X=[],Z=[],Y=[],W=!(tt=[]),E(_).off("click."+it,"."+this.settings.locationList+" li"),E("."+this.settings.locationList+" .bh-sl-close-directions-container").length&&E(".bh-sl-close-directions-container").remove(),!0===this.settings.inlineDirections&&(0<(t=E("."+this.settings.locationList+" .adp")).length&&(t.remove(),E("."+this.settings.locationList+" ul").fadeIn()),E(_).off("click","."+this.settings.locationList+" li .loc-directions a")),!0===this.settings.pagination&&E(_).off("click."+it,".bh-sl-pagination li")},formFiltersReset:function(){var t,e;this.writeDebug("formFiltersReset"),null!==this.settings.taxonomyFilters&&(t=E("."+this.settings.taxonomyFiltersContainer+" input"),e=E("."+this.settings.taxonomyFiltersContainer+" select"),"object"==typeof t)&&(t.each(function(){(E(this).is('input[type="checkbox"]')||E(this).is('input[type="radio"]'))&&E(this).prop("checked",!1)}),e.each(function(){E(this).prop("selectedIndex",0)}))},mapReload:function(){this.writeDebug("mapReload"),this.reset(),J=!0,null!==this.settings.taxonomyFilters&&(this.formFiltersReset(),this.resetDisabledFilterVals(),this.taxonomyFiltersInit()),l&&g?(this.settings.mapSettings.zoom=V,this.processForm()):this.mapping(st)},notify:function(t){this.writeDebug("notify",t),this.settings.callbackNotify?this.settings.callbackNotify.call(this,t):alert(t)},geoCodeCalcToRadian:function(t){return this.writeDebug("geoCodeCalcToRadian",t),t*(Math.PI/180)},geoCodeCalcDiffRadian:function(t,e){return this.writeDebug("geoCodeCalcDiffRadian",arguments),this.geoCodeCalcToRadian(e)-this.geoCodeCalcToRadian(t)},geoCodeCalcCalcDistance:function(t,e,s,i,n){return this.writeDebug("geoCodeCalcCalcDistance",arguments),2*n*Math.asin(Math.min(1,Math.sqrt(Math.pow(Math.sin(this.geoCodeCalcDiffRadian(t,s)/2),2)+Math.cos(this.geoCodeCalcToRadian(t))*Math.cos(this.geoCodeCalcToRadian(s))*Math.pow(Math.sin(this.geoCodeCalcDiffRadian(e,i)/2),2))))},inRange:function(t,e,s){return this.writeDebug("inRange",arguments),e=Math.abs(e),isFinite(e)&&t<=e&&e<=s},coordinatesInRange:function(t,e){return this.writeDebug("coordinatesInRange",arguments),this.inRange(-90,t,90)&&this.inRange(-180,e,180)},getQueryString:function(t){if(this.writeDebug("getQueryString",t),t)return t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),null===(t=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search))?"":decodeURIComponent(t[1].replace(/\+/g," "))},getMap:function(){return this.map},_loadTemplates:function(){this.writeDebug("_loadTemplates");var e,t=this,s='
    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?E.when(E.get(this.settings.KMLinfowindowTemplatePath,function(t){e=t,r=Handlebars.compile(e)}),E.get(this.settings.KMLlistTemplatePath,function(t){e=t,a=Handlebars.compile(e)})).then(function(){t.locator()},function(){throw E("."+t.settings.formContainer).append(s),new Error("Could not load storeLocator plugin templates")}):null!==this.settings.listTemplateID&&null!==this.settings.infowindowTemplateID?(r=Handlebars.compile(E("#"+this.settings.infowindowTemplateID).html()),a=Handlebars.compile(E("#"+this.settings.listTemplateID).html()),t.locator()):E.when(E.get(this.settings.infowindowTemplatePath,function(t){e=t,r=Handlebars.compile(e)}),E.get(this.settings.listTemplatePath,function(t){e=t,a=Handlebars.compile(e)})).then(function(){t.locator()},function(){throw E("."+t.settings.formContainer).append(s),new Error("Could not load storeLocator plugin templates")})},locator:function(){this.writeDebug("locator"),!0===this.settings.slideMap&&j.hide(),this._start(),this._formEventHandler()},_formEventHandler:function(){this.writeDebug("_formEventHandler");var e=this;!0===this.settings.noForm?(E(_).on("click."+it,"."+this.settings.formContainer+" button",function(t){e.processForm(t)}),E(_).on("keydown."+it,function(t){13===t.keyCode&&E("#"+e.settings.addressID).is(":focus")&&e.processForm(t)})):E(_).on("submit."+it,"#"+this.settings.formID,function(t){e.processForm(t)}),E(".bh-sl-reset").length&&E("#"+this.settings.mapID).length&&E(_).on("click."+it,".bh-sl-reset",function(){e.mapReload()}),E("#"+this.settings.addressID).on("change."+it,function(){h=t,""!==E.trim(E("#"+e.settings.addressID).val())||void 0!==U&&""!==U||null!==e.settings.taxonomyFilters&&!1===e.settings.exclusiveFiltering&&(z=g=l=t,st={},e.resetDisabledFilterVals(),e.taxonomyFiltersInit(),e.mapping(null))})},_getData:function(t,e,s,i,n){this.writeDebug("_getData",arguments);var a,o=this,r="",l="",g="";return void 0!==i&&void 0!==i.geometry.bounds&&(g=i.formatted_address,r=JSON.stringify(i.geometry.bounds.getNorthEast()),l=JSON.stringify(i.geometry.bounds.getSouthWest())),this.settings.callbackBeforeSend&&this.settings.callbackBeforeSend.call(this,t,e,s,g,r,l,n),null!==o.settings.dataRaw?"xml"===c?E.parseXML(o.settings.dataRaw):"json"===c?Array.isArray&&Array.isArray(o.settings.dataRaw)?o.settings.dataRaw:"string"==typeof o.settings.dataRaw?JSON.parse(o.settings.dataRaw):[]:void 0:(a=E.Deferred(),!0===this.settings.loading&&E("."+this.settings.formContainer).append('
    '),i={origLat:t,origLng:e,origAddress:s,formattedAddress:g,boundsNorthEast:r,boundsSouthWest:l},null!==this.settings.ajaxData&&"object"==typeof this.settings.ajaxData&&E.extend(i,this.settings.ajaxData),E.ajax({type:"GET",url:this.settings.dataLocation+("jsonp"===this.settings.dataType?(this.settings.dataLocation.match(/\?/)?"&":"?")+"callback=?":""),data:i,dataType:c,jsonpCallback:"jsonp"===this.settings.dataType?this.settings.callbackJsonp:null}).done(function(t){a.resolve(t),!0===o.settings.loading&&E("."+o.settings.formContainer+" ."+o.settings.loadingContainer).remove()}).fail(a.reject),a.promise())},_start:function(){this.writeDebug("_start");var t,e,s=this,i=this.settings.autoGeocode;!1!==s.settings.fullMapStartBlank?(E("#"+s.settings.mapID).addClass("bh-sl-map-open"),(e=s.settings.mapSettings).zoom=s.settings.fullMapStartBlank,t=new google.maps.LatLng(this.settings.defaultLat,this.settings.defaultLng),e.center=t,s.map=new google.maps.Map(_.getElementById(s.settings.mapID),e),N.addEventListener("resize",function(){var t=s.map.getCenter();google.maps.event.trigger(s.map,"resize"),s.map.setCenter(t)}),s.settings.fullMapStartBlank=!1,e.zoom=V):(!0===this.settings.defaultLoc&&this.defaultLocation(),""!==E.trim(E("#"+this.settings.addressID).val())?(s.writeDebug("Using Address Field"),s.processForm(null),i=!1):!0===this.settings.fullMapStart&&!1===this.settings.defaultLoc&&(!0===this.settings.querystringParams&&this.getQueryString(this.settings.addressID)||!0===this.settings.querystringParams&&this.getQueryString(this.settings.searchID)||!0===this.settings.querystringParams&&this.getQueryString(this.settings.maxDistanceID)?(s.writeDebug("Using Query String"),this.processForm(null),i=!1):this.mapping(null))),!0===this.settings.autoGeocode&&!0===i&&(s.writeDebug("Auto Geo"),s.htmlGeocode()),null!==this.settings.autoGeocode&&(s.writeDebug("Button Geo"),E(_).on("click."+it,"#"+this.settings.geocodeID,function(){s.htmlGeocode()}))},htmlGeocode:function(){this.writeDebug("htmlGeocode",arguments);var e=this;if(!0===e.settings.sessionStorage&&N.sessionStorage&&N.sessionStorage.getItem("myGeo"))return e.writeDebug("Using Session Saved Values for GEO"),e.autoGeocodeQuery(JSON.parse(N.sessionStorage.getItem("myGeo"))),!1;navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(t){e.writeDebug("Current Position Result");t={coords:{latitude:t.coords.latitude,longitude:t.coords.longitude,accuracy:t.coords.accuracy}};!0===e.settings.sessionStorage&&N.sessionStorage&&N.sessionStorage.setItem("myGeo",JSON.stringify(t)),e.settings.callbackAutoGeoSuccess&&e.settings.callbackAutoGeoSuccess.call(this,t),e.autoGeocodeQuery(t)},function(t){e._autoGeocodeError(t)})},googleGeocode:function(t){t.writeDebug("googleGeocode",arguments);var e=new google.maps.Geocoder;this.geocode=function(t,s){e.geocode(t,function(t,e){if(e!==google.maps.GeocoderStatus.OK)throw s(null),new Error("Geocode was not successful for the following reason: "+e);e={};e.latitude=t[0].geometry.location.lat(),e.longitude=t[0].geometry.location.lng(),e.geocodeResult=t[0],s(e)})}},reverseGoogleGeocode:function(t){t.writeDebug("reverseGoogleGeocode",arguments);var e=new google.maps.Geocoder;this.geocode=function(t,s){e.geocode(t,function(t,e){if(e!==google.maps.GeocoderStatus.OK)throw s(null),new Error("Reverse geocode was not successful for the following reason: "+e);t[0]&&((e={}).address=t[0].formatted_address,e.fullResult=t[0],s(e))})}},roundNumber:function(t,e){return this.writeDebug("roundNumber",arguments),Math.round(t*Math.pow(10,e))/Math.pow(10,e)},isEmptyObject:function(t){for(var e in this.writeDebug("isEmptyObject",arguments),t)if(t.hasOwnProperty(e))return!1;return!0},hasEmptyObjectVals:function(t){this.writeDebug("hasEmptyObjectVals",arguments);var e,s=!0;for(e in t)t.hasOwnProperty(e)&&""!==t[e]&&0!==t[e].length&&(s=!1);return s},hasSingleGroupFilterVal:function(t,e){this.writeDebug("hasSingleGroupFilterVal",arguments);t=Object.assign({},t);return!this.hasEmptyObjectVals(t[e])},modalClose:function(){this.writeDebug("modalClose"),this.settings.callbackModalClose&&this.settings.callbackModalClose.call(this),et={},E("."+this.settings.overlay+" select").prop("selectedIndex",0),E("."+this.settings.overlay+" input").prop("checked",!1),E("."+this.settings.overlay).hide()},_createLocationVariables:function(t){var e,s;for(s in this.writeDebug("_createLocationVariables",arguments),u={},X[t])X[t].hasOwnProperty(s)&&(e=X[t][s],"distance"!==s&&"altdistance"!==s||(e=this.roundNumber(e,2)),u[s]=e)},sortAlpha:function(t){this.writeDebug("sortAlpha",arguments);var s=this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"name";this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return e[s].toLowerCase().localeCompare(t[s].toLowerCase())}):t.sort(function(t,e){return t[s].toLowerCase().localeCompare(e[s].toLowerCase())})},sortDate:function(t){this.writeDebug("sortDate",arguments);var s=this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"date";this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return new Date(e[s]).getTime()-new Date(t[s]).getTime()}):t.sort(function(t,e){return new Date(t[s]).getTime()-new Date(e[s]).getTime()})},sortNumerically:function(t,e){this.writeDebug("sortNumerically",arguments);var s=null!==this.settings.sortBy&&this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"distance";void 0!==e&&!0===e&&(s="distance"),null!==this.settings.sortBy&&this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return e[s]t[s]?1:0}):t.sort(function(t,e){return t[s]e[s]?1:0})},sortCustom:function(t){this.writeDebug("sortCustom",arguments),this.settings.sortBy.hasOwnProperty("method")&&"alpha"===this.settings.sortBy.method.toString()?this.sortAlpha(t):this.settings.sortBy.hasOwnProperty("method")&&"date"===this.settings.sortBy.method.toString()?this.sortDate(t):this.sortNumerically(t)},filterMatching:function(t,e,s){return this.writeDebug("inclusiveFilter",arguments),void 0!==e&&(s=!0===(s=void 0===s||s)?t.join(""):t.join("|"),!!new RegExp(s,"i").test(e.replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g,"")))},filterData:function(t,e){this.writeDebug("filterData",arguments);var s,i=!0;for(s in e)if(e.hasOwnProperty(s)){for(var n=[],a=0;a'+this.settings.prevPage+"");for(var n=0;n'+a+"":'
  • '+a+"
  • "}return i'+this.settings.nextPage+""),s},paginationSetup:function(t){this.writeDebug("paginationSetup",arguments);var e="",s=E(".bh-sl-pagination-container .bh-sl-pagination"),i=-1===this.settings.storeLimit||X.length ul").append(e)},changeSelectedMarker:function(t){var e;void 0!==o&&o.setIcon(s),e=null===this.settings.selectedMarkerImgDim?this.markerImage(this.settings.selectedMarkerImg):this.markerImage(this.settings.selectedMarkerImg,this.settings.selectedMarkerImgDim.width,this.settings.selectedMarkerImgDim.height),s=t.icon,t.setIcon(e),o=t},createInfowindow:function(s,t,i,e,n){this.writeDebug("createInfowindow",arguments);var a=this,e=this._defineLocationData(s,e,n),o=r(e);"left"===t?(i.setContent(o),i.open(s.get("map"),s)):google.maps.event.addListener(s,"click",function(){i.setContent(o),i.open(s.get("map"),s);var t=s.get("id"),e=E("."+a.settings.locationList+" li[data-markerid="+t+"]");0
    ')),E(_).off("click","."+this.settings.locationList+" li .loc-directions a")},closeDirections:function(){this.writeDebug("closeDirections"),this.settings.callbackCloseDirections&&this.settings.callbackCloseDirections.call(this),this.reset(),l&&g&&(0===this.countFilters()?this.settings.mapSettings.zoom=V:this.settings.mapSettings.zoom=0,this.processForm(null)),E(_).off("click."+it,"."+this.settings.locationList+" .bh-sl-close-icon")},lengthUnitSwap:function(t){this.writeDebug("lengthUnitSwap",arguments),"alt-distance"===t.val()?(E("."+this.settings.locationList+" .loc-alt-dist").show(),E("."+this.settings.locationList+" .loc-default-dist").hide()):"default-distance"===t.val()&&(E("."+this.settings.locationList+" .loc-default-dist").show(),E("."+this.settings.locationList+" .loc-alt-dist").hide())},processForm:function(t){this.writeDebug("processForm",arguments);var e=this,s=null,i={},n=E("#"+this.settings.addressID),a=E("#"+this.settings.searchID),o=E("#"+this.settings.maxDistanceID),r="";null!=t&&t.preventDefault(),E("."+e.settings.formContainer+" input, ."+e.settings.formContainer+" select").blur(),!0===this.settings.querystringParams&&(this.getQueryString(this.settings.addressID)||this.getQueryString(this.settings.searchID)||this.getQueryString(this.settings.maxDistanceID))?(H=this.getQueryString(this.settings.addressID),U=this.getQueryString(this.settings.searchID),s=this.getQueryString(this.settings.maxDistanceID),""!==n.val()&&(H=n.val()),""!==a.val()&&(U=a.val()),""!==o.val()&&(s=o.val())):(H=n.val()||"",U=a.val()||"",!0===this.settings.maxDistance&&(s=o.val()||"")),r=this.settings.callbackRegion?this.settings.callbackRegion.call(this,H,U,s):E("#"+this.settings.regionID).val(),this.settings.callbackFormVals&&this.settings.callbackFormVals.call(this,H,U,s,r),void 0!==r&&(i={country:r}),"function"==typeof this.settings.callbackGeocodeRestrictions&&(i=this.settings.callbackGeocodeRestrictions.call(this,H,U,s)),""===H&&""===U&&!0!==this.settings.autoGeocode?this._start():""!==H?(""===U&&et.hasOwnProperty("name")&&delete et.name,void 0!==z&&void 0!==l&&void 0!==g&&H===z?(st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,e.mapping(st)):new this.googleGeocode(this).geocode({address:H,componentRestrictions:i,region:r},function(t){null!==t?(l=t.latitude,g=t.longitude,st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,st.geocodeResult=t.geocodeResult,e.mapping(st)):e.notify(e.settings.addressErrorAlert)})):""!==U?(""===H&&delete st.origin,st.name=U,e.mapping(st)):!0===this.settings.autoGeocode&&(st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,e.mapping(st))},locationsSetup:function(t,e,s,i,n){this.writeDebug("locationsSetup",arguments),void 0===i||t.distance||(t.distance=this.geoCodeCalcCalcDistance(e,s,t.lat,t.lng,d.EarthRadius),"m"===this.settings.lengthUnit?t.altdistance=1.609344*parseFloat(t.distance):"km"===this.settings.lengthUnit&&(t.altdistance=parseFloat(t.distance)/1.609344)),this.coordinatesInRange(t.lat,t.lng)?!0===this.settings.maxDistance&&null!=n?t.distance<=n?X.push(t):this.writeDebug("locationsSetup","location ignored because it is out of maxDistance: "+n,t):!0!==this.settings.maxDistance||!0!==this.settings.querystringParams||null==n||t.distance<=n?X.push(t):this.writeDebug("locationsSetup","location ignored because it is out of maxDistance: "+n,t):this.writeDebug("locationsSetup","location ignored because coordinates out of range: "+n,t)},sorting:function(){this.writeDebug("sorting",arguments);var s=this,i=E("#"+s.settings.mapID),t=E("#"+s.settings.sortID);0!==t.length&&t.on("change."+it,function(t){var e;t.stopPropagation(),!0===s.settings.pagination&&s.paginationChange(0),t=void 0!==E(this).find(":selected").attr("data-method")?E(this).find(":selected").attr("data-method"):"distance",e=E(this).val(),s.settings.sortBy.method=t,s.settings.sortBy.prop=e,s.settings.callbackSorting&&s.settings.callbackSorting.call(this,s.settings.sortBy),i.hasClass("bh-sl-map-open")&&s.mapping(st)})},order:function(){this.writeDebug("order",arguments);var e=this,s=E("#"+e.settings.mapID),t=E("#"+e.settings.orderID);0!==t.length&&t.on("change."+it,function(t){t.stopPropagation(),!0===e.settings.pagination&&e.paginationChange(0),e.settings.sortBy.order=E(this).val(),e.settings.callbackOrder&&e.settings.callbackOrder.call(this,e.settings.order),s.hasClass("bh-sl-map-open")&&e.mapping(st)})},countFilters:function(){this.writeDebug("countFilters");var t=0;if(!this.isEmptyObject(et))for(var e in et)et.hasOwnProperty(e)&&(t+=et[e].length);return t},_existingCheckedFilters:function(e){this.writeDebug("_existingCheckedFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" input[type=checkbox]").each(function(){var t;E(this).prop("checked")&&void 0!==(t=E(this).val())&&""!==t&&-1===et[e].indexOf(t)&&et[e].push(t)})},_existingSelectedFilters:function(e){this.writeDebug("_existingSelectedFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" select").each(function(){var t=E(this).val();void 0!==t&&""!==t&&-1===et[e].indexOf(t)&&(et[e]=[t])})},_existingRadioFilters:function(e){this.writeDebug("_existingRadioFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" input[type=radio]").each(function(){var t;E(this).prop("checked")&&void 0!==(t=E(this).val())&&""!==t&&-1===et[e].indexOf(t)&&(et[e]=[t])})},checkFilters:function(){for(var t in this.writeDebug("checkFilters"),this.settings.taxonomyFilters)this.settings.taxonomyFilters.hasOwnProperty(t)&&(this._existingCheckedFilters(t),this._existingSelectedFilters(t),this._existingRadioFilters(t))},selectQueryStringFilters:function(t,e){this.writeDebug("selectQueryStringFilters",arguments);var s=E("#"+this.settings.taxonomyFilters[t]);if(s.find('input[type="checkbox"]').length)for(var i=0;i ul").append(i))}),E("."+this.settings.locationList+" ul li:even").css("background",this.settings.listColor1),E("."+this.settings.locationList+" ul li:odd").css("background",this.settings.listColor2)},dragSearch:function(t){this.writeDebug("dragSearch",arguments);var e=t.getCenter(),s=this,t=(this.settings.mapSettings.zoom=t.getZoom(),l=st.lat=e.lat(),g=st.lng=e.lng(),new this.reverseGoogleGeocode(this)),e=new google.maps.LatLng(st.lat,st.lng);t.geocode({latLng:e},function(t){null!==t?(st.origin=H=t.address,s.mapping(st)):s.notify(s.settings.addressErrorAlert)})},emptyResult:function(){this.writeDebug("emptyResult",arguments);var t=E("."+this.settings.locationList+" ul"),e=this.settings.mapSettings;this.map=new google.maps.Map(_.getElementById(this.settings.mapID),e),this.settings.callbackNoResults&&this.settings.callbackNoResults.call(this,this.map,e),t.empty(),e=E('
  • '+this.settings.noResultsTitle+'

    '+this.settings.noResultsDesc+"
  • ").hide().fadeIn(),t.append(e),t=l&&g?new google.maps.LatLng(l,g):new google.maps.LatLng(0,0),this.map.setCenter(t),V&&this.map.setZoom(V)},originMarker:function(t,e,s){var i;this.writeDebug("originMarker",arguments),!0===this.settings.originMarker&&(i="",void 0!==e)&&(i=null!==this.settings.originMarkerImg?null===this.settings.originMarkerDim?this.markerImage(this.settings.originMarkerImg):this.markerImage(this.settings.originMarkerImg,this.settings.originMarkerDim.width,this.settings.originMarkerDim.height):{url:"https://mt.googleapis.com/vt/icon/name=icons/spotlight/spotlight-waypoint-a.png"},new google.maps.Marker({position:s,map:t,icon:i,draggable:!1}))},modalWindow:function(){var e;this.writeDebug("modalWindow"),!0===this.settings.modal&&((e=this).settings.callbackModalOpen&&e.settings.callbackModalOpen.call(this),E("."+e.settings.overlay).fadeIn(),E(_).on("click."+it,"."+e.settings.closeIcon+", ."+e.settings.overlay,function(){e.modalClose()}),E(_).on("click."+it,"."+e.settings.modalWindow,function(t){t.stopPropagation()}),E(_).on("keyup."+it,function(t){27===t.keyCode&&e.modalClose()}))},openNearestLocation:function(t,e,s,i){var n,a;this.writeDebug("openNearestLocation",arguments),!0!==this.settings.openNearest||void 0===t||void 0===z||!0===this.settings.fullMapStart&&!0===W&&!1===this.settings.querystringParams||!0===this.settings.defaultLoc&&!0===W&&!1===this.settings.querystringParams||((n=this).settings.callbackNearestLoc&&n.settings.callbackNearestLoc.call(this,n.map,t,e,s,i),t=t.hasOwnProperty("markerid")?t.markerid:0,a=tt[t],n.createInfowindow(a,"left",e,s,i),a=E("."+n.settings.locationList),e=E("."+n.settings.locationList+" li[data-markerid="+t+"]"),E("."+n.settings.locationList+" li").removeClass("list-focus"),e.addClass("list-focus"),a.animate({scrollTop:e.offset().top-a.offset().top+a.scrollTop()}))},listClick:function(s,i,n,a){this.writeDebug("listClick",arguments);var o=this;E(_).on("click."+it,"."+o.settings.locationList+" li",function(){var t=E(this).data("markerid"),e=tt[t];o.settings.callbackListClick&&o.settings.callbackListClick.call(this,t,e,X[t],s),s.panTo(e.getPosition());o.createInfowindow(e,"left",i,n,a),null!==o.settings.selectedMarkerImg&&o.changeSelectedMarker(e),E("."+o.settings.locationList+" li").removeClass("list-focus"),E("."+o.settings.locationList+" li[data-markerid="+t+"]").addClass("list-focus")}),E(_).on("click."+it,"."+o.settings.locationList+" li a",function(t){t.stopPropagation()})},resultsTotalCount:function(t){this.writeDebug("resultsTotalCount",arguments);var e=E(".bh-sl-total-results");void 0===t||t<=0||0===e.length||e.text(t)},inlineDirections:function(e,s){var i;this.writeDebug("inlineDirections",arguments),!0===this.settings.inlineDirections&&void 0!==s&&(i=this,E(_).on("click."+it,"."+i.settings.locationList+" li .loc-directions a",function(t){t.preventDefault();t=E(this).closest("li").attr("data-markerid");i.directionsRequest(s,parseInt(t),e),E(_).on("click."+it,"."+i.settings.locationList+" .bh-sl-close-icon",function(){i.closeDirections()})}))},visibleMarkersList:function(t,e){var s;this.writeDebug("visibleMarkersList",arguments),!0===this.settings.visibleMarkersList&&(s=this,google.maps.event.addListenerOnce(t,"idle",function(){s.checkVisibleMarkers(e,t)}),google.maps.event.addListener(t,"center_changed",function(){s.checkVisibleMarkers(e,t)}),google.maps.event.addListener(t,"zoom_changed",function(){s.checkVisibleMarkers(e,t)}))},featuredDistanceRestriction:function(){this.writeDebug("featuredDistanceRestriction",arguments);var e=this;return Z=E.grep(Z,function(t){if(t.hasOwnProperty("distance"))return parseFloat(t.distance)<=parseFloat(e.settings.featuredDistance)})},featuredRestrictions:function(t){return this.writeDebug("featuredRestrictions",arguments),Z=null!==this.settings.featuredDistance&&null!==this.settings.featuredDistance?this.featuredDistanceRestriction(t):Z},mapping:function(e){this.writeDebug("mapping",arguments);var t,s,i,n,a,o,r=this;this.isEmptyObject(e)||(t=e.lat,s=e.lng,i=e.geocodeResult,n=e.origin,o=e.page),!0!==r.settings.pagination||void 0!==o&&z===H||(o=0),q=void 0===n&&!0===this.settings.nameSearch?r._getData():(a=new google.maps.LatLng(t,s),void 0!==z&&n===z&&void 0!==Q?(n=z,Q):r._getData(l,g,n,i,e)),null!==r.settings.taxonomyFilters&&r.hasEmptyObjectVals(et)&&r.checkFilters(),null!==r.settings.dataRaw?r.processData(e,a,q,o):q.done(function(t){r.processData(e,a,t,o)})},resetDisabledFilterVals:function(){for(var t in this.writeDebug("resetDisabledFilterVals"),this.settings.taxonomyFilters)if(this.settings.taxonomyFilters.hasOwnProperty(t))for(var e=0;er)&&m.notify(m.settings.distanceErrorAlert+r+" "+w);else{if(void 0===X[0])throw m.emptyResult(),new Error("No locations found. Please check the dataLocation setting and path.");-1!==m.settings.distanceAlert&&X[0].distance>m.settings.distanceAlert&&(m.notify(m.settings.distanceErrorAlert+m.settings.distanceAlert+" "+w),h=!0)}void 0!==X[0]&&(d=X[0])}if(!0===m.settings.featuredLocations&&(Z=E.grep(X,function(t){if(t.hasOwnProperty("featured"))return"true"===t.featured}),Z=m.featuredRestrictions(t),Y=E.grep(X,function(t){if(t.hasOwnProperty("featured"))return"true"!==t.featured}),X=[],X=Z.concat(Y)),(!0!==W&&!1===m.settings.exclusiveFiltering||!0===m.settings.fullMapStart&&!1===m.settings.exclusiveFiltering||!0===m.settings.defaultLoc&&!1===m.settings.exclusiveFiltering)&&m.maybeDisableFilterOptions(),!0===m.settings.slideMap&&j.slideDown(),!0===m.settings.pagination&&m.paginationSetup(i),!0===m.settings.altDistanceNoResult&&d.distance>m.settings.distanceAlert)m.emptyResult();else if(m.isEmptyObject(X)||"none"===X[0].result)m.emptyResult();else{m.modalWindow(),K=-1===m.settings.storeLimit||X.lengthX.length&&(c=m.settings.locationsPerPage-(g+c-X.length)),X=X.slice(g,g+c),K=X.length):(c=K,g=0),m.resultsTotalCount(X.length),!0===m.settings.fullMapStart&&!0===W&&!0!==m.settings.querystringParams||0===m.settings.mapSettings.zoom||void 0===o||!0===h||!0===m.settings.maxDistance&&!1===W&&0m.settings.fullMapStartListLimit)for(var G=0;G li:even").css("background",m.settings.listColor1),E("."+m.settings.locationList+" ul > li:odd").css("background",m.settings.listColor2),m.visibleMarkersList(m.map,tt),!0===m.settings.querystringParams&&(w=E("#"+m.settings.addressID),P=E("#"+m.settings.searchID),void 0!==st&&st.hasOwnProperty("origin")&&""===w.val()&&w.val(st.origin),void 0!==st)&&st.hasOwnProperty("name")&&""===P.val()&&P.val(st.name),!0===m.settings.modal&&m.settings.callbackModalReady&&m.settings.callbackModalReady.call(this,t),m.settings.callbackFilters&&m.settings.callbackFilters.call(this,et,t)}},writeDebug:function(){N.console&&this.settings.debug&&(Function.prototype.bind?this.writeDebug=Function.prototype.bind.call(console.log,console,"StoreLocator :"):this.writeDebug=function(){arguments[0]="StoreLocator : "+arguments[0],Function.prototype.apply.call(console.log,console,arguments)},this.writeDebug.apply(this,arguments))}}),E.fn[it]=function(e){var s,i=arguments;return e===t||"object"==typeof e?this.each(function(){E.data(this,"plugin_"+it)||E.data(this,"plugin_"+it,new m(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?(this.each(function(){var t=E.data(this,"plugin_"+it);t instanceof m&&"function"==typeof t[e]&&(s=t[e].apply(t,Array.prototype.slice.call(i,1))),"destroy"===e&&E.data(this,"plugin_"+it,null)}),s!==t?s:this):void 0})}(jQuery,window,document); \ No newline at end of file +!function(E,N,_,t){"use strict";var j,a,r,c,z,Q,V,q,U,H,l,g,K,i,n,f,s,W,J,$,o,Z,X,Y,tt,et,h,u,st,d,p,it="storeLocator";function m(t,e){j=E(t),this.element=t,this.settings=E.extend({},p,e),this._defaults=p,this._name=it,this.init()}void 0===E.fn[it]&&"undefined"!=typeof google&&(p={ajaxData:null,altDistanceNoResult:!(d={}),autoComplete:!(st={}),autoCompleteDisableListener:!(u={}),autoCompleteOptions:{},autoGeocode:!(h={}),bounceMarker:!0,catMarkers:null,dataLocation:"data/locations.json",dataRaw:null,dataType:"json",debug:!(et={}),defaultLat:null,defaultLng:null,defaultLoc:!(tt=[]),disableAlphaMarkers:!(Y=[]),distanceAlert:60,dragSearch:!(X=[]),exclusiveFiltering:!(Z=[]),exclusiveTax:null,featuredDistance:null,featuredLocations:!1,fullMapStart:!1,fullMapStartBlank:!1,fullMapStartListLimit:!1,infoBubble:null,inlineDirections:!1,lengthUnit:"m",listColor1:"#ffffff",listColor2:"#eeeeee",loading:!1,locationsPerPage:10,mapSettings:{mapTypeId:google.maps.MapTypeId.ROADMAP,zoom:12},markerCluster:null,markerImg:null,markerDim:null,maxDistance:!1,modal:!1,nameAttribute:"name",nameSearch:!1,noForm:!1,openNearest:!1,originMarker:!1,originMarkerDim:null,originMarkerImg:null,pagination:!1,querystringParams:!1,selectedMarkerImg:null,selectedMarkerImgDim:null,sessionStorage:!1,slideMap:!0,sortBy:null,storeLimit:26,taxonomyFilters:null,visibleMarkersList:!1,xmlElement:"marker",addressID:"bh-sl-address",closeIcon:"bh-sl-close-icon",formContainer:"bh-sl-form-container",formID:"bh-sl-user-location",geocodeID:null,lengthSwapID:"bh-sl-length-swap",loadingContainer:"bh-sl-loading",locationList:"bh-sl-loc-list",mapID:"bh-sl-map",maxDistanceID:"bh-sl-maxdistance",modalContent:"bh-sl-modal-content",modalWindow:"bh-sl-modal-window",orderID:"bh-sl-order",overlay:"bh-sl-overlay",regionID:"bh-sl-region",searchID:"bh-sl-search",sortID:"bh-sl-sort",taxonomyFiltersContainer:"bh-sl-filters-container",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,callbackAutoGeoSuccess:null,callbackBeforeSend:null,callbackCloseDirections:null,callbackCreateMarker:null,callbackDirectionsRequest:null,callbackFilters:null,callbackFormVals:null,callbackGeocodeRestrictions:null,callbackJsonp:null,callbackListClick:null,callbackMapSet:null,callbackMarkerClick:null,callbackModalClose:null,callbackModalOpen:null,callbackModalReady:null,callbackNearestLoc:null,callbackNoResults:null,callbackNotify:null,callbackOrder:null,callbackPageChange:null,callbackRegion:null,callbackSorting:null,callbackSuccess: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 ",kilometerLang:"kilometer",kilometersLang:"kilometers",mileLang:"mile",milesLang:"miles",noResultsTitle:"No results",noResultsDesc:"No locations were found with the given criteria. Please modify your selections or input.",nextPage:"Next »",prevPage:"« Prev"},E.extend(m.prototype,{init:function(){var t,e=this;this.writeDebug("init"),"km"===this.settings.lengthUnit?u.EarthRadius=6367:u.EarthRadius=3956,c="kml"===this.settings.dataType?"xml":this.settings.dataType,!0===this.settings.inlineDirections&&E("."+this.settings.locationList).prepend('
    '),V=this.settings.mapSettings.zoom,Handlebars.registerHelper("niceURL",function(t){if(t)return t.replace("https://","").replace("http://","")}),null!==this.settings.taxonomyFilters&&this.taxonomyFiltering(),this.sorting(),this.order(),!0===this.settings.modal&&(null!==this.settings.taxonomyFilters&&E("."+this.settings.taxonomyFiltersContainer).clone(!0,!0).prependTo(j),j.wrap('
    '),E("."+this.settings.modalWindow).prepend('
    '),E("."+this.settings.overlay).hide()),!0===this.settings.autoComplete&&(t=_.getElementById(this.settings.addressID),t=new google.maps.places.Autocomplete(t,this.settings.autoCompleteOptions),!0===this.settings.autoComplete)&&!0!==this.settings.autoCompleteDisableListener&&t.addListener("place_changed",function(t){e.processForm(t)}),this._loadTemplates()},destroy:function(){this.writeDebug("destroy"),this.reset();var t=E("#"+this.settings.mapID);if(tt.length)for(var e=0;e<=tt.length;e++)google.maps.event.removeListener(tt[e]);E("."+this.settings.locationList+" ul").empty(),t.hasClass("bh-sl-map-open")&&t.empty().removeClass("bh-sl-map-open"),!0===this.settings.modal&&E(". "+this.settings.overlay).remove(),t.attr("style",""),j.hide(),E.removeData(j.get(0)),E(_).off(it),j.unbind()},reset:function(){var t;this.writeDebug("reset"),X=[],Z=[],Y=[],W=!(tt=[]),E(_).off("click."+it,"."+this.settings.locationList+" li"),E("."+this.settings.locationList+" .bh-sl-close-directions-container").length&&E(".bh-sl-close-directions-container").remove(),!0===this.settings.inlineDirections&&(0<(t=E("."+this.settings.locationList+" .adp")).length&&(t.remove(),E("."+this.settings.locationList+" ul").fadeIn()),E(_).off("click","."+this.settings.locationList+" li .loc-directions a")),!0===this.settings.pagination&&E(_).off("click."+it,".bh-sl-pagination li")},formFiltersReset:function(){var t,e;this.writeDebug("formFiltersReset"),null!==this.settings.taxonomyFilters&&(t=E("."+this.settings.taxonomyFiltersContainer+" input"),e=E("."+this.settings.taxonomyFiltersContainer+" select"),"object"==typeof t)&&(t.each(function(){(E(this).is('input[type="checkbox"]')||E(this).is('input[type="radio"]'))&&E(this).prop("checked",!1)}),e.each(function(){E(this).prop("selectedIndex",0)}))},mapReload:function(){this.writeDebug("mapReload"),this.reset(),J=!0,null!==this.settings.taxonomyFilters&&(this.formFiltersReset(),this.resetDisabledFilterVals(),this.taxonomyFiltersInit()),l&&g?(this.settings.mapSettings.zoom=V,this.processForm()):this.mapping(st)},notify:function(t){this.writeDebug("notify",t),this.settings.callbackNotify?this.settings.callbackNotify.call(this,t):alert(t)},geoCodeCalcToRadian:function(t){return this.writeDebug("geoCodeCalcToRadian",t),t*(Math.PI/180)},geoCodeCalcDiffRadian:function(t,e){return this.writeDebug("geoCodeCalcDiffRadian",arguments),this.geoCodeCalcToRadian(e)-this.geoCodeCalcToRadian(t)},geoCodeCalcCalcDistance:function(t,e,s,i,n){return this.writeDebug("geoCodeCalcCalcDistance",arguments),2*n*Math.asin(Math.min(1,Math.sqrt(Math.pow(Math.sin(this.geoCodeCalcDiffRadian(t,s)/2),2)+Math.cos(this.geoCodeCalcToRadian(t))*Math.cos(this.geoCodeCalcToRadian(s))*Math.pow(Math.sin(this.geoCodeCalcDiffRadian(e,i)/2),2))))},inRange:function(t,e,s){return this.writeDebug("inRange",arguments),e=Math.abs(e),isFinite(e)&&t<=e&&e<=s},coordinatesInRange:function(t,e){return this.writeDebug("coordinatesInRange",arguments),this.inRange(-90,t,90)&&this.inRange(-180,e,180)},getQueryString:function(t){if(this.writeDebug("getQueryString",t),t)return t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),null===(t=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search))?"":decodeURIComponent(t[1].replace(/\+/g," "))},getMap:function(){return this.map},_loadTemplates:function(){this.writeDebug("_loadTemplates");var e,t=this,s='
    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?E.when(E.get(this.settings.KMLinfowindowTemplatePath,function(t){e=t,r=Handlebars.compile(e)}),E.get(this.settings.KMLlistTemplatePath,function(t){e=t,a=Handlebars.compile(e)})).then(function(){t.locator()},function(){throw E("."+t.settings.formContainer).append(s),new Error("Could not load storeLocator plugin templates")}):null!==this.settings.listTemplateID&&null!==this.settings.infowindowTemplateID?(r=Handlebars.compile(E("#"+this.settings.infowindowTemplateID).html()),a=Handlebars.compile(E("#"+this.settings.listTemplateID).html()),t.locator()):E.when(E.get(this.settings.infowindowTemplatePath,function(t){e=t,r=Handlebars.compile(e)}),E.get(this.settings.listTemplatePath,function(t){e=t,a=Handlebars.compile(e)})).then(function(){t.locator()},function(){throw E("."+t.settings.formContainer).append(s),new Error("Could not load storeLocator plugin templates")})},locator:function(){this.writeDebug("locator"),!0===this.settings.slideMap&&j.hide(),this._start(),this._formEventHandler()},_formEventHandler:function(){this.writeDebug("_formEventHandler");var e=this;!0===this.settings.noForm?(E(_).on("click."+it,"."+this.settings.formContainer+" button",function(t){e.processForm(t)}),E(_).on("keydown."+it,function(t){13===t.keyCode&&E("#"+e.settings.addressID).is(":focus")&&e.processForm(t)})):E(_).on("submit."+it,"#"+this.settings.formID,function(t){e.processForm(t)}),E(".bh-sl-reset").length&&E("#"+this.settings.mapID).length&&E(_).on("click."+it,".bh-sl-reset",function(){e.mapReload()}),E("#"+this.settings.addressID).on("change."+it,function(){o=t,d={},""!==E.trim(E("#"+e.settings.addressID).val())||void 0!==U&&""!==U||null!==e.settings.taxonomyFilters&&!1===e.settings.exclusiveFiltering&&(z=g=l=t,st={},e.resetDisabledFilterVals(),e.taxonomyFiltersInit(),e.mapping(null))})},_getData:function(t,e,s,i,n){this.writeDebug("_getData",arguments);var a,o=this,r="",l="",g="";return void 0!==i&&void 0!==i.geometry.bounds&&(g=i.formatted_address,r=JSON.stringify(i.geometry.bounds.getNorthEast()),l=JSON.stringify(i.geometry.bounds.getSouthWest())),this.settings.callbackBeforeSend&&this.settings.callbackBeforeSend.call(this,t,e,s,g,r,l,n),null!==o.settings.dataRaw?"xml"===c?E.parseXML(o.settings.dataRaw):"json"===c?Array.isArray&&Array.isArray(o.settings.dataRaw)?o.settings.dataRaw:"string"==typeof o.settings.dataRaw?JSON.parse(o.settings.dataRaw):[]:void 0:(a=E.Deferred(),!0===this.settings.loading&&E("."+this.settings.formContainer).append('
    '),i={origLat:t,origLng:e,origAddress:s,formattedAddress:g,boundsNorthEast:r,boundsSouthWest:l},null!==this.settings.ajaxData&&"object"==typeof this.settings.ajaxData&&E.extend(i,this.settings.ajaxData),E.ajax({type:"GET",url:this.settings.dataLocation+("jsonp"===this.settings.dataType?(this.settings.dataLocation.match(/\?/)?"&":"?")+"callback=?":""),data:i,dataType:c,jsonpCallback:"jsonp"===this.settings.dataType?this.settings.callbackJsonp:null}).done(function(t){a.resolve(t),!0===o.settings.loading&&E("."+o.settings.formContainer+" ."+o.settings.loadingContainer).remove()}).fail(a.reject),a.promise())},_start:function(){this.writeDebug("_start");var t,e,s=this,i=this.settings.autoGeocode;!1!==s.settings.fullMapStartBlank?(E("#"+s.settings.mapID).addClass("bh-sl-map-open"),(e=s.settings.mapSettings).zoom=s.settings.fullMapStartBlank,t=new google.maps.LatLng(this.settings.defaultLat,this.settings.defaultLng),e.center=t,s.map=new google.maps.Map(_.getElementById(s.settings.mapID),e),N.addEventListener("resize",function(){var t=s.map.getCenter();google.maps.event.trigger(s.map,"resize"),s.map.setCenter(t)}),s.settings.fullMapStartBlank=!1,e.zoom=V):(!0===this.settings.defaultLoc&&this.defaultLocation(),""!==E.trim(E("#"+this.settings.addressID).val())?(s.writeDebug("Using Address Field"),s.processForm(null),i=!1):!0===this.settings.fullMapStart&&!1===this.settings.defaultLoc&&(!0===this.settings.querystringParams&&this.getQueryString(this.settings.addressID)||!0===this.settings.querystringParams&&this.getQueryString(this.settings.searchID)||!0===this.settings.querystringParams&&this.getQueryString(this.settings.maxDistanceID)?(s.writeDebug("Using Query String"),this.processForm(null),i=!1):this.mapping(null))),!0===this.settings.autoGeocode&&!0===i&&(s.writeDebug("Auto Geo"),s.htmlGeocode()),null!==this.settings.autoGeocode&&(s.writeDebug("Button Geo"),E(_).on("click."+it,"#"+this.settings.geocodeID,function(){s.htmlGeocode()}))},htmlGeocode:function(){this.writeDebug("htmlGeocode",arguments);var e=this;if(!0===e.settings.sessionStorage&&N.sessionStorage&&N.sessionStorage.getItem("myGeo"))return e.writeDebug("Using Session Saved Values for GEO"),e.autoGeocodeQuery(JSON.parse(N.sessionStorage.getItem("myGeo"))),!1;navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(t){e.writeDebug("Current Position Result");t={coords:{latitude:t.coords.latitude,longitude:t.coords.longitude,accuracy:t.coords.accuracy}};!0===e.settings.sessionStorage&&N.sessionStorage&&N.sessionStorage.setItem("myGeo",JSON.stringify(t)),e.settings.callbackAutoGeoSuccess&&e.settings.callbackAutoGeoSuccess.call(this,t),e.autoGeocodeQuery(t)},function(t){e._autoGeocodeError(t)})},googleGeocode:function(t){t.writeDebug("googleGeocode",arguments);var e=new google.maps.Geocoder;this.geocode=function(t,s){e.geocode(t,function(t,e){if(e!==google.maps.GeocoderStatus.OK)throw s(null),new Error("Geocode was not successful for the following reason: "+e);e={};e.latitude=t[0].geometry.location.lat(),e.longitude=t[0].geometry.location.lng(),e.geocodeResult=t[0],s(e)})}},reverseGoogleGeocode:function(t){t.writeDebug("reverseGoogleGeocode",arguments);var e=new google.maps.Geocoder;this.geocode=function(t,s){e.geocode(t,function(t,e){if(e!==google.maps.GeocoderStatus.OK)throw s(null),new Error("Reverse geocode was not successful for the following reason: "+e);t[0]&&((e={}).address=t[0].formatted_address,e.fullResult=t[0],s(e))})}},roundNumber:function(t,e){return this.writeDebug("roundNumber",arguments),Math.round(t*Math.pow(10,e))/Math.pow(10,e)},isEmptyObject:function(t){for(var e in this.writeDebug("isEmptyObject",arguments),t)if(t.hasOwnProperty(e))return!1;return!0},hasEmptyObjectVals:function(t){this.writeDebug("hasEmptyObjectVals",arguments);var e,s=!0;for(e in t)t.hasOwnProperty(e)&&""!==t[e]&&0!==t[e].length&&(s=!1);return s},hasSingleGroupFilterVal:function(t,e){this.writeDebug("hasSingleGroupFilterVal",arguments);t=Object.assign({},t);return!this.hasEmptyObjectVals(t[e])},modalClose:function(){this.writeDebug("modalClose"),this.settings.callbackModalClose&&this.settings.callbackModalClose.call(this),et={},E("."+this.settings.overlay+" select").prop("selectedIndex",0),E("."+this.settings.overlay+" input").prop("checked",!1),E("."+this.settings.overlay).hide()},_createLocationVariables:function(t){var e,s;for(s in this.writeDebug("_createLocationVariables",arguments),h={},X[t])X[t].hasOwnProperty(s)&&(e=X[t][s],"distance"!==s&&"altdistance"!==s||(e=this.roundNumber(e,2)),h[s]=e)},sortAlpha:function(t){this.writeDebug("sortAlpha",arguments);var s=this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"name";this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return e[s].toLowerCase().localeCompare(t[s].toLowerCase())}):t.sort(function(t,e){return t[s].toLowerCase().localeCompare(e[s].toLowerCase())})},sortDate:function(t){this.writeDebug("sortDate",arguments);var s=this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"date";this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return new Date(e[s]).getTime()-new Date(t[s]).getTime()}):t.sort(function(t,e){return new Date(t[s]).getTime()-new Date(e[s]).getTime()})},sortNumerically:function(t,e){this.writeDebug("sortNumerically",arguments);var s=null!==this.settings.sortBy&&this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"distance";void 0!==e&&!0===e&&(s="distance"),null!==this.settings.sortBy&&this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return e[s]t[s]?1:0}):t.sort(function(t,e){return t[s]e[s]?1:0})},sortCustom:function(t){this.writeDebug("sortCustom",arguments),this.settings.sortBy.hasOwnProperty("method")&&"alpha"===this.settings.sortBy.method.toString()?this.sortAlpha(t):this.settings.sortBy.hasOwnProperty("method")&&"date"===this.settings.sortBy.method.toString()?this.sortDate(t):this.sortNumerically(t)},filterMatching:function(t,e,s){return this.writeDebug("inclusiveFilter",arguments),void 0!==e&&(s=!0===(s=void 0===s||s)?t.join(""):t.join("|"),!!new RegExp(s,"i").test(e.replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g,"")))},filterData:function(t,e){this.writeDebug("filterData",arguments);var s,i=!0;for(s in e)if(e.hasOwnProperty(s)){for(var n=[],a=0;a'+this.settings.prevPage+"");for(var n=0;n'+a+"":'
  • '+a+"
  • "}return i'+this.settings.nextPage+""),s},paginationSetup:function(t){this.writeDebug("paginationSetup",arguments);var e="",s=E(".bh-sl-pagination-container .bh-sl-pagination"),i=-1===this.settings.storeLimit||X.length ul").append(e)},changeSelectedMarker:function(t){var e;void 0!==s&&s.setIcon(f),e=null===this.settings.selectedMarkerImgDim?this.markerImage(this.settings.selectedMarkerImg):this.markerImage(this.settings.selectedMarkerImg,this.settings.selectedMarkerImgDim.width,this.settings.selectedMarkerImgDim.height),f=t.icon,t.setIcon(e),s=t},createInfowindow:function(s,t,i,e,n){this.writeDebug("createInfowindow",arguments);var a=this,e=this._defineLocationData(s,e,n),o=r(e);"left"===t?(i.setContent(o),i.open(s.get("map"),s)):google.maps.event.addListener(s,"click",function(){i.setContent(o),i.open(s.get("map"),s);var t=s.get("id"),e=E("."+a.settings.locationList+" li[data-markerid="+t+"]");0
    ')),E(_).off("click","."+this.settings.locationList+" li .loc-directions a")},closeDirections:function(){this.writeDebug("closeDirections"),this.settings.callbackCloseDirections&&this.settings.callbackCloseDirections.call(this),this.reset(),l&&g&&(0===this.countFilters()?this.settings.mapSettings.zoom=V:this.settings.mapSettings.zoom=0,this.processForm(null)),E(_).off("click."+it,"."+this.settings.locationList+" .bh-sl-close-icon")},lengthUnitSwap:function(t){this.writeDebug("lengthUnitSwap",arguments),"alt-distance"===t.val()?(E("."+this.settings.locationList+" .loc-alt-dist").show(),E("."+this.settings.locationList+" .loc-default-dist").hide()):"default-distance"===t.val()&&(E("."+this.settings.locationList+" .loc-default-dist").show(),E("."+this.settings.locationList+" .loc-alt-dist").hide())},processForm:function(t){this.writeDebug("processForm",arguments);var e=this,s=null,i={},n=E("#"+this.settings.addressID),a=E("#"+this.settings.searchID),o=E("#"+this.settings.maxDistanceID),r="";null!=t&&t.preventDefault(),E("."+e.settings.formContainer+" input, ."+e.settings.formContainer+" select").blur(),!0===this.settings.querystringParams&&(this.getQueryString(this.settings.addressID)||this.getQueryString(this.settings.searchID)||this.getQueryString(this.settings.maxDistanceID))?(H=this.getQueryString(this.settings.addressID),U=this.getQueryString(this.settings.searchID),s=this.getQueryString(this.settings.maxDistanceID),""!==n.val()&&(H=n.val()),""!==a.val()&&(U=a.val()),""!==o.val()&&(s=o.val())):(H=n.val()||"",U=a.val()||"",!0===this.settings.maxDistance&&(s=o.val()||"")),r=this.settings.callbackRegion?this.settings.callbackRegion.call(this,H,U,s):E("#"+this.settings.regionID).val(),this.settings.callbackFormVals&&this.settings.callbackFormVals.call(this,H,U,s,r),void 0!==r&&(i={country:r}),"function"==typeof this.settings.callbackGeocodeRestrictions&&(i=this.settings.callbackGeocodeRestrictions.call(this,H,U,s)),""===H&&""===U&&!0!==this.settings.autoGeocode?this._start():""!==H?(""===U&&et.hasOwnProperty("name")&&delete et.name,void 0!==z&&void 0!==l&&void 0!==g&&H===z?(st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,e.mapping(st)):new this.googleGeocode(this).geocode({address:H,componentRestrictions:i,region:r},function(t){null!==t?(l=t.latitude,g=t.longitude,st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,st.geocodeResult=t.geocodeResult,e.mapping(st)):e.notify(e.settings.addressErrorAlert)})):""!==U?(""===H&&delete st.origin,st.name=U,e.mapping(st)):!0===this.settings.autoGeocode&&(st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,e.mapping(st))},locationsSetup:function(t,e,s,i,n){this.writeDebug("locationsSetup",arguments),void 0===i||t.distance||(t.distance=this.geoCodeCalcCalcDistance(e,s,t.lat,t.lng,u.EarthRadius),"m"===this.settings.lengthUnit?t.altdistance=1.609344*parseFloat(t.distance):"km"===this.settings.lengthUnit&&(t.altdistance=parseFloat(t.distance)/1.609344)),this.coordinatesInRange(t.lat,t.lng)?!0===this.settings.maxDistance&&null!=n?t.distance<=n?X.push(t):this.writeDebug("locationsSetup","location ignored because it is out of maxDistance: "+n,t):!0!==this.settings.maxDistance||!0!==this.settings.querystringParams||null==n||t.distance<=n?X.push(t):this.writeDebug("locationsSetup","location ignored because it is out of maxDistance: "+n,t):this.writeDebug("locationsSetup","location ignored because coordinates out of range: "+n,t)},sorting:function(){this.writeDebug("sorting",arguments);var s=this,i=E("#"+s.settings.mapID),t=E("#"+s.settings.sortID);0!==t.length&&t.on("change."+it,function(t){var e;t.stopPropagation(),!0===s.settings.pagination&&s.paginationChange(0),t=void 0!==E(this).find(":selected").attr("data-method")?E(this).find(":selected").attr("data-method"):"distance",e=E(this).val(),s.settings.sortBy.method=t,s.settings.sortBy.prop=e,s.settings.callbackSorting&&s.settings.callbackSorting.call(this,s.settings.sortBy),i.hasClass("bh-sl-map-open")&&s.mapping(st)})},order:function(){this.writeDebug("order",arguments);var e=this,s=E("#"+e.settings.mapID),t=E("#"+e.settings.orderID);0!==t.length&&t.on("change."+it,function(t){t.stopPropagation(),!0===e.settings.pagination&&e.paginationChange(0),e.settings.sortBy.order=E(this).val(),e.settings.callbackOrder&&e.settings.callbackOrder.call(this,e.settings.order),s.hasClass("bh-sl-map-open")&&e.mapping(st)})},countFilters:function(){this.writeDebug("countFilters");var t=0;if(!this.isEmptyObject(et))for(var e in et)et.hasOwnProperty(e)&&(t+=et[e].length);return t},_existingCheckedFilters:function(e){this.writeDebug("_existingCheckedFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" input[type=checkbox]").each(function(){var t;E(this).prop("checked")&&void 0!==(t=E(this).val())&&""!==t&&-1===et[e].indexOf(t)&&et[e].push(t)})},_existingSelectedFilters:function(e){this.writeDebug("_existingSelectedFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" select").each(function(){var t=E(this).val();void 0!==t&&""!==t&&-1===et[e].indexOf(t)&&(et[e]=[t])})},_existingRadioFilters:function(e){this.writeDebug("_existingRadioFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" input[type=radio]").each(function(){var t;E(this).prop("checked")&&void 0!==(t=E(this).val())&&""!==t&&-1===et[e].indexOf(t)&&(et[e]=[t])})},checkFilters:function(){for(var t in this.writeDebug("checkFilters"),this.settings.taxonomyFilters)this.settings.taxonomyFilters.hasOwnProperty(t)&&(this._existingCheckedFilters(t),this._existingSelectedFilters(t),this._existingRadioFilters(t))},selectQueryStringFilters:function(t,e){this.writeDebug("selectQueryStringFilters",arguments);var s=E("#"+this.settings.taxonomyFilters[t]);if(s.find('input[type="checkbox"]').length)for(var i=0;i ul").append(i))}),E("."+this.settings.locationList+" ul li:even").css("background",this.settings.listColor1),E("."+this.settings.locationList+" ul li:odd").css("background",this.settings.listColor2)},dragSearch:function(t){this.writeDebug("dragSearch",arguments);var e=t.getCenter(),s=this,t=(this.settings.mapSettings.zoom=t.getZoom(),l=st.lat=e.lat(),g=st.lng=e.lng(),new this.reverseGoogleGeocode(this)),e=new google.maps.LatLng(st.lat,st.lng);t.geocode({latLng:e},function(t){null!==t?(st.origin=H=t.address,s.mapping(st)):s.notify(s.settings.addressErrorAlert)})},emptyResult:function(){this.writeDebug("emptyResult",arguments);var t=E("."+this.settings.locationList+" ul"),e=this.settings.mapSettings;this.map=new google.maps.Map(_.getElementById(this.settings.mapID),e),this.settings.callbackNoResults&&this.settings.callbackNoResults.call(this,this.map,e),t.empty(),e=E('
  • '+this.settings.noResultsTitle+'

    '+this.settings.noResultsDesc+"
  • ").hide().fadeIn(),t.append(e),t=l&&g?new google.maps.LatLng(l,g):new google.maps.LatLng(0,0),this.map.setCenter(t),V&&this.map.setZoom(V)},originMarker:function(t,e,s){var i;this.writeDebug("originMarker",arguments),!0===this.settings.originMarker&&(i="",void 0!==e)&&(i=null!==this.settings.originMarkerImg?null===this.settings.originMarkerDim?this.markerImage(this.settings.originMarkerImg):this.markerImage(this.settings.originMarkerImg,this.settings.originMarkerDim.width,this.settings.originMarkerDim.height):{url:"https://mt.googleapis.com/vt/icon/name=icons/spotlight/spotlight-waypoint-a.png"},new google.maps.Marker({position:s,map:t,icon:i,draggable:!1}))},modalWindow:function(){var e;this.writeDebug("modalWindow"),!0===this.settings.modal&&((e=this).settings.callbackModalOpen&&e.settings.callbackModalOpen.call(this),E("."+e.settings.overlay).fadeIn(),E(_).on("click."+it,"."+e.settings.closeIcon+", ."+e.settings.overlay,function(){e.modalClose()}),E(_).on("click."+it,"."+e.settings.modalWindow,function(t){t.stopPropagation()}),E(_).on("keyup."+it,function(t){27===t.keyCode&&e.modalClose()}))},openNearestLocation:function(t,e,s,i){var n,a;this.writeDebug("openNearestLocation",arguments),!0!==this.settings.openNearest||void 0===t||void 0===z||!0===this.settings.fullMapStart&&!0===W&&!1===this.settings.querystringParams||!0===this.settings.defaultLoc&&!0===W&&!1===this.settings.querystringParams||((n=this).settings.callbackNearestLoc&&n.settings.callbackNearestLoc.call(this,n.map,t,e,s,i),t=t.hasOwnProperty("markerid")?t.markerid:0,a=tt[t],n.createInfowindow(a,"left",e,s,i),a=E("."+n.settings.locationList),e=E("."+n.settings.locationList+" li[data-markerid="+t+"]"),E("."+n.settings.locationList+" li").removeClass("list-focus"),e.addClass("list-focus"),a.animate({scrollTop:e.offset().top-a.offset().top+a.scrollTop()}))},listClick:function(s,i,n,a){this.writeDebug("listClick",arguments);var o=this;E(_).on("click."+it,"."+o.settings.locationList+" li",function(){var t=E(this).data("markerid"),e=tt[t];o.settings.callbackListClick&&o.settings.callbackListClick.call(this,t,e,X[t],s),s.panTo(e.getPosition());o.createInfowindow(e,"left",i,n,a),null!==o.settings.selectedMarkerImg&&o.changeSelectedMarker(e),E("."+o.settings.locationList+" li").removeClass("list-focus"),E("."+o.settings.locationList+" li[data-markerid="+t+"]").addClass("list-focus")}),E(_).on("click."+it,"."+o.settings.locationList+" li a",function(t){t.stopPropagation()})},resultsTotalCount:function(t){this.writeDebug("resultsTotalCount",arguments);var e=E(".bh-sl-total-results");void 0===t||t<=0||0===e.length||e.text(t)},inlineDirections:function(e,s){var i;this.writeDebug("inlineDirections",arguments),!0===this.settings.inlineDirections&&void 0!==s&&(i=this,E(_).on("click."+it,"."+i.settings.locationList+" li .loc-directions a",function(t){t.preventDefault();t=E(this).closest("li").attr("data-markerid");i.directionsRequest(s,parseInt(t),e),E(_).on("click."+it,"."+i.settings.locationList+" .bh-sl-close-icon",function(){i.closeDirections()})}))},visibleMarkersList:function(t,e){var s;this.writeDebug("visibleMarkersList",arguments),!0===this.settings.visibleMarkersList&&(s=this,google.maps.event.addListenerOnce(t,"idle",function(){s.checkVisibleMarkers(e,t)}),google.maps.event.addListener(t,"center_changed",function(){s.checkVisibleMarkers(e,t)}),google.maps.event.addListener(t,"zoom_changed",function(){s.checkVisibleMarkers(e,t)}))},featuredDistanceRestriction:function(){this.writeDebug("featuredDistanceRestriction",arguments);var e=this;return Z=E.grep(Z,function(t){if(t.hasOwnProperty("distance"))return parseFloat(t.distance)<=parseFloat(e.settings.featuredDistance)})},featuredRestrictions:function(t){return this.writeDebug("featuredRestrictions",arguments),Z=null!==this.settings.featuredDistance&&null!==this.settings.featuredDistance?this.featuredDistanceRestriction(t):Z},mapping:function(e){this.writeDebug("mapping",arguments);var t,s,i,n,a,o,r=this;this.isEmptyObject(e)||(t=e.lat,s=e.lng,i=e.geocodeResult,n=e.origin,o=e.page),!0!==r.settings.pagination||void 0!==o&&z===H||(o=0),q=void 0===n&&!0===this.settings.nameSearch?r._getData():(a=new google.maps.LatLng(t,s),void 0!==z&&n===z&&void 0!==Q?(n=z,Q):r._getData(l,g,n,i,e)),null!==r.settings.taxonomyFilters&&r.hasEmptyObjectVals(et)&&r.checkFilters(),null!==r.settings.dataRaw?r.processData(e,a,q,o):q.done(function(t){r.processData(e,a,t,o)})},resetDisabledFilterVals:function(){for(var t in this.writeDebug("resetDisabledFilterVals"),this.settings.taxonomyFilters)if(this.settings.taxonomyFilters.hasOwnProperty(t))for(var e=0;er)&&m.notify(m.settings.distanceErrorAlert+r+" "+w);else{if(void 0===X[0])throw m.emptyResult(),new Error("No locations found. Please check the dataLocation setting and path.");-1!==m.settings.distanceAlert&&X[0].distance>m.settings.distanceAlert&&(m.notify(m.settings.distanceErrorAlert+m.settings.distanceAlert+" "+w),h=!0)}void 0!==X[0]&&(d=X[0])}if(!0===m.settings.featuredLocations&&(Z=E.grep(X,function(t){if(t.hasOwnProperty("featured"))return"true"===t.featured}),Z=m.featuredRestrictions(t),Y=E.grep(X,function(t){if(t.hasOwnProperty("featured"))return"true"!==t.featured}),X=[],X=Z.concat(Y)),(!0!==W&&!1===m.settings.exclusiveFiltering||!0===m.settings.fullMapStart&&!1===m.settings.exclusiveFiltering||!0===m.settings.defaultLoc&&!1===m.settings.exclusiveFiltering)&&m.maybeDisableFilterOptions(),!0===m.settings.slideMap&&j.slideDown(),!0===m.settings.pagination&&m.paginationSetup(i),!0===m.settings.altDistanceNoResult&&d.distance>m.settings.distanceAlert)m.emptyResult();else if(m.isEmptyObject(X)||"none"===X[0].result)m.emptyResult();else{m.modalWindow(),K=-1===m.settings.storeLimit||X.lengthX.length&&(c=m.settings.locationsPerPage-(g+c-X.length)),X=X.slice(g,g+c),K=X.length):(c=K,g=0),m.resultsTotalCount(X.length),!0===m.settings.fullMapStart&&!0===W&&!0!==m.settings.querystringParams||0===m.settings.mapSettings.zoom||void 0===o||!0===h||!0===m.settings.maxDistance&&!1===W&&0m.settings.fullMapStartListLimit)for(var G=0;G li:even").css("background",m.settings.listColor1),E("."+m.settings.locationList+" ul > li:odd").css("background",m.settings.listColor2),m.visibleMarkersList(m.map,tt),!0===m.settings.querystringParams&&(w=E("#"+m.settings.addressID),P=E("#"+m.settings.searchID),void 0!==st&&st.hasOwnProperty("origin")&&""===w.val()&&w.val(st.origin),void 0!==st)&&st.hasOwnProperty("name")&&""===P.val()&&P.val(st.name),!0===m.settings.modal&&m.settings.callbackModalReady&&m.settings.callbackModalReady.call(this,t),m.settings.callbackFilters&&m.settings.callbackFilters.call(this,et,t)}},writeDebug:function(){N.console&&this.settings.debug&&(Function.prototype.bind?this.writeDebug=Function.prototype.bind.call(console.log,console,"StoreLocator :"):this.writeDebug=function(){arguments[0]="StoreLocator : "+arguments[0],Function.prototype.apply.call(console.log,console,arguments)},this.writeDebug.apply(this,arguments))}}),E.fn[it]=function(e){var s,i=arguments;return e===t||"object"==typeof e?this.each(function(){E.data(this,"plugin_"+it)||E.data(this,"plugin_"+it,new m(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?(this.each(function(){var t=E.data(this,"plugin_"+it);t instanceof m&&"function"==typeof t[e]&&(s=t[e].apply(t,Array.prototype.slice.call(i,1))),"destroy"===e&&E.data(this,"plugin_"+it,null)}),s!==t?s:this):void 0})}(jQuery,window,document); \ No newline at end of file diff --git a/src/js/jquery.storelocator.js b/src/js/jquery.storelocator.js index 268c94a..56d7cb2 100644 --- a/src/js/jquery.storelocator.js +++ b/src/js/jquery.storelocator.js @@ -11,7 +11,7 @@ // Variables used across multiple methods var $this, map, listTemplate, infowindowTemplate, dataTypeRead, originalOrigin, originalData, originalZoom, dataRequest, searchInput, addressInput, olat, olng, storeNum, directionsDisplay, directionsService, prevSelectedMarkerBefore, prevSelectedMarkerAfter, firstRun, reload, nameAttrs, originalFilterVals; var featuredset = [], locationset = [], normalset = [], markers = []; - var filters = {}, locationData = {}, GeoCodeCalc = {}, mappingObj = {}; + var filters = {}, locationData = {}, GeoCodeCalc = {}, mappingObj = {}, disabledFilterVals = {}; // Create the defaults once. DO NOT change these settings in this file - settings should be overridden in the plugin call var defaults = { @@ -561,6 +561,7 @@ // Track changes to the address search field. $('#' + this.settings.addressID).on('change.'+pluginName, function () { originalFilterVals = undefined; + disabledFilterVals = {}; // Unset origin tracking if input field is removed. if ( @@ -2850,7 +2851,6 @@ maybeDisableFilterOptions: function() { this.writeDebug('maybeDisableFilterOptions'); var availableValues = []; - var disabledValues = []; var _this = this; // Initially reset any input/option fields that were previously disabled. @@ -2873,7 +2873,12 @@ for (var i = 0; i < _this.settings.taxonomyFilters[key].length; i++) { if (_this.settings.taxonomyFilters.hasOwnProperty(key)) { $('#' + _this.settings.taxonomyFilters[key] + ' input, #' + _this.settings.taxonomyFilters[key] + ' option').each(function () { - if ($(this).val() !== '' && Array.from(new Set(availableValues[key].split(','))).indexOf($(this).val()) === -1) { + + // Initial determination of values that should be disabled. + if ($(this).val() !== '' && ! Array.from(new Set(availableValues[key].split(','))).includes($(this).val())) { + if (! disabledFilterVals.hasOwnProperty(key)) { + disabledFilterVals[key] = []; + } // Handle select options and radio button values when there is no address input. if ( @@ -2896,20 +2901,25 @@ return; } - // Keep radio button available values after one filter has been selected. + // Keep select options and radio button available values after one filter has been selected. if ( - $(this).prop('type') === 'radio' && + ($(this).prop('tagName') === 'OPTION' || $(this).prop('type') === 'radio') && _this.hasSingleGroupFilterVal(filters, key) && _this.countFilters() > 1 && - disabledValues.hasOwnProperty(key) && Array.from(new Set(originalFilterVals[key].split(','))).includes($(this).val()) && - ! Array.from(new Set(disabledValues[key].split(','))).includes($(this).val()) + ! disabledFilterVals[key].includes($(this).val()) ) { return; } // Track disabled values. - disabledValues[key] = $(this).val(); + if ( + disabledFilterVals.hasOwnProperty(key) && + Array.isArray(disabledFilterVals[key]) && + ! disabledFilterVals[key].includes($(this).val()) + ) { + disabledFilterVals[key].push($(this).val()); + } $(this).attr('disabled', true); } From 1f2025778bc8d35e21e61be7ce914deb58adb02c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Holine?= Date: Tue, 25 Jul 2023 23:15:54 -0700 Subject: [PATCH 4/5] Removed zoom reset to zero on taxonomy filtering to keep searched location in view, updated readme --- .../assets/js/plugins/storeLocator/jquery.storelocator.js | 8 ++------ .../js/plugins/storeLocator/jquery.storelocator.min.js | 4 ++-- readme.md | 6 ++++++ src/js/jquery.storelocator.js | 6 +----- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/dist/assets/js/plugins/storeLocator/jquery.storelocator.js b/dist/assets/js/plugins/storeLocator/jquery.storelocator.js index 2e32be1..82a8a71 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 - v3.1.12 - 2023-07-24 +/*! jQuery Google Maps Store Locator - v3.1.12 - 2023-07-25 * http://www.bjornblog.com/web/jquery-store-locator-plugin * Copyright (c) 2023 Bjorn Holine; Licensed MIT */ @@ -2277,7 +2277,6 @@ if ($('#' + _this.settings.mapID).hasClass('bh-sl-map-open') === true) { if ((olat) && (olng)) { - _this.settings.mapSettings.zoom = 0; _this.processForm(); } else { @@ -2295,9 +2294,7 @@ if (_this.countFilters() === 0) { _this.settings.mapSettings.zoom = originalZoom; } - else { - _this.settings.mapSettings.zoom = 0; - } + _this.processForm(); } else { @@ -2323,7 +2320,6 @@ filters[filterKey] = [filterVal]; if ($('#' + _this.settings.mapID).hasClass('bh-sl-map-open') === true) { if ((olat) && (olng)) { - _this.settings.mapSettings.zoom = 0; _this.processForm(); } else { diff --git a/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js b/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js index 4c0eb2d..3ef2767 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 - v3.1.12 - 2023-07-24 +/*! jQuery Google Maps Store Locator - v3.1.12 - 2023-07-25 * http://www.bjornblog.com/web/jquery-store-locator-plugin * Copyright (c) 2023 Bjorn Holine; Licensed MIT */ -!function(E,N,_,t){"use strict";var j,a,r,c,z,Q,V,q,U,H,l,g,K,i,n,f,s,W,J,$,o,Z,X,Y,tt,et,h,u,st,d,p,it="storeLocator";function m(t,e){j=E(t),this.element=t,this.settings=E.extend({},p,e),this._defaults=p,this._name=it,this.init()}void 0===E.fn[it]&&"undefined"!=typeof google&&(p={ajaxData:null,altDistanceNoResult:!(d={}),autoComplete:!(st={}),autoCompleteDisableListener:!(u={}),autoCompleteOptions:{},autoGeocode:!(h={}),bounceMarker:!0,catMarkers:null,dataLocation:"data/locations.json",dataRaw:null,dataType:"json",debug:!(et={}),defaultLat:null,defaultLng:null,defaultLoc:!(tt=[]),disableAlphaMarkers:!(Y=[]),distanceAlert:60,dragSearch:!(X=[]),exclusiveFiltering:!(Z=[]),exclusiveTax:null,featuredDistance:null,featuredLocations:!1,fullMapStart:!1,fullMapStartBlank:!1,fullMapStartListLimit:!1,infoBubble:null,inlineDirections:!1,lengthUnit:"m",listColor1:"#ffffff",listColor2:"#eeeeee",loading:!1,locationsPerPage:10,mapSettings:{mapTypeId:google.maps.MapTypeId.ROADMAP,zoom:12},markerCluster:null,markerImg:null,markerDim:null,maxDistance:!1,modal:!1,nameAttribute:"name",nameSearch:!1,noForm:!1,openNearest:!1,originMarker:!1,originMarkerDim:null,originMarkerImg:null,pagination:!1,querystringParams:!1,selectedMarkerImg:null,selectedMarkerImgDim:null,sessionStorage:!1,slideMap:!0,sortBy:null,storeLimit:26,taxonomyFilters:null,visibleMarkersList:!1,xmlElement:"marker",addressID:"bh-sl-address",closeIcon:"bh-sl-close-icon",formContainer:"bh-sl-form-container",formID:"bh-sl-user-location",geocodeID:null,lengthSwapID:"bh-sl-length-swap",loadingContainer:"bh-sl-loading",locationList:"bh-sl-loc-list",mapID:"bh-sl-map",maxDistanceID:"bh-sl-maxdistance",modalContent:"bh-sl-modal-content",modalWindow:"bh-sl-modal-window",orderID:"bh-sl-order",overlay:"bh-sl-overlay",regionID:"bh-sl-region",searchID:"bh-sl-search",sortID:"bh-sl-sort",taxonomyFiltersContainer:"bh-sl-filters-container",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,callbackAutoGeoSuccess:null,callbackBeforeSend:null,callbackCloseDirections:null,callbackCreateMarker:null,callbackDirectionsRequest:null,callbackFilters:null,callbackFormVals:null,callbackGeocodeRestrictions:null,callbackJsonp:null,callbackListClick:null,callbackMapSet:null,callbackMarkerClick:null,callbackModalClose:null,callbackModalOpen:null,callbackModalReady:null,callbackNearestLoc:null,callbackNoResults:null,callbackNotify:null,callbackOrder:null,callbackPageChange:null,callbackRegion:null,callbackSorting:null,callbackSuccess: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 ",kilometerLang:"kilometer",kilometersLang:"kilometers",mileLang:"mile",milesLang:"miles",noResultsTitle:"No results",noResultsDesc:"No locations were found with the given criteria. Please modify your selections or input.",nextPage:"Next »",prevPage:"« Prev"},E.extend(m.prototype,{init:function(){var t,e=this;this.writeDebug("init"),"km"===this.settings.lengthUnit?u.EarthRadius=6367:u.EarthRadius=3956,c="kml"===this.settings.dataType?"xml":this.settings.dataType,!0===this.settings.inlineDirections&&E("."+this.settings.locationList).prepend('
    '),V=this.settings.mapSettings.zoom,Handlebars.registerHelper("niceURL",function(t){if(t)return t.replace("https://","").replace("http://","")}),null!==this.settings.taxonomyFilters&&this.taxonomyFiltering(),this.sorting(),this.order(),!0===this.settings.modal&&(null!==this.settings.taxonomyFilters&&E("."+this.settings.taxonomyFiltersContainer).clone(!0,!0).prependTo(j),j.wrap('
    '),E("."+this.settings.modalWindow).prepend('
    '),E("."+this.settings.overlay).hide()),!0===this.settings.autoComplete&&(t=_.getElementById(this.settings.addressID),t=new google.maps.places.Autocomplete(t,this.settings.autoCompleteOptions),!0===this.settings.autoComplete)&&!0!==this.settings.autoCompleteDisableListener&&t.addListener("place_changed",function(t){e.processForm(t)}),this._loadTemplates()},destroy:function(){this.writeDebug("destroy"),this.reset();var t=E("#"+this.settings.mapID);if(tt.length)for(var e=0;e<=tt.length;e++)google.maps.event.removeListener(tt[e]);E("."+this.settings.locationList+" ul").empty(),t.hasClass("bh-sl-map-open")&&t.empty().removeClass("bh-sl-map-open"),!0===this.settings.modal&&E(". "+this.settings.overlay).remove(),t.attr("style",""),j.hide(),E.removeData(j.get(0)),E(_).off(it),j.unbind()},reset:function(){var t;this.writeDebug("reset"),X=[],Z=[],Y=[],W=!(tt=[]),E(_).off("click."+it,"."+this.settings.locationList+" li"),E("."+this.settings.locationList+" .bh-sl-close-directions-container").length&&E(".bh-sl-close-directions-container").remove(),!0===this.settings.inlineDirections&&(0<(t=E("."+this.settings.locationList+" .adp")).length&&(t.remove(),E("."+this.settings.locationList+" ul").fadeIn()),E(_).off("click","."+this.settings.locationList+" li .loc-directions a")),!0===this.settings.pagination&&E(_).off("click."+it,".bh-sl-pagination li")},formFiltersReset:function(){var t,e;this.writeDebug("formFiltersReset"),null!==this.settings.taxonomyFilters&&(t=E("."+this.settings.taxonomyFiltersContainer+" input"),e=E("."+this.settings.taxonomyFiltersContainer+" select"),"object"==typeof t)&&(t.each(function(){(E(this).is('input[type="checkbox"]')||E(this).is('input[type="radio"]'))&&E(this).prop("checked",!1)}),e.each(function(){E(this).prop("selectedIndex",0)}))},mapReload:function(){this.writeDebug("mapReload"),this.reset(),J=!0,null!==this.settings.taxonomyFilters&&(this.formFiltersReset(),this.resetDisabledFilterVals(),this.taxonomyFiltersInit()),l&&g?(this.settings.mapSettings.zoom=V,this.processForm()):this.mapping(st)},notify:function(t){this.writeDebug("notify",t),this.settings.callbackNotify?this.settings.callbackNotify.call(this,t):alert(t)},geoCodeCalcToRadian:function(t){return this.writeDebug("geoCodeCalcToRadian",t),t*(Math.PI/180)},geoCodeCalcDiffRadian:function(t,e){return this.writeDebug("geoCodeCalcDiffRadian",arguments),this.geoCodeCalcToRadian(e)-this.geoCodeCalcToRadian(t)},geoCodeCalcCalcDistance:function(t,e,s,i,n){return this.writeDebug("geoCodeCalcCalcDistance",arguments),2*n*Math.asin(Math.min(1,Math.sqrt(Math.pow(Math.sin(this.geoCodeCalcDiffRadian(t,s)/2),2)+Math.cos(this.geoCodeCalcToRadian(t))*Math.cos(this.geoCodeCalcToRadian(s))*Math.pow(Math.sin(this.geoCodeCalcDiffRadian(e,i)/2),2))))},inRange:function(t,e,s){return this.writeDebug("inRange",arguments),e=Math.abs(e),isFinite(e)&&t<=e&&e<=s},coordinatesInRange:function(t,e){return this.writeDebug("coordinatesInRange",arguments),this.inRange(-90,t,90)&&this.inRange(-180,e,180)},getQueryString:function(t){if(this.writeDebug("getQueryString",t),t)return t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),null===(t=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search))?"":decodeURIComponent(t[1].replace(/\+/g," "))},getMap:function(){return this.map},_loadTemplates:function(){this.writeDebug("_loadTemplates");var e,t=this,s='
    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?E.when(E.get(this.settings.KMLinfowindowTemplatePath,function(t){e=t,r=Handlebars.compile(e)}),E.get(this.settings.KMLlistTemplatePath,function(t){e=t,a=Handlebars.compile(e)})).then(function(){t.locator()},function(){throw E("."+t.settings.formContainer).append(s),new Error("Could not load storeLocator plugin templates")}):null!==this.settings.listTemplateID&&null!==this.settings.infowindowTemplateID?(r=Handlebars.compile(E("#"+this.settings.infowindowTemplateID).html()),a=Handlebars.compile(E("#"+this.settings.listTemplateID).html()),t.locator()):E.when(E.get(this.settings.infowindowTemplatePath,function(t){e=t,r=Handlebars.compile(e)}),E.get(this.settings.listTemplatePath,function(t){e=t,a=Handlebars.compile(e)})).then(function(){t.locator()},function(){throw E("."+t.settings.formContainer).append(s),new Error("Could not load storeLocator plugin templates")})},locator:function(){this.writeDebug("locator"),!0===this.settings.slideMap&&j.hide(),this._start(),this._formEventHandler()},_formEventHandler:function(){this.writeDebug("_formEventHandler");var e=this;!0===this.settings.noForm?(E(_).on("click."+it,"."+this.settings.formContainer+" button",function(t){e.processForm(t)}),E(_).on("keydown."+it,function(t){13===t.keyCode&&E("#"+e.settings.addressID).is(":focus")&&e.processForm(t)})):E(_).on("submit."+it,"#"+this.settings.formID,function(t){e.processForm(t)}),E(".bh-sl-reset").length&&E("#"+this.settings.mapID).length&&E(_).on("click."+it,".bh-sl-reset",function(){e.mapReload()}),E("#"+this.settings.addressID).on("change."+it,function(){o=t,d={},""!==E.trim(E("#"+e.settings.addressID).val())||void 0!==U&&""!==U||null!==e.settings.taxonomyFilters&&!1===e.settings.exclusiveFiltering&&(z=g=l=t,st={},e.resetDisabledFilterVals(),e.taxonomyFiltersInit(),e.mapping(null))})},_getData:function(t,e,s,i,n){this.writeDebug("_getData",arguments);var a,o=this,r="",l="",g="";return void 0!==i&&void 0!==i.geometry.bounds&&(g=i.formatted_address,r=JSON.stringify(i.geometry.bounds.getNorthEast()),l=JSON.stringify(i.geometry.bounds.getSouthWest())),this.settings.callbackBeforeSend&&this.settings.callbackBeforeSend.call(this,t,e,s,g,r,l,n),null!==o.settings.dataRaw?"xml"===c?E.parseXML(o.settings.dataRaw):"json"===c?Array.isArray&&Array.isArray(o.settings.dataRaw)?o.settings.dataRaw:"string"==typeof o.settings.dataRaw?JSON.parse(o.settings.dataRaw):[]:void 0:(a=E.Deferred(),!0===this.settings.loading&&E("."+this.settings.formContainer).append('
    '),i={origLat:t,origLng:e,origAddress:s,formattedAddress:g,boundsNorthEast:r,boundsSouthWest:l},null!==this.settings.ajaxData&&"object"==typeof this.settings.ajaxData&&E.extend(i,this.settings.ajaxData),E.ajax({type:"GET",url:this.settings.dataLocation+("jsonp"===this.settings.dataType?(this.settings.dataLocation.match(/\?/)?"&":"?")+"callback=?":""),data:i,dataType:c,jsonpCallback:"jsonp"===this.settings.dataType?this.settings.callbackJsonp:null}).done(function(t){a.resolve(t),!0===o.settings.loading&&E("."+o.settings.formContainer+" ."+o.settings.loadingContainer).remove()}).fail(a.reject),a.promise())},_start:function(){this.writeDebug("_start");var t,e,s=this,i=this.settings.autoGeocode;!1!==s.settings.fullMapStartBlank?(E("#"+s.settings.mapID).addClass("bh-sl-map-open"),(e=s.settings.mapSettings).zoom=s.settings.fullMapStartBlank,t=new google.maps.LatLng(this.settings.defaultLat,this.settings.defaultLng),e.center=t,s.map=new google.maps.Map(_.getElementById(s.settings.mapID),e),N.addEventListener("resize",function(){var t=s.map.getCenter();google.maps.event.trigger(s.map,"resize"),s.map.setCenter(t)}),s.settings.fullMapStartBlank=!1,e.zoom=V):(!0===this.settings.defaultLoc&&this.defaultLocation(),""!==E.trim(E("#"+this.settings.addressID).val())?(s.writeDebug("Using Address Field"),s.processForm(null),i=!1):!0===this.settings.fullMapStart&&!1===this.settings.defaultLoc&&(!0===this.settings.querystringParams&&this.getQueryString(this.settings.addressID)||!0===this.settings.querystringParams&&this.getQueryString(this.settings.searchID)||!0===this.settings.querystringParams&&this.getQueryString(this.settings.maxDistanceID)?(s.writeDebug("Using Query String"),this.processForm(null),i=!1):this.mapping(null))),!0===this.settings.autoGeocode&&!0===i&&(s.writeDebug("Auto Geo"),s.htmlGeocode()),null!==this.settings.autoGeocode&&(s.writeDebug("Button Geo"),E(_).on("click."+it,"#"+this.settings.geocodeID,function(){s.htmlGeocode()}))},htmlGeocode:function(){this.writeDebug("htmlGeocode",arguments);var e=this;if(!0===e.settings.sessionStorage&&N.sessionStorage&&N.sessionStorage.getItem("myGeo"))return e.writeDebug("Using Session Saved Values for GEO"),e.autoGeocodeQuery(JSON.parse(N.sessionStorage.getItem("myGeo"))),!1;navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(t){e.writeDebug("Current Position Result");t={coords:{latitude:t.coords.latitude,longitude:t.coords.longitude,accuracy:t.coords.accuracy}};!0===e.settings.sessionStorage&&N.sessionStorage&&N.sessionStorage.setItem("myGeo",JSON.stringify(t)),e.settings.callbackAutoGeoSuccess&&e.settings.callbackAutoGeoSuccess.call(this,t),e.autoGeocodeQuery(t)},function(t){e._autoGeocodeError(t)})},googleGeocode:function(t){t.writeDebug("googleGeocode",arguments);var e=new google.maps.Geocoder;this.geocode=function(t,s){e.geocode(t,function(t,e){if(e!==google.maps.GeocoderStatus.OK)throw s(null),new Error("Geocode was not successful for the following reason: "+e);e={};e.latitude=t[0].geometry.location.lat(),e.longitude=t[0].geometry.location.lng(),e.geocodeResult=t[0],s(e)})}},reverseGoogleGeocode:function(t){t.writeDebug("reverseGoogleGeocode",arguments);var e=new google.maps.Geocoder;this.geocode=function(t,s){e.geocode(t,function(t,e){if(e!==google.maps.GeocoderStatus.OK)throw s(null),new Error("Reverse geocode was not successful for the following reason: "+e);t[0]&&((e={}).address=t[0].formatted_address,e.fullResult=t[0],s(e))})}},roundNumber:function(t,e){return this.writeDebug("roundNumber",arguments),Math.round(t*Math.pow(10,e))/Math.pow(10,e)},isEmptyObject:function(t){for(var e in this.writeDebug("isEmptyObject",arguments),t)if(t.hasOwnProperty(e))return!1;return!0},hasEmptyObjectVals:function(t){this.writeDebug("hasEmptyObjectVals",arguments);var e,s=!0;for(e in t)t.hasOwnProperty(e)&&""!==t[e]&&0!==t[e].length&&(s=!1);return s},hasSingleGroupFilterVal:function(t,e){this.writeDebug("hasSingleGroupFilterVal",arguments);t=Object.assign({},t);return!this.hasEmptyObjectVals(t[e])},modalClose:function(){this.writeDebug("modalClose"),this.settings.callbackModalClose&&this.settings.callbackModalClose.call(this),et={},E("."+this.settings.overlay+" select").prop("selectedIndex",0),E("."+this.settings.overlay+" input").prop("checked",!1),E("."+this.settings.overlay).hide()},_createLocationVariables:function(t){var e,s;for(s in this.writeDebug("_createLocationVariables",arguments),h={},X[t])X[t].hasOwnProperty(s)&&(e=X[t][s],"distance"!==s&&"altdistance"!==s||(e=this.roundNumber(e,2)),h[s]=e)},sortAlpha:function(t){this.writeDebug("sortAlpha",arguments);var s=this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"name";this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return e[s].toLowerCase().localeCompare(t[s].toLowerCase())}):t.sort(function(t,e){return t[s].toLowerCase().localeCompare(e[s].toLowerCase())})},sortDate:function(t){this.writeDebug("sortDate",arguments);var s=this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"date";this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return new Date(e[s]).getTime()-new Date(t[s]).getTime()}):t.sort(function(t,e){return new Date(t[s]).getTime()-new Date(e[s]).getTime()})},sortNumerically:function(t,e){this.writeDebug("sortNumerically",arguments);var s=null!==this.settings.sortBy&&this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"distance";void 0!==e&&!0===e&&(s="distance"),null!==this.settings.sortBy&&this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return e[s]t[s]?1:0}):t.sort(function(t,e){return t[s]e[s]?1:0})},sortCustom:function(t){this.writeDebug("sortCustom",arguments),this.settings.sortBy.hasOwnProperty("method")&&"alpha"===this.settings.sortBy.method.toString()?this.sortAlpha(t):this.settings.sortBy.hasOwnProperty("method")&&"date"===this.settings.sortBy.method.toString()?this.sortDate(t):this.sortNumerically(t)},filterMatching:function(t,e,s){return this.writeDebug("inclusiveFilter",arguments),void 0!==e&&(s=!0===(s=void 0===s||s)?t.join(""):t.join("|"),!!new RegExp(s,"i").test(e.replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g,"")))},filterData:function(t,e){this.writeDebug("filterData",arguments);var s,i=!0;for(s in e)if(e.hasOwnProperty(s)){for(var n=[],a=0;a'+this.settings.prevPage+"");for(var n=0;n'+a+"":'
  • '+a+"
  • "}return i'+this.settings.nextPage+""),s},paginationSetup:function(t){this.writeDebug("paginationSetup",arguments);var e="",s=E(".bh-sl-pagination-container .bh-sl-pagination"),i=-1===this.settings.storeLimit||X.length ul").append(e)},changeSelectedMarker:function(t){var e;void 0!==s&&s.setIcon(f),e=null===this.settings.selectedMarkerImgDim?this.markerImage(this.settings.selectedMarkerImg):this.markerImage(this.settings.selectedMarkerImg,this.settings.selectedMarkerImgDim.width,this.settings.selectedMarkerImgDim.height),f=t.icon,t.setIcon(e),s=t},createInfowindow:function(s,t,i,e,n){this.writeDebug("createInfowindow",arguments);var a=this,e=this._defineLocationData(s,e,n),o=r(e);"left"===t?(i.setContent(o),i.open(s.get("map"),s)):google.maps.event.addListener(s,"click",function(){i.setContent(o),i.open(s.get("map"),s);var t=s.get("id"),e=E("."+a.settings.locationList+" li[data-markerid="+t+"]");0
    ')),E(_).off("click","."+this.settings.locationList+" li .loc-directions a")},closeDirections:function(){this.writeDebug("closeDirections"),this.settings.callbackCloseDirections&&this.settings.callbackCloseDirections.call(this),this.reset(),l&&g&&(0===this.countFilters()?this.settings.mapSettings.zoom=V:this.settings.mapSettings.zoom=0,this.processForm(null)),E(_).off("click."+it,"."+this.settings.locationList+" .bh-sl-close-icon")},lengthUnitSwap:function(t){this.writeDebug("lengthUnitSwap",arguments),"alt-distance"===t.val()?(E("."+this.settings.locationList+" .loc-alt-dist").show(),E("."+this.settings.locationList+" .loc-default-dist").hide()):"default-distance"===t.val()&&(E("."+this.settings.locationList+" .loc-default-dist").show(),E("."+this.settings.locationList+" .loc-alt-dist").hide())},processForm:function(t){this.writeDebug("processForm",arguments);var e=this,s=null,i={},n=E("#"+this.settings.addressID),a=E("#"+this.settings.searchID),o=E("#"+this.settings.maxDistanceID),r="";null!=t&&t.preventDefault(),E("."+e.settings.formContainer+" input, ."+e.settings.formContainer+" select").blur(),!0===this.settings.querystringParams&&(this.getQueryString(this.settings.addressID)||this.getQueryString(this.settings.searchID)||this.getQueryString(this.settings.maxDistanceID))?(H=this.getQueryString(this.settings.addressID),U=this.getQueryString(this.settings.searchID),s=this.getQueryString(this.settings.maxDistanceID),""!==n.val()&&(H=n.val()),""!==a.val()&&(U=a.val()),""!==o.val()&&(s=o.val())):(H=n.val()||"",U=a.val()||"",!0===this.settings.maxDistance&&(s=o.val()||"")),r=this.settings.callbackRegion?this.settings.callbackRegion.call(this,H,U,s):E("#"+this.settings.regionID).val(),this.settings.callbackFormVals&&this.settings.callbackFormVals.call(this,H,U,s,r),void 0!==r&&(i={country:r}),"function"==typeof this.settings.callbackGeocodeRestrictions&&(i=this.settings.callbackGeocodeRestrictions.call(this,H,U,s)),""===H&&""===U&&!0!==this.settings.autoGeocode?this._start():""!==H?(""===U&&et.hasOwnProperty("name")&&delete et.name,void 0!==z&&void 0!==l&&void 0!==g&&H===z?(st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,e.mapping(st)):new this.googleGeocode(this).geocode({address:H,componentRestrictions:i,region:r},function(t){null!==t?(l=t.latitude,g=t.longitude,st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,st.geocodeResult=t.geocodeResult,e.mapping(st)):e.notify(e.settings.addressErrorAlert)})):""!==U?(""===H&&delete st.origin,st.name=U,e.mapping(st)):!0===this.settings.autoGeocode&&(st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,e.mapping(st))},locationsSetup:function(t,e,s,i,n){this.writeDebug("locationsSetup",arguments),void 0===i||t.distance||(t.distance=this.geoCodeCalcCalcDistance(e,s,t.lat,t.lng,u.EarthRadius),"m"===this.settings.lengthUnit?t.altdistance=1.609344*parseFloat(t.distance):"km"===this.settings.lengthUnit&&(t.altdistance=parseFloat(t.distance)/1.609344)),this.coordinatesInRange(t.lat,t.lng)?!0===this.settings.maxDistance&&null!=n?t.distance<=n?X.push(t):this.writeDebug("locationsSetup","location ignored because it is out of maxDistance: "+n,t):!0!==this.settings.maxDistance||!0!==this.settings.querystringParams||null==n||t.distance<=n?X.push(t):this.writeDebug("locationsSetup","location ignored because it is out of maxDistance: "+n,t):this.writeDebug("locationsSetup","location ignored because coordinates out of range: "+n,t)},sorting:function(){this.writeDebug("sorting",arguments);var s=this,i=E("#"+s.settings.mapID),t=E("#"+s.settings.sortID);0!==t.length&&t.on("change."+it,function(t){var e;t.stopPropagation(),!0===s.settings.pagination&&s.paginationChange(0),t=void 0!==E(this).find(":selected").attr("data-method")?E(this).find(":selected").attr("data-method"):"distance",e=E(this).val(),s.settings.sortBy.method=t,s.settings.sortBy.prop=e,s.settings.callbackSorting&&s.settings.callbackSorting.call(this,s.settings.sortBy),i.hasClass("bh-sl-map-open")&&s.mapping(st)})},order:function(){this.writeDebug("order",arguments);var e=this,s=E("#"+e.settings.mapID),t=E("#"+e.settings.orderID);0!==t.length&&t.on("change."+it,function(t){t.stopPropagation(),!0===e.settings.pagination&&e.paginationChange(0),e.settings.sortBy.order=E(this).val(),e.settings.callbackOrder&&e.settings.callbackOrder.call(this,e.settings.order),s.hasClass("bh-sl-map-open")&&e.mapping(st)})},countFilters:function(){this.writeDebug("countFilters");var t=0;if(!this.isEmptyObject(et))for(var e in et)et.hasOwnProperty(e)&&(t+=et[e].length);return t},_existingCheckedFilters:function(e){this.writeDebug("_existingCheckedFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" input[type=checkbox]").each(function(){var t;E(this).prop("checked")&&void 0!==(t=E(this).val())&&""!==t&&-1===et[e].indexOf(t)&&et[e].push(t)})},_existingSelectedFilters:function(e){this.writeDebug("_existingSelectedFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" select").each(function(){var t=E(this).val();void 0!==t&&""!==t&&-1===et[e].indexOf(t)&&(et[e]=[t])})},_existingRadioFilters:function(e){this.writeDebug("_existingRadioFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" input[type=radio]").each(function(){var t;E(this).prop("checked")&&void 0!==(t=E(this).val())&&""!==t&&-1===et[e].indexOf(t)&&(et[e]=[t])})},checkFilters:function(){for(var t in this.writeDebug("checkFilters"),this.settings.taxonomyFilters)this.settings.taxonomyFilters.hasOwnProperty(t)&&(this._existingCheckedFilters(t),this._existingSelectedFilters(t),this._existingRadioFilters(t))},selectQueryStringFilters:function(t,e){this.writeDebug("selectQueryStringFilters",arguments);var s=E("#"+this.settings.taxonomyFilters[t]);if(s.find('input[type="checkbox"]').length)for(var i=0;i ul").append(i))}),E("."+this.settings.locationList+" ul li:even").css("background",this.settings.listColor1),E("."+this.settings.locationList+" ul li:odd").css("background",this.settings.listColor2)},dragSearch:function(t){this.writeDebug("dragSearch",arguments);var e=t.getCenter(),s=this,t=(this.settings.mapSettings.zoom=t.getZoom(),l=st.lat=e.lat(),g=st.lng=e.lng(),new this.reverseGoogleGeocode(this)),e=new google.maps.LatLng(st.lat,st.lng);t.geocode({latLng:e},function(t){null!==t?(st.origin=H=t.address,s.mapping(st)):s.notify(s.settings.addressErrorAlert)})},emptyResult:function(){this.writeDebug("emptyResult",arguments);var t=E("."+this.settings.locationList+" ul"),e=this.settings.mapSettings;this.map=new google.maps.Map(_.getElementById(this.settings.mapID),e),this.settings.callbackNoResults&&this.settings.callbackNoResults.call(this,this.map,e),t.empty(),e=E('
  • '+this.settings.noResultsTitle+'

    '+this.settings.noResultsDesc+"
  • ").hide().fadeIn(),t.append(e),t=l&&g?new google.maps.LatLng(l,g):new google.maps.LatLng(0,0),this.map.setCenter(t),V&&this.map.setZoom(V)},originMarker:function(t,e,s){var i;this.writeDebug("originMarker",arguments),!0===this.settings.originMarker&&(i="",void 0!==e)&&(i=null!==this.settings.originMarkerImg?null===this.settings.originMarkerDim?this.markerImage(this.settings.originMarkerImg):this.markerImage(this.settings.originMarkerImg,this.settings.originMarkerDim.width,this.settings.originMarkerDim.height):{url:"https://mt.googleapis.com/vt/icon/name=icons/spotlight/spotlight-waypoint-a.png"},new google.maps.Marker({position:s,map:t,icon:i,draggable:!1}))},modalWindow:function(){var e;this.writeDebug("modalWindow"),!0===this.settings.modal&&((e=this).settings.callbackModalOpen&&e.settings.callbackModalOpen.call(this),E("."+e.settings.overlay).fadeIn(),E(_).on("click."+it,"."+e.settings.closeIcon+", ."+e.settings.overlay,function(){e.modalClose()}),E(_).on("click."+it,"."+e.settings.modalWindow,function(t){t.stopPropagation()}),E(_).on("keyup."+it,function(t){27===t.keyCode&&e.modalClose()}))},openNearestLocation:function(t,e,s,i){var n,a;this.writeDebug("openNearestLocation",arguments),!0!==this.settings.openNearest||void 0===t||void 0===z||!0===this.settings.fullMapStart&&!0===W&&!1===this.settings.querystringParams||!0===this.settings.defaultLoc&&!0===W&&!1===this.settings.querystringParams||((n=this).settings.callbackNearestLoc&&n.settings.callbackNearestLoc.call(this,n.map,t,e,s,i),t=t.hasOwnProperty("markerid")?t.markerid:0,a=tt[t],n.createInfowindow(a,"left",e,s,i),a=E("."+n.settings.locationList),e=E("."+n.settings.locationList+" li[data-markerid="+t+"]"),E("."+n.settings.locationList+" li").removeClass("list-focus"),e.addClass("list-focus"),a.animate({scrollTop:e.offset().top-a.offset().top+a.scrollTop()}))},listClick:function(s,i,n,a){this.writeDebug("listClick",arguments);var o=this;E(_).on("click."+it,"."+o.settings.locationList+" li",function(){var t=E(this).data("markerid"),e=tt[t];o.settings.callbackListClick&&o.settings.callbackListClick.call(this,t,e,X[t],s),s.panTo(e.getPosition());o.createInfowindow(e,"left",i,n,a),null!==o.settings.selectedMarkerImg&&o.changeSelectedMarker(e),E("."+o.settings.locationList+" li").removeClass("list-focus"),E("."+o.settings.locationList+" li[data-markerid="+t+"]").addClass("list-focus")}),E(_).on("click."+it,"."+o.settings.locationList+" li a",function(t){t.stopPropagation()})},resultsTotalCount:function(t){this.writeDebug("resultsTotalCount",arguments);var e=E(".bh-sl-total-results");void 0===t||t<=0||0===e.length||e.text(t)},inlineDirections:function(e,s){var i;this.writeDebug("inlineDirections",arguments),!0===this.settings.inlineDirections&&void 0!==s&&(i=this,E(_).on("click."+it,"."+i.settings.locationList+" li .loc-directions a",function(t){t.preventDefault();t=E(this).closest("li").attr("data-markerid");i.directionsRequest(s,parseInt(t),e),E(_).on("click."+it,"."+i.settings.locationList+" .bh-sl-close-icon",function(){i.closeDirections()})}))},visibleMarkersList:function(t,e){var s;this.writeDebug("visibleMarkersList",arguments),!0===this.settings.visibleMarkersList&&(s=this,google.maps.event.addListenerOnce(t,"idle",function(){s.checkVisibleMarkers(e,t)}),google.maps.event.addListener(t,"center_changed",function(){s.checkVisibleMarkers(e,t)}),google.maps.event.addListener(t,"zoom_changed",function(){s.checkVisibleMarkers(e,t)}))},featuredDistanceRestriction:function(){this.writeDebug("featuredDistanceRestriction",arguments);var e=this;return Z=E.grep(Z,function(t){if(t.hasOwnProperty("distance"))return parseFloat(t.distance)<=parseFloat(e.settings.featuredDistance)})},featuredRestrictions:function(t){return this.writeDebug("featuredRestrictions",arguments),Z=null!==this.settings.featuredDistance&&null!==this.settings.featuredDistance?this.featuredDistanceRestriction(t):Z},mapping:function(e){this.writeDebug("mapping",arguments);var t,s,i,n,a,o,r=this;this.isEmptyObject(e)||(t=e.lat,s=e.lng,i=e.geocodeResult,n=e.origin,o=e.page),!0!==r.settings.pagination||void 0!==o&&z===H||(o=0),q=void 0===n&&!0===this.settings.nameSearch?r._getData():(a=new google.maps.LatLng(t,s),void 0!==z&&n===z&&void 0!==Q?(n=z,Q):r._getData(l,g,n,i,e)),null!==r.settings.taxonomyFilters&&r.hasEmptyObjectVals(et)&&r.checkFilters(),null!==r.settings.dataRaw?r.processData(e,a,q,o):q.done(function(t){r.processData(e,a,t,o)})},resetDisabledFilterVals:function(){for(var t in this.writeDebug("resetDisabledFilterVals"),this.settings.taxonomyFilters)if(this.settings.taxonomyFilters.hasOwnProperty(t))for(var e=0;er)&&m.notify(m.settings.distanceErrorAlert+r+" "+w);else{if(void 0===X[0])throw m.emptyResult(),new Error("No locations found. Please check the dataLocation setting and path.");-1!==m.settings.distanceAlert&&X[0].distance>m.settings.distanceAlert&&(m.notify(m.settings.distanceErrorAlert+m.settings.distanceAlert+" "+w),h=!0)}void 0!==X[0]&&(d=X[0])}if(!0===m.settings.featuredLocations&&(Z=E.grep(X,function(t){if(t.hasOwnProperty("featured"))return"true"===t.featured}),Z=m.featuredRestrictions(t),Y=E.grep(X,function(t){if(t.hasOwnProperty("featured"))return"true"!==t.featured}),X=[],X=Z.concat(Y)),(!0!==W&&!1===m.settings.exclusiveFiltering||!0===m.settings.fullMapStart&&!1===m.settings.exclusiveFiltering||!0===m.settings.defaultLoc&&!1===m.settings.exclusiveFiltering)&&m.maybeDisableFilterOptions(),!0===m.settings.slideMap&&j.slideDown(),!0===m.settings.pagination&&m.paginationSetup(i),!0===m.settings.altDistanceNoResult&&d.distance>m.settings.distanceAlert)m.emptyResult();else if(m.isEmptyObject(X)||"none"===X[0].result)m.emptyResult();else{m.modalWindow(),K=-1===m.settings.storeLimit||X.lengthX.length&&(c=m.settings.locationsPerPage-(g+c-X.length)),X=X.slice(g,g+c),K=X.length):(c=K,g=0),m.resultsTotalCount(X.length),!0===m.settings.fullMapStart&&!0===W&&!0!==m.settings.querystringParams||0===m.settings.mapSettings.zoom||void 0===o||!0===h||!0===m.settings.maxDistance&&!1===W&&0m.settings.fullMapStartListLimit)for(var G=0;G li:even").css("background",m.settings.listColor1),E("."+m.settings.locationList+" ul > li:odd").css("background",m.settings.listColor2),m.visibleMarkersList(m.map,tt),!0===m.settings.querystringParams&&(w=E("#"+m.settings.addressID),P=E("#"+m.settings.searchID),void 0!==st&&st.hasOwnProperty("origin")&&""===w.val()&&w.val(st.origin),void 0!==st)&&st.hasOwnProperty("name")&&""===P.val()&&P.val(st.name),!0===m.settings.modal&&m.settings.callbackModalReady&&m.settings.callbackModalReady.call(this,t),m.settings.callbackFilters&&m.settings.callbackFilters.call(this,et,t)}},writeDebug:function(){N.console&&this.settings.debug&&(Function.prototype.bind?this.writeDebug=Function.prototype.bind.call(console.log,console,"StoreLocator :"):this.writeDebug=function(){arguments[0]="StoreLocator : "+arguments[0],Function.prototype.apply.call(console.log,console,arguments)},this.writeDebug.apply(this,arguments))}}),E.fn[it]=function(e){var s,i=arguments;return e===t||"object"==typeof e?this.each(function(){E.data(this,"plugin_"+it)||E.data(this,"plugin_"+it,new m(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?(this.each(function(){var t=E.data(this,"plugin_"+it);t instanceof m&&"function"==typeof t[e]&&(s=t[e].apply(t,Array.prototype.slice.call(i,1))),"destroy"===e&&E.data(this,"plugin_"+it,null)}),s!==t?s:this):void 0})}(jQuery,window,document); \ No newline at end of file +!function(E,N,_,t){"use strict";var j,a,r,c,z,Q,V,q,U,H,l,g,K,i,n,f,s,W,J,$,o,Z,X,Y,tt,et,h,u,st,d,p,it="storeLocator";function m(t,e){j=E(t),this.element=t,this.settings=E.extend({},p,e),this._defaults=p,this._name=it,this.init()}void 0===E.fn[it]&&"undefined"!=typeof google&&(p={ajaxData:null,altDistanceNoResult:!(d={}),autoComplete:!(st={}),autoCompleteDisableListener:!(u={}),autoCompleteOptions:{},autoGeocode:!(h={}),bounceMarker:!0,catMarkers:null,dataLocation:"data/locations.json",dataRaw:null,dataType:"json",debug:!(et={}),defaultLat:null,defaultLng:null,defaultLoc:!(tt=[]),disableAlphaMarkers:!(Y=[]),distanceAlert:60,dragSearch:!(X=[]),exclusiveFiltering:!(Z=[]),exclusiveTax:null,featuredDistance:null,featuredLocations:!1,fullMapStart:!1,fullMapStartBlank:!1,fullMapStartListLimit:!1,infoBubble:null,inlineDirections:!1,lengthUnit:"m",listColor1:"#ffffff",listColor2:"#eeeeee",loading:!1,locationsPerPage:10,mapSettings:{mapTypeId:google.maps.MapTypeId.ROADMAP,zoom:12},markerCluster:null,markerImg:null,markerDim:null,maxDistance:!1,modal:!1,nameAttribute:"name",nameSearch:!1,noForm:!1,openNearest:!1,originMarker:!1,originMarkerDim:null,originMarkerImg:null,pagination:!1,querystringParams:!1,selectedMarkerImg:null,selectedMarkerImgDim:null,sessionStorage:!1,slideMap:!0,sortBy:null,storeLimit:26,taxonomyFilters:null,visibleMarkersList:!1,xmlElement:"marker",addressID:"bh-sl-address",closeIcon:"bh-sl-close-icon",formContainer:"bh-sl-form-container",formID:"bh-sl-user-location",geocodeID:null,lengthSwapID:"bh-sl-length-swap",loadingContainer:"bh-sl-loading",locationList:"bh-sl-loc-list",mapID:"bh-sl-map",maxDistanceID:"bh-sl-maxdistance",modalContent:"bh-sl-modal-content",modalWindow:"bh-sl-modal-window",orderID:"bh-sl-order",overlay:"bh-sl-overlay",regionID:"bh-sl-region",searchID:"bh-sl-search",sortID:"bh-sl-sort",taxonomyFiltersContainer:"bh-sl-filters-container",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,callbackAutoGeoSuccess:null,callbackBeforeSend:null,callbackCloseDirections:null,callbackCreateMarker:null,callbackDirectionsRequest:null,callbackFilters:null,callbackFormVals:null,callbackGeocodeRestrictions:null,callbackJsonp:null,callbackListClick:null,callbackMapSet:null,callbackMarkerClick:null,callbackModalClose:null,callbackModalOpen:null,callbackModalReady:null,callbackNearestLoc:null,callbackNoResults:null,callbackNotify:null,callbackOrder:null,callbackPageChange:null,callbackRegion:null,callbackSorting:null,callbackSuccess: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 ",kilometerLang:"kilometer",kilometersLang:"kilometers",mileLang:"mile",milesLang:"miles",noResultsTitle:"No results",noResultsDesc:"No locations were found with the given criteria. Please modify your selections or input.",nextPage:"Next »",prevPage:"« Prev"},E.extend(m.prototype,{init:function(){var t,e=this;this.writeDebug("init"),"km"===this.settings.lengthUnit?u.EarthRadius=6367:u.EarthRadius=3956,c="kml"===this.settings.dataType?"xml":this.settings.dataType,!0===this.settings.inlineDirections&&E("."+this.settings.locationList).prepend('
    '),V=this.settings.mapSettings.zoom,Handlebars.registerHelper("niceURL",function(t){if(t)return t.replace("https://","").replace("http://","")}),null!==this.settings.taxonomyFilters&&this.taxonomyFiltering(),this.sorting(),this.order(),!0===this.settings.modal&&(null!==this.settings.taxonomyFilters&&E("."+this.settings.taxonomyFiltersContainer).clone(!0,!0).prependTo(j),j.wrap('
    '),E("."+this.settings.modalWindow).prepend('
    '),E("."+this.settings.overlay).hide()),!0===this.settings.autoComplete&&(t=_.getElementById(this.settings.addressID),t=new google.maps.places.Autocomplete(t,this.settings.autoCompleteOptions),!0===this.settings.autoComplete)&&!0!==this.settings.autoCompleteDisableListener&&t.addListener("place_changed",function(t){e.processForm(t)}),this._loadTemplates()},destroy:function(){this.writeDebug("destroy"),this.reset();var t=E("#"+this.settings.mapID);if(tt.length)for(var e=0;e<=tt.length;e++)google.maps.event.removeListener(tt[e]);E("."+this.settings.locationList+" ul").empty(),t.hasClass("bh-sl-map-open")&&t.empty().removeClass("bh-sl-map-open"),!0===this.settings.modal&&E(". "+this.settings.overlay).remove(),t.attr("style",""),j.hide(),E.removeData(j.get(0)),E(_).off(it),j.unbind()},reset:function(){var t;this.writeDebug("reset"),X=[],Z=[],Y=[],W=!(tt=[]),E(_).off("click."+it,"."+this.settings.locationList+" li"),E("."+this.settings.locationList+" .bh-sl-close-directions-container").length&&E(".bh-sl-close-directions-container").remove(),!0===this.settings.inlineDirections&&(0<(t=E("."+this.settings.locationList+" .adp")).length&&(t.remove(),E("."+this.settings.locationList+" ul").fadeIn()),E(_).off("click","."+this.settings.locationList+" li .loc-directions a")),!0===this.settings.pagination&&E(_).off("click."+it,".bh-sl-pagination li")},formFiltersReset:function(){var t,e;this.writeDebug("formFiltersReset"),null!==this.settings.taxonomyFilters&&(t=E("."+this.settings.taxonomyFiltersContainer+" input"),e=E("."+this.settings.taxonomyFiltersContainer+" select"),"object"==typeof t)&&(t.each(function(){(E(this).is('input[type="checkbox"]')||E(this).is('input[type="radio"]'))&&E(this).prop("checked",!1)}),e.each(function(){E(this).prop("selectedIndex",0)}))},mapReload:function(){this.writeDebug("mapReload"),this.reset(),J=!0,null!==this.settings.taxonomyFilters&&(this.formFiltersReset(),this.resetDisabledFilterVals(),this.taxonomyFiltersInit()),l&&g?(this.settings.mapSettings.zoom=V,this.processForm()):this.mapping(st)},notify:function(t){this.writeDebug("notify",t),this.settings.callbackNotify?this.settings.callbackNotify.call(this,t):alert(t)},geoCodeCalcToRadian:function(t){return this.writeDebug("geoCodeCalcToRadian",t),t*(Math.PI/180)},geoCodeCalcDiffRadian:function(t,e){return this.writeDebug("geoCodeCalcDiffRadian",arguments),this.geoCodeCalcToRadian(e)-this.geoCodeCalcToRadian(t)},geoCodeCalcCalcDistance:function(t,e,s,i,n){return this.writeDebug("geoCodeCalcCalcDistance",arguments),2*n*Math.asin(Math.min(1,Math.sqrt(Math.pow(Math.sin(this.geoCodeCalcDiffRadian(t,s)/2),2)+Math.cos(this.geoCodeCalcToRadian(t))*Math.cos(this.geoCodeCalcToRadian(s))*Math.pow(Math.sin(this.geoCodeCalcDiffRadian(e,i)/2),2))))},inRange:function(t,e,s){return this.writeDebug("inRange",arguments),e=Math.abs(e),isFinite(e)&&t<=e&&e<=s},coordinatesInRange:function(t,e){return this.writeDebug("coordinatesInRange",arguments),this.inRange(-90,t,90)&&this.inRange(-180,e,180)},getQueryString:function(t){if(this.writeDebug("getQueryString",t),t)return t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),null===(t=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search))?"":decodeURIComponent(t[1].replace(/\+/g," "))},getMap:function(){return this.map},_loadTemplates:function(){this.writeDebug("_loadTemplates");var e,t=this,s='
    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?E.when(E.get(this.settings.KMLinfowindowTemplatePath,function(t){e=t,r=Handlebars.compile(e)}),E.get(this.settings.KMLlistTemplatePath,function(t){e=t,a=Handlebars.compile(e)})).then(function(){t.locator()},function(){throw E("."+t.settings.formContainer).append(s),new Error("Could not load storeLocator plugin templates")}):null!==this.settings.listTemplateID&&null!==this.settings.infowindowTemplateID?(r=Handlebars.compile(E("#"+this.settings.infowindowTemplateID).html()),a=Handlebars.compile(E("#"+this.settings.listTemplateID).html()),t.locator()):E.when(E.get(this.settings.infowindowTemplatePath,function(t){e=t,r=Handlebars.compile(e)}),E.get(this.settings.listTemplatePath,function(t){e=t,a=Handlebars.compile(e)})).then(function(){t.locator()},function(){throw E("."+t.settings.formContainer).append(s),new Error("Could not load storeLocator plugin templates")})},locator:function(){this.writeDebug("locator"),!0===this.settings.slideMap&&j.hide(),this._start(),this._formEventHandler()},_formEventHandler:function(){this.writeDebug("_formEventHandler");var e=this;!0===this.settings.noForm?(E(_).on("click."+it,"."+this.settings.formContainer+" button",function(t){e.processForm(t)}),E(_).on("keydown."+it,function(t){13===t.keyCode&&E("#"+e.settings.addressID).is(":focus")&&e.processForm(t)})):E(_).on("submit."+it,"#"+this.settings.formID,function(t){e.processForm(t)}),E(".bh-sl-reset").length&&E("#"+this.settings.mapID).length&&E(_).on("click."+it,".bh-sl-reset",function(){e.mapReload()}),E("#"+this.settings.addressID).on("change."+it,function(){o=t,d={},""!==E.trim(E("#"+e.settings.addressID).val())||void 0!==U&&""!==U||null!==e.settings.taxonomyFilters&&!1===e.settings.exclusiveFiltering&&(z=g=l=t,st={},e.resetDisabledFilterVals(),e.taxonomyFiltersInit(),e.mapping(null))})},_getData:function(t,e,s,i,n){this.writeDebug("_getData",arguments);var a,o=this,r="",l="",g="";return void 0!==i&&void 0!==i.geometry.bounds&&(g=i.formatted_address,r=JSON.stringify(i.geometry.bounds.getNorthEast()),l=JSON.stringify(i.geometry.bounds.getSouthWest())),this.settings.callbackBeforeSend&&this.settings.callbackBeforeSend.call(this,t,e,s,g,r,l,n),null!==o.settings.dataRaw?"xml"===c?E.parseXML(o.settings.dataRaw):"json"===c?Array.isArray&&Array.isArray(o.settings.dataRaw)?o.settings.dataRaw:"string"==typeof o.settings.dataRaw?JSON.parse(o.settings.dataRaw):[]:void 0:(a=E.Deferred(),!0===this.settings.loading&&E("."+this.settings.formContainer).append('
    '),i={origLat:t,origLng:e,origAddress:s,formattedAddress:g,boundsNorthEast:r,boundsSouthWest:l},null!==this.settings.ajaxData&&"object"==typeof this.settings.ajaxData&&E.extend(i,this.settings.ajaxData),E.ajax({type:"GET",url:this.settings.dataLocation+("jsonp"===this.settings.dataType?(this.settings.dataLocation.match(/\?/)?"&":"?")+"callback=?":""),data:i,dataType:c,jsonpCallback:"jsonp"===this.settings.dataType?this.settings.callbackJsonp:null}).done(function(t){a.resolve(t),!0===o.settings.loading&&E("."+o.settings.formContainer+" ."+o.settings.loadingContainer).remove()}).fail(a.reject),a.promise())},_start:function(){this.writeDebug("_start");var t,e,s=this,i=this.settings.autoGeocode;!1!==s.settings.fullMapStartBlank?(E("#"+s.settings.mapID).addClass("bh-sl-map-open"),(e=s.settings.mapSettings).zoom=s.settings.fullMapStartBlank,t=new google.maps.LatLng(this.settings.defaultLat,this.settings.defaultLng),e.center=t,s.map=new google.maps.Map(_.getElementById(s.settings.mapID),e),N.addEventListener("resize",function(){var t=s.map.getCenter();google.maps.event.trigger(s.map,"resize"),s.map.setCenter(t)}),s.settings.fullMapStartBlank=!1,e.zoom=V):(!0===this.settings.defaultLoc&&this.defaultLocation(),""!==E.trim(E("#"+this.settings.addressID).val())?(s.writeDebug("Using Address Field"),s.processForm(null),i=!1):!0===this.settings.fullMapStart&&!1===this.settings.defaultLoc&&(!0===this.settings.querystringParams&&this.getQueryString(this.settings.addressID)||!0===this.settings.querystringParams&&this.getQueryString(this.settings.searchID)||!0===this.settings.querystringParams&&this.getQueryString(this.settings.maxDistanceID)?(s.writeDebug("Using Query String"),this.processForm(null),i=!1):this.mapping(null))),!0===this.settings.autoGeocode&&!0===i&&(s.writeDebug("Auto Geo"),s.htmlGeocode()),null!==this.settings.autoGeocode&&(s.writeDebug("Button Geo"),E(_).on("click."+it,"#"+this.settings.geocodeID,function(){s.htmlGeocode()}))},htmlGeocode:function(){this.writeDebug("htmlGeocode",arguments);var e=this;if(!0===e.settings.sessionStorage&&N.sessionStorage&&N.sessionStorage.getItem("myGeo"))return e.writeDebug("Using Session Saved Values for GEO"),e.autoGeocodeQuery(JSON.parse(N.sessionStorage.getItem("myGeo"))),!1;navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(t){e.writeDebug("Current Position Result");t={coords:{latitude:t.coords.latitude,longitude:t.coords.longitude,accuracy:t.coords.accuracy}};!0===e.settings.sessionStorage&&N.sessionStorage&&N.sessionStorage.setItem("myGeo",JSON.stringify(t)),e.settings.callbackAutoGeoSuccess&&e.settings.callbackAutoGeoSuccess.call(this,t),e.autoGeocodeQuery(t)},function(t){e._autoGeocodeError(t)})},googleGeocode:function(t){t.writeDebug("googleGeocode",arguments);var e=new google.maps.Geocoder;this.geocode=function(t,s){e.geocode(t,function(t,e){if(e!==google.maps.GeocoderStatus.OK)throw s(null),new Error("Geocode was not successful for the following reason: "+e);e={};e.latitude=t[0].geometry.location.lat(),e.longitude=t[0].geometry.location.lng(),e.geocodeResult=t[0],s(e)})}},reverseGoogleGeocode:function(t){t.writeDebug("reverseGoogleGeocode",arguments);var e=new google.maps.Geocoder;this.geocode=function(t,s){e.geocode(t,function(t,e){if(e!==google.maps.GeocoderStatus.OK)throw s(null),new Error("Reverse geocode was not successful for the following reason: "+e);t[0]&&((e={}).address=t[0].formatted_address,e.fullResult=t[0],s(e))})}},roundNumber:function(t,e){return this.writeDebug("roundNumber",arguments),Math.round(t*Math.pow(10,e))/Math.pow(10,e)},isEmptyObject:function(t){for(var e in this.writeDebug("isEmptyObject",arguments),t)if(t.hasOwnProperty(e))return!1;return!0},hasEmptyObjectVals:function(t){this.writeDebug("hasEmptyObjectVals",arguments);var e,s=!0;for(e in t)t.hasOwnProperty(e)&&""!==t[e]&&0!==t[e].length&&(s=!1);return s},hasSingleGroupFilterVal:function(t,e){this.writeDebug("hasSingleGroupFilterVal",arguments);t=Object.assign({},t);return!this.hasEmptyObjectVals(t[e])},modalClose:function(){this.writeDebug("modalClose"),this.settings.callbackModalClose&&this.settings.callbackModalClose.call(this),et={},E("."+this.settings.overlay+" select").prop("selectedIndex",0),E("."+this.settings.overlay+" input").prop("checked",!1),E("."+this.settings.overlay).hide()},_createLocationVariables:function(t){var e,s;for(s in this.writeDebug("_createLocationVariables",arguments),h={},X[t])X[t].hasOwnProperty(s)&&(e=X[t][s],"distance"!==s&&"altdistance"!==s||(e=this.roundNumber(e,2)),h[s]=e)},sortAlpha:function(t){this.writeDebug("sortAlpha",arguments);var s=this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"name";this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return e[s].toLowerCase().localeCompare(t[s].toLowerCase())}):t.sort(function(t,e){return t[s].toLowerCase().localeCompare(e[s].toLowerCase())})},sortDate:function(t){this.writeDebug("sortDate",arguments);var s=this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"date";this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return new Date(e[s]).getTime()-new Date(t[s]).getTime()}):t.sort(function(t,e){return new Date(t[s]).getTime()-new Date(e[s]).getTime()})},sortNumerically:function(t,e){this.writeDebug("sortNumerically",arguments);var s=null!==this.settings.sortBy&&this.settings.sortBy.hasOwnProperty("prop")&&void 0!==this.settings.sortBy.prop?this.settings.sortBy.prop:"distance";void 0!==e&&!0===e&&(s="distance"),null!==this.settings.sortBy&&this.settings.sortBy.hasOwnProperty("order")&&"desc"===this.settings.sortBy.order.toString()?t.sort(function(t,e){return e[s]t[s]?1:0}):t.sort(function(t,e){return t[s]e[s]?1:0})},sortCustom:function(t){this.writeDebug("sortCustom",arguments),this.settings.sortBy.hasOwnProperty("method")&&"alpha"===this.settings.sortBy.method.toString()?this.sortAlpha(t):this.settings.sortBy.hasOwnProperty("method")&&"date"===this.settings.sortBy.method.toString()?this.sortDate(t):this.sortNumerically(t)},filterMatching:function(t,e,s){return this.writeDebug("inclusiveFilter",arguments),void 0!==e&&(s=!0===(s=void 0===s||s)?t.join(""):t.join("|"),!!new RegExp(s,"i").test(e.replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g,"")))},filterData:function(t,e){this.writeDebug("filterData",arguments);var s,i=!0;for(s in e)if(e.hasOwnProperty(s)){for(var n=[],a=0;a'+this.settings.prevPage+"");for(var n=0;n'+a+"":'
  • '+a+"
  • "}return i'+this.settings.nextPage+""),s},paginationSetup:function(t){this.writeDebug("paginationSetup",arguments);var e="",s=E(".bh-sl-pagination-container .bh-sl-pagination"),i=-1===this.settings.storeLimit||X.length ul").append(e)},changeSelectedMarker:function(t){var e;void 0!==s&&s.setIcon(f),e=null===this.settings.selectedMarkerImgDim?this.markerImage(this.settings.selectedMarkerImg):this.markerImage(this.settings.selectedMarkerImg,this.settings.selectedMarkerImgDim.width,this.settings.selectedMarkerImgDim.height),f=t.icon,t.setIcon(e),s=t},createInfowindow:function(s,t,i,e,n){this.writeDebug("createInfowindow",arguments);var a=this,e=this._defineLocationData(s,e,n),o=r(e);"left"===t?(i.setContent(o),i.open(s.get("map"),s)):google.maps.event.addListener(s,"click",function(){i.setContent(o),i.open(s.get("map"),s);var t=s.get("id"),e=E("."+a.settings.locationList+" li[data-markerid="+t+"]");0
    ')),E(_).off("click","."+this.settings.locationList+" li .loc-directions a")},closeDirections:function(){this.writeDebug("closeDirections"),this.settings.callbackCloseDirections&&this.settings.callbackCloseDirections.call(this),this.reset(),l&&g&&(0===this.countFilters()?this.settings.mapSettings.zoom=V:this.settings.mapSettings.zoom=0,this.processForm(null)),E(_).off("click."+it,"."+this.settings.locationList+" .bh-sl-close-icon")},lengthUnitSwap:function(t){this.writeDebug("lengthUnitSwap",arguments),"alt-distance"===t.val()?(E("."+this.settings.locationList+" .loc-alt-dist").show(),E("."+this.settings.locationList+" .loc-default-dist").hide()):"default-distance"===t.val()&&(E("."+this.settings.locationList+" .loc-default-dist").show(),E("."+this.settings.locationList+" .loc-alt-dist").hide())},processForm:function(t){this.writeDebug("processForm",arguments);var e=this,s=null,i={},n=E("#"+this.settings.addressID),a=E("#"+this.settings.searchID),o=E("#"+this.settings.maxDistanceID),r="";null!=t&&t.preventDefault(),E("."+e.settings.formContainer+" input, ."+e.settings.formContainer+" select").blur(),!0===this.settings.querystringParams&&(this.getQueryString(this.settings.addressID)||this.getQueryString(this.settings.searchID)||this.getQueryString(this.settings.maxDistanceID))?(H=this.getQueryString(this.settings.addressID),U=this.getQueryString(this.settings.searchID),s=this.getQueryString(this.settings.maxDistanceID),""!==n.val()&&(H=n.val()),""!==a.val()&&(U=a.val()),""!==o.val()&&(s=o.val())):(H=n.val()||"",U=a.val()||"",!0===this.settings.maxDistance&&(s=o.val()||"")),r=this.settings.callbackRegion?this.settings.callbackRegion.call(this,H,U,s):E("#"+this.settings.regionID).val(),this.settings.callbackFormVals&&this.settings.callbackFormVals.call(this,H,U,s,r),void 0!==r&&(i={country:r}),"function"==typeof this.settings.callbackGeocodeRestrictions&&(i=this.settings.callbackGeocodeRestrictions.call(this,H,U,s)),""===H&&""===U&&!0!==this.settings.autoGeocode?this._start():""!==H?(""===U&&et.hasOwnProperty("name")&&delete et.name,void 0!==z&&void 0!==l&&void 0!==g&&H===z?(st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,e.mapping(st)):new this.googleGeocode(this).geocode({address:H,componentRestrictions:i,region:r},function(t){null!==t?(l=t.latitude,g=t.longitude,st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,st.geocodeResult=t.geocodeResult,e.mapping(st)):e.notify(e.settings.addressErrorAlert)})):""!==U?(""===H&&delete st.origin,st.name=U,e.mapping(st)):!0===this.settings.autoGeocode&&(st.lat=l,st.lng=g,st.origin=H,st.name=U,st.distance=s,e.mapping(st))},locationsSetup:function(t,e,s,i,n){this.writeDebug("locationsSetup",arguments),void 0===i||t.distance||(t.distance=this.geoCodeCalcCalcDistance(e,s,t.lat,t.lng,u.EarthRadius),"m"===this.settings.lengthUnit?t.altdistance=1.609344*parseFloat(t.distance):"km"===this.settings.lengthUnit&&(t.altdistance=parseFloat(t.distance)/1.609344)),this.coordinatesInRange(t.lat,t.lng)?!0===this.settings.maxDistance&&null!=n?t.distance<=n?X.push(t):this.writeDebug("locationsSetup","location ignored because it is out of maxDistance: "+n,t):!0!==this.settings.maxDistance||!0!==this.settings.querystringParams||null==n||t.distance<=n?X.push(t):this.writeDebug("locationsSetup","location ignored because it is out of maxDistance: "+n,t):this.writeDebug("locationsSetup","location ignored because coordinates out of range: "+n,t)},sorting:function(){this.writeDebug("sorting",arguments);var s=this,i=E("#"+s.settings.mapID),t=E("#"+s.settings.sortID);0!==t.length&&t.on("change."+it,function(t){var e;t.stopPropagation(),!0===s.settings.pagination&&s.paginationChange(0),t=void 0!==E(this).find(":selected").attr("data-method")?E(this).find(":selected").attr("data-method"):"distance",e=E(this).val(),s.settings.sortBy.method=t,s.settings.sortBy.prop=e,s.settings.callbackSorting&&s.settings.callbackSorting.call(this,s.settings.sortBy),i.hasClass("bh-sl-map-open")&&s.mapping(st)})},order:function(){this.writeDebug("order",arguments);var e=this,s=E("#"+e.settings.mapID),t=E("#"+e.settings.orderID);0!==t.length&&t.on("change."+it,function(t){t.stopPropagation(),!0===e.settings.pagination&&e.paginationChange(0),e.settings.sortBy.order=E(this).val(),e.settings.callbackOrder&&e.settings.callbackOrder.call(this,e.settings.order),s.hasClass("bh-sl-map-open")&&e.mapping(st)})},countFilters:function(){this.writeDebug("countFilters");var t=0;if(!this.isEmptyObject(et))for(var e in et)et.hasOwnProperty(e)&&(t+=et[e].length);return t},_existingCheckedFilters:function(e){this.writeDebug("_existingCheckedFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" input[type=checkbox]").each(function(){var t;E(this).prop("checked")&&void 0!==(t=E(this).val())&&""!==t&&-1===et[e].indexOf(t)&&et[e].push(t)})},_existingSelectedFilters:function(e){this.writeDebug("_existingSelectedFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" select").each(function(){var t=E(this).val();void 0!==t&&""!==t&&-1===et[e].indexOf(t)&&(et[e]=[t])})},_existingRadioFilters:function(e){this.writeDebug("_existingRadioFilters",arguments),E("#"+this.settings.taxonomyFilters[e]+" input[type=radio]").each(function(){var t;E(this).prop("checked")&&void 0!==(t=E(this).val())&&""!==t&&-1===et[e].indexOf(t)&&(et[e]=[t])})},checkFilters:function(){for(var t in this.writeDebug("checkFilters"),this.settings.taxonomyFilters)this.settings.taxonomyFilters.hasOwnProperty(t)&&(this._existingCheckedFilters(t),this._existingSelectedFilters(t),this._existingRadioFilters(t))},selectQueryStringFilters:function(t,e){this.writeDebug("selectQueryStringFilters",arguments);var s=E("#"+this.settings.taxonomyFilters[t]);if(s.find('input[type="checkbox"]').length)for(var i=0;i ul").append(i))}),E("."+this.settings.locationList+" ul li:even").css("background",this.settings.listColor1),E("."+this.settings.locationList+" ul li:odd").css("background",this.settings.listColor2)},dragSearch:function(t){this.writeDebug("dragSearch",arguments);var e=t.getCenter(),s=this,t=(this.settings.mapSettings.zoom=t.getZoom(),l=st.lat=e.lat(),g=st.lng=e.lng(),new this.reverseGoogleGeocode(this)),e=new google.maps.LatLng(st.lat,st.lng);t.geocode({latLng:e},function(t){null!==t?(st.origin=H=t.address,s.mapping(st)):s.notify(s.settings.addressErrorAlert)})},emptyResult:function(){this.writeDebug("emptyResult",arguments);var t=E("."+this.settings.locationList+" ul"),e=this.settings.mapSettings;this.map=new google.maps.Map(_.getElementById(this.settings.mapID),e),this.settings.callbackNoResults&&this.settings.callbackNoResults.call(this,this.map,e),t.empty(),e=E('
  • '+this.settings.noResultsTitle+'

    '+this.settings.noResultsDesc+"
  • ").hide().fadeIn(),t.append(e),t=l&&g?new google.maps.LatLng(l,g):new google.maps.LatLng(0,0),this.map.setCenter(t),V&&this.map.setZoom(V)},originMarker:function(t,e,s){var i;this.writeDebug("originMarker",arguments),!0===this.settings.originMarker&&(i="",void 0!==e)&&(i=null!==this.settings.originMarkerImg?null===this.settings.originMarkerDim?this.markerImage(this.settings.originMarkerImg):this.markerImage(this.settings.originMarkerImg,this.settings.originMarkerDim.width,this.settings.originMarkerDim.height):{url:"https://mt.googleapis.com/vt/icon/name=icons/spotlight/spotlight-waypoint-a.png"},new google.maps.Marker({position:s,map:t,icon:i,draggable:!1}))},modalWindow:function(){var e;this.writeDebug("modalWindow"),!0===this.settings.modal&&((e=this).settings.callbackModalOpen&&e.settings.callbackModalOpen.call(this),E("."+e.settings.overlay).fadeIn(),E(_).on("click."+it,"."+e.settings.closeIcon+", ."+e.settings.overlay,function(){e.modalClose()}),E(_).on("click."+it,"."+e.settings.modalWindow,function(t){t.stopPropagation()}),E(_).on("keyup."+it,function(t){27===t.keyCode&&e.modalClose()}))},openNearestLocation:function(t,e,s,i){var n,a;this.writeDebug("openNearestLocation",arguments),!0!==this.settings.openNearest||void 0===t||void 0===z||!0===this.settings.fullMapStart&&!0===W&&!1===this.settings.querystringParams||!0===this.settings.defaultLoc&&!0===W&&!1===this.settings.querystringParams||((n=this).settings.callbackNearestLoc&&n.settings.callbackNearestLoc.call(this,n.map,t,e,s,i),t=t.hasOwnProperty("markerid")?t.markerid:0,a=tt[t],n.createInfowindow(a,"left",e,s,i),a=E("."+n.settings.locationList),e=E("."+n.settings.locationList+" li[data-markerid="+t+"]"),E("."+n.settings.locationList+" li").removeClass("list-focus"),e.addClass("list-focus"),a.animate({scrollTop:e.offset().top-a.offset().top+a.scrollTop()}))},listClick:function(s,i,n,a){this.writeDebug("listClick",arguments);var o=this;E(_).on("click."+it,"."+o.settings.locationList+" li",function(){var t=E(this).data("markerid"),e=tt[t];o.settings.callbackListClick&&o.settings.callbackListClick.call(this,t,e,X[t],s),s.panTo(e.getPosition());o.createInfowindow(e,"left",i,n,a),null!==o.settings.selectedMarkerImg&&o.changeSelectedMarker(e),E("."+o.settings.locationList+" li").removeClass("list-focus"),E("."+o.settings.locationList+" li[data-markerid="+t+"]").addClass("list-focus")}),E(_).on("click."+it,"."+o.settings.locationList+" li a",function(t){t.stopPropagation()})},resultsTotalCount:function(t){this.writeDebug("resultsTotalCount",arguments);var e=E(".bh-sl-total-results");void 0===t||t<=0||0===e.length||e.text(t)},inlineDirections:function(e,s){var i;this.writeDebug("inlineDirections",arguments),!0===this.settings.inlineDirections&&void 0!==s&&(i=this,E(_).on("click."+it,"."+i.settings.locationList+" li .loc-directions a",function(t){t.preventDefault();t=E(this).closest("li").attr("data-markerid");i.directionsRequest(s,parseInt(t),e),E(_).on("click."+it,"."+i.settings.locationList+" .bh-sl-close-icon",function(){i.closeDirections()})}))},visibleMarkersList:function(t,e){var s;this.writeDebug("visibleMarkersList",arguments),!0===this.settings.visibleMarkersList&&(s=this,google.maps.event.addListenerOnce(t,"idle",function(){s.checkVisibleMarkers(e,t)}),google.maps.event.addListener(t,"center_changed",function(){s.checkVisibleMarkers(e,t)}),google.maps.event.addListener(t,"zoom_changed",function(){s.checkVisibleMarkers(e,t)}))},featuredDistanceRestriction:function(){this.writeDebug("featuredDistanceRestriction",arguments);var e=this;return Z=E.grep(Z,function(t){if(t.hasOwnProperty("distance"))return parseFloat(t.distance)<=parseFloat(e.settings.featuredDistance)})},featuredRestrictions:function(t){return this.writeDebug("featuredRestrictions",arguments),Z=null!==this.settings.featuredDistance&&null!==this.settings.featuredDistance?this.featuredDistanceRestriction(t):Z},mapping:function(e){this.writeDebug("mapping",arguments);var t,s,i,n,a,o,r=this;this.isEmptyObject(e)||(t=e.lat,s=e.lng,i=e.geocodeResult,n=e.origin,o=e.page),!0!==r.settings.pagination||void 0!==o&&z===H||(o=0),q=void 0===n&&!0===this.settings.nameSearch?r._getData():(a=new google.maps.LatLng(t,s),void 0!==z&&n===z&&void 0!==Q?(n=z,Q):r._getData(l,g,n,i,e)),null!==r.settings.taxonomyFilters&&r.hasEmptyObjectVals(et)&&r.checkFilters(),null!==r.settings.dataRaw?r.processData(e,a,q,o):q.done(function(t){r.processData(e,a,t,o)})},resetDisabledFilterVals:function(){for(var t in this.writeDebug("resetDisabledFilterVals"),this.settings.taxonomyFilters)if(this.settings.taxonomyFilters.hasOwnProperty(t))for(var e=0;er)&&m.notify(m.settings.distanceErrorAlert+r+" "+w);else{if(void 0===X[0])throw m.emptyResult(),new Error("No locations found. Please check the dataLocation setting and path.");-1!==m.settings.distanceAlert&&X[0].distance>m.settings.distanceAlert&&(m.notify(m.settings.distanceErrorAlert+m.settings.distanceAlert+" "+w),h=!0)}void 0!==X[0]&&(d=X[0])}if(!0===m.settings.featuredLocations&&(Z=E.grep(X,function(t){if(t.hasOwnProperty("featured"))return"true"===t.featured}),Z=m.featuredRestrictions(t),Y=E.grep(X,function(t){if(t.hasOwnProperty("featured"))return"true"!==t.featured}),X=[],X=Z.concat(Y)),(!0!==W&&!1===m.settings.exclusiveFiltering||!0===m.settings.fullMapStart&&!1===m.settings.exclusiveFiltering||!0===m.settings.defaultLoc&&!1===m.settings.exclusiveFiltering)&&m.maybeDisableFilterOptions(),!0===m.settings.slideMap&&j.slideDown(),!0===m.settings.pagination&&m.paginationSetup(i),!0===m.settings.altDistanceNoResult&&d.distance>m.settings.distanceAlert)m.emptyResult();else if(m.isEmptyObject(X)||"none"===X[0].result)m.emptyResult();else{m.modalWindow(),K=-1===m.settings.storeLimit||X.lengthX.length&&(c=m.settings.locationsPerPage-(g+c-X.length)),X=X.slice(g,g+c),K=X.length):(c=K,g=0),m.resultsTotalCount(X.length),!0===m.settings.fullMapStart&&!0===W&&!0!==m.settings.querystringParams||0===m.settings.mapSettings.zoom||void 0===o||!0===h||!0===m.settings.maxDistance&&!1===W&&0m.settings.fullMapStartListLimit)for(var G=0;G li:even").css("background",m.settings.listColor1),E("."+m.settings.locationList+" ul > li:odd").css("background",m.settings.listColor2),m.visibleMarkersList(m.map,tt),!0===m.settings.querystringParams&&(w=E("#"+m.settings.addressID),P=E("#"+m.settings.searchID),void 0!==st&&st.hasOwnProperty("origin")&&""===w.val()&&w.val(st.origin),void 0!==st)&&st.hasOwnProperty("name")&&""===P.val()&&P.val(st.name),!0===m.settings.modal&&m.settings.callbackModalReady&&m.settings.callbackModalReady.call(this,t),m.settings.callbackFilters&&m.settings.callbackFilters.call(this,et,t)}},writeDebug:function(){N.console&&this.settings.debug&&(Function.prototype.bind?this.writeDebug=Function.prototype.bind.call(console.log,console,"StoreLocator :"):this.writeDebug=function(){arguments[0]="StoreLocator : "+arguments[0],Function.prototype.apply.call(console.log,console,arguments)},this.writeDebug.apply(this,arguments))}}),E.fn[it]=function(e){var s,i=arguments;return e===t||"object"==typeof e?this.each(function(){E.data(this,"plugin_"+it)||E.data(this,"plugin_"+it,new m(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?(this.each(function(){var t=E.data(this,"plugin_"+it);t instanceof m&&"function"==typeof t[e]&&(s=t[e].apply(t,Array.prototype.slice.call(i,1))),"destroy"===e&&E.data(this,"plugin_"+it,null)}),s!==t?s:this):void 0})}(jQuery,window,document); \ No newline at end of file diff --git a/readme.md b/readme.md index e7772a4..91e8238 100644 --- a/readme.md +++ b/readme.md @@ -35,6 +35,12 @@ filtering. ## Changelog +### Version 3.1.13 + +* Fixed additional disable filtering functionality related to select options and radio buttons by globally tracking the disabled values. +* Removed zoom reset to zero on taxonomy filtering to keep searched location in view. +* Updated maybeDisableFilterOptions to run when full map start or default location settings are enabled. + ### Version 3.1.12 * Added automatic reset functionality that fires when address input field value is removed (changed to blank). diff --git a/src/js/jquery.storelocator.js b/src/js/jquery.storelocator.js index 56d7cb2..e2a131c 100644 --- a/src/js/jquery.storelocator.js +++ b/src/js/jquery.storelocator.js @@ -2273,7 +2273,6 @@ if ($('#' + _this.settings.mapID).hasClass('bh-sl-map-open') === true) { if ((olat) && (olng)) { - _this.settings.mapSettings.zoom = 0; _this.processForm(); } else { @@ -2291,9 +2290,7 @@ if (_this.countFilters() === 0) { _this.settings.mapSettings.zoom = originalZoom; } - else { - _this.settings.mapSettings.zoom = 0; - } + _this.processForm(); } else { @@ -2319,7 +2316,6 @@ filters[filterKey] = [filterVal]; if ($('#' + _this.settings.mapID).hasClass('bh-sl-map-open') === true) { if ((olat) && (olng)) { - _this.settings.mapSettings.zoom = 0; _this.processForm(); } else { From 66d42fa1a65ba77036895968f46e61c3b8bc504e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Holine?= Date: Tue, 25 Jul 2023 23:27:12 -0700 Subject: [PATCH 5/5] Update plugin version number --- bower.json | 2 +- dist/assets/js/plugins/storeLocator/jquery.storelocator.js | 2 +- dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js | 2 +- package.json | 2 +- storelocator.jquery.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 26fda63..2d3c38e 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "jquery-storelocator-plugin", - "version": "3.1.12", + "version": "3.1.13", "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/dist/assets/js/plugins/storeLocator/jquery.storelocator.js b/dist/assets/js/plugins/storeLocator/jquery.storelocator.js index 82a8a71..1fe1146 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 - v3.1.12 - 2023-07-25 +/*! jQuery Google Maps Store Locator - v3.1.13 - 2023-07-25 * http://www.bjornblog.com/web/jquery-store-locator-plugin * Copyright (c) 2023 Bjorn Holine; Licensed MIT */ diff --git a/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js b/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js index 3ef2767..5f7684c 100644 --- a/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js +++ b/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js @@ -1,4 +1,4 @@ -/*! jQuery Google Maps Store Locator - v3.1.12 - 2023-07-25 +/*! jQuery Google Maps Store Locator - v3.1.13 - 2023-07-25 * http://www.bjornblog.com/web/jquery-store-locator-plugin * Copyright (c) 2023 Bjorn Holine; Licensed MIT */ diff --git a/package.json b/package.json index 1a254f4..c0328c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jquery-storelocator-plugin", - "version": "3.1.12", + "version": "3.1.13", "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/storelocator.jquery.json b/storelocator.jquery.json index 69dd13a..318e7dd 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","dealer","location", "locations", "maps", "map", "stores", "find"], - "version": "3.1.12", + "version": "3.1.13", "author": { "name": "Bjorn Holine", "url": "https://www.bjornblog.com/"