Skip to content

Commit 2d7a4f3

Browse files
committed
* Fixed location set length scenario when fullMapStart is enabled and taxFilters is reset and name search and origin are empty.
* Show empty result message if no locations with default sorting. * Updated deprecated google.maps.event.addDomListener usage with window.addEventListener. * Update version to v3.1.9
1 parent dc0ec0d commit 2d7a4f3

File tree

7 files changed

+44
-12
lines changed

7 files changed

+44
-12
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": "3.1.8",
3+
"version": "3.1.9",
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: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/*! jQuery Google Maps Store Locator - v3.1.8 - 2022-08-21
1+
/*! jQuery Google Maps Store Locator - v3.1.9 - 2023-02-02
22
* http://www.bjornblog.com/web/jquery-store-locator-plugin
3-
* Copyright (c) 2022 Bjorn Holine; Licensed MIT */
3+
* Copyright (c) 2023 Bjorn Holine; Licensed MIT */
44

55
;(function ($, window, document, undefined) {
66
'use strict';
@@ -680,7 +680,7 @@
680680
_this.map = new google.maps.Map(document.getElementById(_this.settings.mapID), myOptions);
681681

682682
// Re-center the map when the browser is re-sized
683-
google.maps.event.addDomListener(window, 'resize', function() {
683+
window.addEventListener('resize', function() {
684684
var center = _this.map.getCenter();
685685
google.maps.event.trigger(_this.map, 'resize');
686686
_this.map.setCenter(center);
@@ -2496,6 +2496,7 @@
24962496
if (
24972497
this.settings.openNearest !== true ||
24982498
typeof nearestLoc === 'undefined' ||
2499+
typeof originalOrigin === 'undefined' ||
24992500
(this.settings.fullMapStart === true && firstRun === true && this.settings.querystringParams === false) ||
25002501
(this.settings.defaultLoc === true && firstRun === true && this.settings.querystringParams === false)
25012502
) {
@@ -2951,7 +2952,9 @@
29512952
}
29522953
}
29532954
else {
2955+
_this.emptyResult();
29542956
throw new Error('No locations found. Please check the dataLocation setting and path.');
2957+
return;
29552958
}
29562959
}
29572960
}
@@ -3020,6 +3023,16 @@
30203023
storeNum = _this.settings.storeLimit;
30213024
}
30223025

3026+
// If fullMapStart is enabled and taxFilters is reset and name search and origin are empty, swap back to the original length.
3027+
if (
3028+
_this.settings.fullMapStart === true &&
3029+
_this.isEmptyObject(taxFilters) &&
3030+
(searchInput === '' || typeof searchInput === 'undefined') &&
3031+
(addressInput === '' || typeof addressInput === 'undefined')
3032+
) {
3033+
storeNum = locationset.length;
3034+
}
3035+
30233036
// If pagination is on, change the store limit to the setting and slice the locationset array
30243037
if (_this.settings.pagination === true) {
30253038
storeNumToShow = _this.settings.locationsPerPage;
@@ -3073,7 +3086,7 @@
30733086
_this.map = new google.maps.Map(document.getElementById(_this.settings.mapID), myOptions);
30743087

30753088
// Re-center the map when the browser is re-sized
3076-
google.maps.event.addDomListener(window, 'resize', function() {
3089+
window.addEventListener('resize', function() {
30773090
var center = _this.map.getCenter();
30783091
google.maps.event.trigger(_this.map, 'resize');
30793092
_this.map.setCenter(center);

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

Lines changed: 3 additions & 3 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": "3.1.8",
3+
"version": "3.1.9",
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 3.1.9
39+
40+
* Fixed location set length scenario when fullMapStart is enabled and taxFilters is reset and name search and origin are empty.
41+
* Show empty result message if no locations with default sorting.
42+
* Updated deprecated google.maps.event.addDomListener usage with window.addEventListener.
43+
3844
### Version 3.1.8
3945

4046
* Added coordinate range check to exclude locations with invalid latitude and longitude values.

src/js/jquery.storelocator.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@
676676
_this.map = new google.maps.Map(document.getElementById(_this.settings.mapID), myOptions);
677677

678678
// Re-center the map when the browser is re-sized
679-
google.maps.event.addDomListener(window, 'resize', function() {
679+
window.addEventListener('resize', function() {
680680
var center = _this.map.getCenter();
681681
google.maps.event.trigger(_this.map, 'resize');
682682
_this.map.setCenter(center);
@@ -2492,6 +2492,7 @@
24922492
if (
24932493
this.settings.openNearest !== true ||
24942494
typeof nearestLoc === 'undefined' ||
2495+
typeof originalOrigin === 'undefined' ||
24952496
(this.settings.fullMapStart === true && firstRun === true && this.settings.querystringParams === false) ||
24962497
(this.settings.defaultLoc === true && firstRun === true && this.settings.querystringParams === false)
24972498
) {
@@ -2947,7 +2948,9 @@
29472948
}
29482949
}
29492950
else {
2951+
_this.emptyResult();
29502952
throw new Error('No locations found. Please check the dataLocation setting and path.');
2953+
return;
29512954
}
29522955
}
29532956
}
@@ -3016,6 +3019,16 @@
30163019
storeNum = _this.settings.storeLimit;
30173020
}
30183021

3022+
// If fullMapStart is enabled and taxFilters is reset and name search and origin are empty, swap back to the original length.
3023+
if (
3024+
_this.settings.fullMapStart === true &&
3025+
_this.isEmptyObject(taxFilters) &&
3026+
(searchInput === '' || typeof searchInput === 'undefined') &&
3027+
(addressInput === '' || typeof addressInput === 'undefined')
3028+
) {
3029+
storeNum = locationset.length;
3030+
}
3031+
30193032
// If pagination is on, change the store limit to the setting and slice the locationset array
30203033
if (_this.settings.pagination === true) {
30213034
storeNumToShow = _this.settings.locationsPerPage;
@@ -3069,7 +3082,7 @@
30693082
_this.map = new google.maps.Map(document.getElementById(_this.settings.mapID), myOptions);
30703083

30713084
// Re-center the map when the browser is re-sized
3072-
google.maps.event.addDomListener(window, 'resize', function() {
3085+
window.addEventListener('resize', function() {
30733086
var center = _this.map.getCenter();
30743087
google.maps.event.trigger(_this.map, 'resize');
30753088
_this.map.setCenter(center);

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","dealer","location", "locations", "maps", "map", "stores", "find"],
6-
"version": "3.1.8",
6+
"version": "3.1.9",
77
"author": {
88
"name": "Bjorn Holine",
99
"url": "https://www.bjornblog.com/"

0 commit comments

Comments
 (0)