Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn2404 committed Dec 12, 2014
2 parents af43912 + 0362245 commit 70857e0
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 21 deletions.
16 changes: 8 additions & 8 deletions dist/assets/js/plugins/storeLocator/jquery.storelocator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! jQuery Google Maps Store Locator - v2.0.2 - 2014-12-07
/*! jQuery Google Maps Store Locator - v2.0.3 - 2014-12-11
* http://www.bjornblog.com/web/jquery-store-locator-plugin
* Copyright (c) 2014 Bjorn Holine; Licensed MIT */

Expand Down Expand Up @@ -1158,7 +1158,7 @@
* @param origin {string} origin address
* @param maxDistance {number} maximum distance if set
*/
locationsSetup: function (data, l, lat, lng, firstRun, origin, maxDistance) {
locationsSetup: function (data, lat, lng, firstRun, origin, maxDistance) {
if (typeof origin !== 'undefined') {
if (!data.distance) {
data.distance = this.geoCodeCalcCalcDistance(lat, lng, data.lat, data.lng, GeoCodeCalc.EarthRadius);
Expand All @@ -1168,14 +1168,14 @@
// Create the array
if (this.settings.maxDistance === true && firstRun !== true && maxDistance !== null) {
if (data.distance < maxDistance) {
locationset[l] = data;
locationset.push( data );
}
else {
return;
}
}
else {
locationset[l] = data;
locationset.push( data );
}
},

Expand Down Expand Up @@ -1489,7 +1489,7 @@
}
}

_this.locationsSetup(locationData, i, orig_lat, orig_lng, firstRun, origin, maxDistance);
_this.locationsSetup(locationData, orig_lat, orig_lng, firstRun, origin, maxDistance);

i++;
}
Expand All @@ -1504,7 +1504,7 @@
'description': $(this).find('description').text()
};

_this.locationsSetup(locationData, i, orig_lat, orig_lng, firstRun, origin, maxDistance);
_this.locationsSetup(locationData, orig_lat, orig_lng, firstRun, origin, maxDistance);

i++;
});
Expand All @@ -1520,7 +1520,7 @@
}
}

_this.locationsSetup(locationData, i, orig_lat, orig_lng, firstRun, origin, maxDistance);
_this.locationsSetup(locationData, orig_lat, orig_lng, firstRun, origin, maxDistance);

i++;
});
Expand Down Expand Up @@ -1651,7 +1651,7 @@
}

// Avoid error if number of locations is less than the default of 26
if (_this.settings.storeLimit === -1 || (locationset.length ) < _this.settings.storeLimit) {
if (_this.settings.storeLimit === -1 || locationset.length < _this.settings.storeLimit) {
storeNum = locationset.length;
}
else {
Expand Down

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions dist/maxdistance-example.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ <h1>Using Chipotle as an Example</h1>
</div>
</div>

<div id="distances"></div>

<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="assets/js/libs/handlebars.min.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery-storelocator-plugin",
"version": "2.0.2",
"version": "2.0.3",
"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",
Expand Down
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ for even faster loading.

## Changelog

### Version 2.0.3

* Fixed bug with maxDistance setting - updated locationsSetup method so that the locationset array uses array.push
instead of incrementing via a passed in parameter, which was causing undefined array elements and causing errors.
* Removed testing line from maxdistance-example.html that was left in.

### Version 2.0.2

* Updated the Handlebars.compile calls when using the inline template options to include the ID hash so that it's
Expand Down
14 changes: 7 additions & 7 deletions src/js/jquery.storelocator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@
* @param origin {string} origin address
* @param maxDistance {number} maximum distance if set
*/
locationsSetup: function (data, l, lat, lng, firstRun, origin, maxDistance) {
locationsSetup: function (data, lat, lng, firstRun, origin, maxDistance) {
if (typeof origin !== 'undefined') {
if (!data.distance) {
data.distance = this.geoCodeCalcCalcDistance(lat, lng, data.lat, data.lng, GeoCodeCalc.EarthRadius);
Expand All @@ -1166,14 +1166,14 @@
// Create the array
if (this.settings.maxDistance === true && firstRun !== true && maxDistance !== null) {
if (data.distance < maxDistance) {
locationset[l] = data;
locationset.push( data );
}
else {
return;
}
}
else {
locationset[l] = data;
locationset.push( data );
}
},

Expand Down Expand Up @@ -1487,7 +1487,7 @@
}
}

_this.locationsSetup(locationData, i, orig_lat, orig_lng, firstRun, origin, maxDistance);
_this.locationsSetup(locationData, orig_lat, orig_lng, firstRun, origin, maxDistance);

i++;
}
Expand All @@ -1502,7 +1502,7 @@
'description': $(this).find('description').text()
};

_this.locationsSetup(locationData, i, orig_lat, orig_lng, firstRun, origin, maxDistance);
_this.locationsSetup(locationData, orig_lat, orig_lng, firstRun, origin, maxDistance);

i++;
});
Expand All @@ -1518,7 +1518,7 @@
}
}

_this.locationsSetup(locationData, i, orig_lat, orig_lng, firstRun, origin, maxDistance);
_this.locationsSetup(locationData, orig_lat, orig_lng, firstRun, origin, maxDistance);

i++;
});
Expand Down Expand Up @@ -1649,7 +1649,7 @@
}

// Avoid error if number of locations is less than the default of 26
if (_this.settings.storeLimit === -1 || (locationset.length ) < _this.settings.storeLimit) {
if (_this.settings.storeLimit === -1 || locationset.length < _this.settings.storeLimit) {
storeNum = locationset.length;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion storelocator.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "jQuery Google Maps Store Locator",
"description": "This jQuery plugin takes advantage of Google Maps API version 3 to create an easy to implement store locator. No back-end programming is required, you just need to feed it KML, XML, or JSON data with all the location information.",
"keywords": ["jquery","locator","store", "location", "locations", "maps", "map", "stores", "find"],
"version": "2.0.2",
"version": "2.0.3",
"author": {
"name": "Bjorn Holine",
"url": "http://www.bjornblog.com/"
Expand Down

0 comments on commit 70857e0

Please sign in to comment.