Skip to content

Commit e982374

Browse files
committed
Fixed issue with new full map start location list limit where clicking on a marker that didn't have a list item displayed caused an error, reverted change to new list limit so that it's always applied with full map start enabled
1 parent 1def0de commit e982374

File tree

7 files changed

+42
-32
lines changed

7 files changed

+42
-32
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-storelocator-plugin",
3-
"version": "2.4.1",
3+
"version": "2.4.2",
44
"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.",
55
"repository": {
66
"type": "git",

dist/assets/js/plugins/storeLocator/jquery.storelocator.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jQuery Google Maps Store Locator - v2.4.1 - 2016-01-20
1+
/*! jQuery Google Maps Store Locator - v2.4.2 - 2016-01-20
22
* http://www.bjornblog.com/web/jquery-store-locator-plugin
33
* Copyright (c) 2016 Bjorn Holine; Licensed MIT */
44

@@ -1101,20 +1101,22 @@
11011101
// Focus on the list
11021102
var markerId = marker.get('id');
11031103
var $selectedLocation = $('.' + _this.settings.locationList + ' li[data-markerid=' + markerId + ']');
1104+
1105+
if ($selectedLocation.length > 0) {
1106+
// Marker click callback
1107+
if (_this.settings.callbackMarkerClick) {
1108+
_this.settings.callbackMarkerClick.call(this, marker, markerId, $selectedLocation);
1109+
}
11041110

1105-
// Marker click callback
1106-
if (_this.settings.callbackMarkerClick) {
1107-
_this.settings.callbackMarkerClick.call(this, marker, markerId, $selectedLocation);
1108-
}
1109-
1110-
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
1111-
$selectedLocation.addClass('list-focus');
1111+
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
1112+
$selectedLocation.addClass('list-focus');
11121113

1113-
// Scroll list to selected marker
1114-
var $container = $('.' + _this.settings.locationList);
1115-
$container.animate({
1116-
scrollTop: $selectedLocation.offset().top - $container.offset().top + $container.scrollTop()
1117-
});
1114+
// Scroll list to selected marker
1115+
var $container = $('.' + _this.settings.locationList);
1116+
$container.animate({
1117+
scrollTop: $selectedLocation.offset().top - $container.offset().top + $container.scrollTop()
1118+
});
1119+
}
11181120

11191121
// Custom selected marker override
11201122
if(_this.settings.selectedMarkerImg !== null) {
@@ -2120,7 +2122,7 @@
21202122
}
21212123
else {
21222124
// Set up the location list markup
2123-
if (_this.settings.fullMapStartListLimit !== false && ! isNaN(_this.settings.fullMapStartListLimit) && firstRun === true) {
2125+
if (_this.settings.fullMapStartListLimit !== false && ! isNaN(_this.settings.fullMapStartListLimit)) {
21242126
for (var m = 0; m < _this.settings.fullMapStartListLimit; m++) {
21252127
var currentMarker = markers[m];
21262128
_this.listSetup(currentMarker, storeStart, page);

dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-storelocator-plugin",
3-
"version": "2.4.1",
3+
"version": "2.4.2",
44
"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.",
55
"repository": {
66
"type": "git",

readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ filtering.
3535

3636
## Changelog
3737

38+
### Version 2.4.2
39+
40+
* Fixed issue with new full map start location list limit where clicking on a marker that didn't have a list item
41+
displayed caused an error.
42+
* Reverted change to new list limit so that it's always applied with full map start enabled.
43+
3844
### Version 2.4.1
3945

4046
* Changed new full map start list limit so that it's only applied on the initial load.

src/js/jquery.storelocator.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,20 +1098,22 @@
10981098
// Focus on the list
10991099
var markerId = marker.get('id');
11001100
var $selectedLocation = $('.' + _this.settings.locationList + ' li[data-markerid=' + markerId + ']');
1101+
1102+
if ($selectedLocation.length > 0) {
1103+
// Marker click callback
1104+
if (_this.settings.callbackMarkerClick) {
1105+
_this.settings.callbackMarkerClick.call(this, marker, markerId, $selectedLocation);
1106+
}
11011107

1102-
// Marker click callback
1103-
if (_this.settings.callbackMarkerClick) {
1104-
_this.settings.callbackMarkerClick.call(this, marker, markerId, $selectedLocation);
1105-
}
1106-
1107-
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
1108-
$selectedLocation.addClass('list-focus');
1108+
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
1109+
$selectedLocation.addClass('list-focus');
11091110

1110-
// Scroll list to selected marker
1111-
var $container = $('.' + _this.settings.locationList);
1112-
$container.animate({
1113-
scrollTop: $selectedLocation.offset().top - $container.offset().top + $container.scrollTop()
1114-
});
1111+
// Scroll list to selected marker
1112+
var $container = $('.' + _this.settings.locationList);
1113+
$container.animate({
1114+
scrollTop: $selectedLocation.offset().top - $container.offset().top + $container.scrollTop()
1115+
});
1116+
}
11151117

11161118
// Custom selected marker override
11171119
if(_this.settings.selectedMarkerImg !== null) {
@@ -2117,7 +2119,7 @@
21172119
}
21182120
else {
21192121
// Set up the location list markup
2120-
if (_this.settings.fullMapStartListLimit !== false && ! isNaN(_this.settings.fullMapStartListLimit) && firstRun === true) {
2122+
if (_this.settings.fullMapStartListLimit !== false && ! isNaN(_this.settings.fullMapStartListLimit)) {
21212123
for (var m = 0; m < _this.settings.fullMapStartListLimit; m++) {
21222124
var currentMarker = markers[m];
21232125
_this.listSetup(currentMarker, storeStart, page);

storelocator.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "jQuery Google Maps Store Locator",
44
"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.",
55
"keywords": ["jquery","locator","store", "location", "locations", "maps", "map", "stores", "find"],
6-
"version": "2.4.1",
6+
"version": "2.4.2",
77
"author": {
88
"name": "Bjorn Holine",
99
"url": "http://www.bjornblog.com/"

0 commit comments

Comments
 (0)