diff --git a/dist/assets/js/plugins/storeLocator/jquery.storelocator.js b/dist/assets/js/plugins/storeLocator/jquery.storelocator.js index 5067da5..86001b4 100644 --- a/dist/assets/js/plugins/storeLocator/jquery.storelocator.js +++ b/dist/assets/js/plugins/storeLocator/jquery.storelocator.js @@ -1,4 +1,4 @@ -/*! jQuery Google Maps Store Locator - v2.0.3 - 2014-12-11 +/*! jQuery Google Maps Store Locator - v2.0.4 - 2014-12-15 * http://www.bjornblog.com/web/jquery-store-locator-plugin * Copyright (c) 2014 Bjorn Holine; Licensed MIT */ @@ -430,7 +430,7 @@ // If a default location is set if (this.settings.defaultLoc === true) { // The address needs to be determined for the directions link - var r = new this.reverseGoogleGeocode(); + var r = new this.reverseGoogleGeocode(this); var latlng = new google.maps.LatLng(this.settings.defaultLat, this.settings.defaultLng); r.geocode({'latLng': latlng}, function (data) { if (data !== null) { @@ -472,8 +472,8 @@ /** * Geocode function used to geocode the origin (entered location) */ - googleGeocode: function () { - var _this = this; + googleGeocode: function (thisObj) { + var _this = thisObj; var geocoder = new google.maps.Geocoder(); this.geocode = function (request, callbackFunction) { geocoder.geocode(request, function (results, status) { @@ -493,8 +493,8 @@ /** * Reverse geocode to get address for automatic options needed for directions link */ - reverseGoogleGeocode: function () { - var _this = this; + reverseGoogleGeocode: function (thisObj) { + var _this = thisObj; var geocoder = new google.maps.Geocoder(); this.geocode = function (request, callbackFunction) { geocoder.geocode(request, function (results, status) { @@ -641,6 +641,7 @@ * @returns {string} */ _paginationOutput: function(currentPage, totalPages) { + currentPage = parseFloat(currentPage); var output = ''; var nextPage = currentPage + 1; @@ -652,7 +653,7 @@ } // Add the numbers - for (var p = 0; p < totalPages; p++) { + for (var p = 0; p < Math.ceil(totalPages); p++) { var n = p + 1; if (p === currentPage) { @@ -935,7 +936,7 @@ var _this = this; var mappingObj = {}; // The address needs to be determined for the directions link - var r = new this.reverseGoogleGeocode(); + var r = new this.reverseGoogleGeocode(this); var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); r.geocode({'latLng': latlng}, function (data) { if (data !== null) { @@ -1122,7 +1123,7 @@ this._start(); } else if(addressInput !== '') { - var g = new this.googleGeocode(); + var g = new this.googleGeocode(this); g.geocode({'address': addressInput, 'region': region}, function (data) { if (data !== null) { olat = data.latitude; @@ -1151,7 +1152,6 @@ * Checks distance of each location and setups up the locationset array * * @param data {Object} location data object - * @param l {number} iterator from the loop processing the data in the mapping function below * @param lat {number} origin latitude * @param lng {number} origin longitude * @param firstRun {boolean} initial load check @@ -1663,6 +1663,10 @@ storeNumToShow = _this.settings.locationsPerPage; storeStart = page * _this.settings.locationsPerPage; + if( (storeStart + storeNumToShow) > locationset.length ) { + storeNumToShow = _this.settings.locationsPerPage - ((storeStart + storeNumToShow) - locationset.length); + } + locationset = locationset.slice(storeStart, storeStart + storeNumToShow); storeNum = locationset.length; } diff --git a/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js b/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js index 7898bf5..b9ceb15 100644 --- a/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js +++ b/dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js @@ -1,5 +1,5 @@ -/*! jQuery Google Maps Store Locator - v2.0.3 - 2014-12-11 +/*! jQuery Google Maps Store Locator - v2.0.4 - 2014-12-15 * http://www.bjornblog.com/web/jquery-store-locator-plugin * Copyright (c) 2014 Bjorn Holine; Licensed MIT */ -!function(a,b,c,d){"use strict";function e(b,c){g=a(b),this.element=b,this.settings=a.extend({},D,c),this._defaults=D,this._name=f,this.init()}var f="storeLocator";if("undefined"==typeof a.fn[f]){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=[],w=[],x=[],y=[],z={},A={},B={},C={},D={mapID:"bh-sl-map",locationList:"bh-sl-loc-list",formContainer:"bh-sl-form-container",formID:"bh-sl-user-location",addressID:"bh-sl-address",regionID:"bh-sl-region",mapSettings:{zoom:12,mapTypeId:google.maps.MapTypeId.ROADMAP},markerImg:null,markerDim:null,catMarkers:null,lengthUnit:"m",storeLimit:26,distanceAlert:60,dataType:"xml",dataLocation:"data/locations.xml",xmlElement:"marker",listColor1:"#ffffff",listColor2:"#eeeeee",originMarker:!1,originMarkerImg:null,originMarkerDim:null,bounceMarker:!0,slideMap:!0,modal:!1,overlay:"bh-sl-overlay",modalWindow:"bh-sl-modal-window",modalContent:"bh-sl-modal-content",closeIcon:"bh-sl-close-icon",defaultLoc:!1,defaultLat:null,defaultLng:null,autoGeocode:!1,maxDistance:!1,maxDistanceID:"bh-sl-maxdistance",fullMapStart:!1,noForm:!1,loading:!1,loadingContainer:"bh-sl-loading",featuredLocations:!1,pagination:!1,locationsPerPage:10,inlineDirections:!1,nameSearch:!1,searchID:"bh-sl-search",nameAttribute:"name",infowindowTemplatePath:"assets/js/plugins/storeLocator/templates/infowindow-description.html",listTemplatePath:"assets/js/plugins/storeLocator/templates/location-list-description.html",KMLinfowindowTemplatePath:"assets/js/plugins/storeLocator/templates/kml-infowindow-description.html",KMLlistTemplatePath:"assets/js/plugins/storeLocator/templates/kml-location-list-description.html",listTemplateID:null,infowindowTemplateID:null,taxonomyFilters:null,taxonomyFiltersContainer:"bh-sl-filters-container",querystringParams:!1,callbackNotify:null,callbackBeforeSend:null,callbackSuccess:null,callbackModalOpen:null,callbackModalReady:null,callbackModalClose:null,callbackJsonp:null,callbackPageChange:null,callbackDirectionsRequest:null,callbackCloseDirections:null,callbackNoResults:null,geocodeErrorAlert:"Geocode was not successful for the following reason: ",addressErrorAlert:"Unable to find address",autoGeocodeErrorAlert:"Automatic location detection failed. Please fill in your address or zip code.",distanceErrorAlert:"Unfortunately, our closest location is more than ",mileLang:"mile",milesLang:"miles",kilometerLang:"kilometer",kilometersLang:"kilometers",noResultsTitle:"No results",noResultsDesc:"No locations were found with the given criteria. Please modify your selections or input.",nextPage:"Next »",prevPage:"« Prev"};a.extend(e.prototype,{init:function(){B.EarthRadius="km"===this.settings.lengthUnit?6367:3956,j="kml"===this.settings.dataType?"xml":this.settings.dataType,this.settings.inlineDirections===!0&&(t=new google.maps.DirectionsRenderer,u=new google.maps.DirectionsService,a("."+this.settings.locationList).prepend('
')),m=this.settings.mapSettings.zoom,Handlebars.registerHelper("niceURL",function(a){return a?a.replace("https://","").replace("http://",""):void 0}),null!==this.settings.taxonomyFilters&&this.taxonomyFiltering(),this.settings.modal===!0&&(null!==this.settings.taxonomyFilters&&a("."+this.settings.taxonomyFiltersContainer).clone(!0,!0).prependTo(g),g.wrap('