Skip to content

Commit 792e063

Browse files
committed
Added extra check to make sure mapping doesn't fire twice when defaultLoc is enabled and fullMapStart is also enabled
1 parent 1e64e92 commit 792e063

File tree

4 files changed

+20
-21
lines changed

4 files changed

+20
-21
lines changed

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jQuery Google Maps Store Locator - v3.1.6 - 2021-12-04
1+
/*! jQuery Google Maps Store Locator - v3.1.6 - 2021-12-05
22
* http://www.bjornblog.com/web/jquery-store-locator-plugin
33
* Copyright (c) 2021 Bjorn Holine; Licensed MIT */
44

@@ -675,7 +675,7 @@
675675
doAutoGeo = false; // No need for additional processing
676676
}
677677
// If show full map option is true
678-
else if (this.settings.fullMapStart === true) {
678+
else if (this.settings.fullMapStart === true && this.settings.defaultLoc === false) {
679679
if ((this.settings.querystringParams === true && this.getQueryString(this.settings.addressID)) || (this.settings.querystringParams === true && this.getQueryString(this.settings.searchID)) || (this.settings.querystringParams === true && this.getQueryString(this.settings.maxDistanceID))) {
680680
_this.writeDebug('Using Query String');
681681
this.processForm(null);
@@ -1864,20 +1864,18 @@
18641864
if (this.settings.maxDistance === true && typeof maxDistance !== 'undefined' && maxDistance !== null) {
18651865
if (data.distance <= maxDistance) {
18661866
locationset.push( data );
1867-
}
1868-
else {
1867+
} else {
1868+
this.writeDebug('locationsSetup', "location ignored because it is out of maxDistance: " + maxDistance, data);
18691869
return;
18701870
}
1871-
}
1872-
else if (this.settings.maxDistance === true && this.settings.querystringParams === true && typeof maxDistance !== 'undefined' && maxDistance !== null) {
1871+
} else if (this.settings.maxDistance === true && this.settings.querystringParams === true && typeof maxDistance !== 'undefined' && maxDistance !== null) {
18731872
if (data.distance <= maxDistance) {
18741873
locationset.push( data );
1875-
}
1876-
else {
1874+
} else {
1875+
this.writeDebug('locationsSetup', "location ignored because it is out of maxDistance: " + maxDistance, data);
18771876
return;
18781877
}
1879-
}
1880-
else {
1878+
} else {
18811879
locationset.push( data );
18821880
}
18831881
},

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.

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,17 @@ filtering.
3737

3838
### Version 3.1.6
3939

40+
* Added check to make sure mapping doesn't fire twice when defaultLoc is enabled and fullMapStart is also enabled (not intended to both be enabled at the same time).
4041
* Fixed centering issue on initial search with maxDistance enabled introduced with fitBounds updates in last update.
4142

4243
### Version 3.1.5
44+
4345
* Added Google Maps object as a parameter for [callbackMarkerClick](callbacks/callback-markerclick.md) callback.
4446
* Added a zoom listener after fitBounds is used to prevent high zoom levels after name search and taxonomy filtering.
4547
* Improved zooming when maxDistance setting is enabled taking advantage of the fitBounds method.
4648

4749
### Version 3.1.4
50+
4851
* Fixed name search filter value not clearing if form input is cleared.
4952

5053
### Version 3.1.3

src/js/jquery.storelocator.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@
671671
doAutoGeo = false; // No need for additional processing
672672
}
673673
// If show full map option is true
674-
else if (this.settings.fullMapStart === true) {
674+
else if (this.settings.fullMapStart === true && this.settings.defaultLoc === false) {
675675
if ((this.settings.querystringParams === true && this.getQueryString(this.settings.addressID)) || (this.settings.querystringParams === true && this.getQueryString(this.settings.searchID)) || (this.settings.querystringParams === true && this.getQueryString(this.settings.maxDistanceID))) {
676676
_this.writeDebug('Using Query String');
677677
this.processForm(null);
@@ -1860,20 +1860,18 @@
18601860
if (this.settings.maxDistance === true && typeof maxDistance !== 'undefined' && maxDistance !== null) {
18611861
if (data.distance <= maxDistance) {
18621862
locationset.push( data );
1863-
}
1864-
else {
1863+
} else {
1864+
this.writeDebug('locationsSetup', "location ignored because it is out of maxDistance: " + maxDistance, data);
18651865
return;
18661866
}
1867-
}
1868-
else if (this.settings.maxDistance === true && this.settings.querystringParams === true && typeof maxDistance !== 'undefined' && maxDistance !== null) {
1867+
} else if (this.settings.maxDistance === true && this.settings.querystringParams === true && typeof maxDistance !== 'undefined' && maxDistance !== null) {
18691868
if (data.distance <= maxDistance) {
18701869
locationset.push( data );
1871-
}
1872-
else {
1870+
} else {
1871+
this.writeDebug('locationsSetup', "location ignored because it is out of maxDistance: " + maxDistance, data);
18731872
return;
18741873
}
1875-
}
1876-
else {
1874+
} else {
18771875
locationset.push( data );
18781876
}
18791877
},

0 commit comments

Comments
 (0)