Skip to content

Commit 55751f0

Browse files
committed
Fixed openNearest setting not working in combination with querystringParams setting
1 parent cfa62af commit 55751f0

File tree

5 files changed

+26
-12
lines changed

5 files changed

+26
-12
lines changed

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

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

55
;(function ($, window, document, undefined) {
66
'use strict';
@@ -2454,7 +2454,12 @@
24542454
openNearestLocation: function(nearestLoc, infowindow, storeStart, page) {
24552455
this.writeDebug('openNearestLocation',arguments);
24562456

2457-
if (this.settings.openNearest !== true || typeof nearestLoc === 'undefined' || (this.settings.fullMapStart === true && firstRun === true) || (this.settings.defaultLoc === true && firstRun === true)) {
2457+
if (
2458+
this.settings.openNearest !== true ||
2459+
typeof nearestLoc === 'undefined' ||
2460+
(this.settings.fullMapStart === true && firstRun === true && this.settings.querystringParams === false) ||
2461+
(this.settings.defaultLoc === true && firstRun === true && this.settings.querystringParams === false)
2462+
) {
24582463
return;
24592464
}
24602465

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.

dist/query-string-example/submit.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ <h1 class="bh-sl-title">Using Chipotle as an Example</h1>
4141
<script>
4242
$(function() {
4343
$('#bh-sl-map-container').storeLocator({
44-
'querystringParams' : true,
45-
'fullMapStart': true,
44+
querystringParams : true,
45+
fullMapStart: true,
4646
// The following paths are set because this example is in a subdirectory
47-
'dataLocation': '../data/locations.json',
48-
'infowindowTemplatePath': '../assets/js/plugins/storeLocator/templates/infowindow-description.html',
49-
'listTemplatePath': '../assets/js/plugins/storeLocator/templates/location-list-description.html'
47+
dataLocation: '../data/locations.json',
48+
infowindowTemplatePath: '../assets/js/plugins/storeLocator/templates/infowindow-description.html',
49+
listTemplatePath: '../assets/js/plugins/storeLocator/templates/location-list-description.html'
5050
});
5151
});
5252
</script>

readme.md

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

3636
## Changelog
3737

38+
### Version 3.1.7
39+
40+
* Fixed openNearest setting not working in combination with querystringParams setting.
41+
3842
### Version 3.1.6
3943

4044
* Added extra check to make sure mapping doesn't fire twice when defaultLoc is enabled and fullMapStart is also enabled.

src/js/jquery.storelocator.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2450,7 +2450,12 @@
24502450
openNearestLocation: function(nearestLoc, infowindow, storeStart, page) {
24512451
this.writeDebug('openNearestLocation',arguments);
24522452

2453-
if (this.settings.openNearest !== true || typeof nearestLoc === 'undefined' || (this.settings.fullMapStart === true && firstRun === true) || (this.settings.defaultLoc === true && firstRun === true)) {
2453+
if (
2454+
this.settings.openNearest !== true ||
2455+
typeof nearestLoc === 'undefined' ||
2456+
(this.settings.fullMapStart === true && firstRun === true && this.settings.querystringParams === false) ||
2457+
(this.settings.defaultLoc === true && firstRun === true && this.settings.querystringParams === false)
2458+
) {
24542459
return;
24552460
}
24562461

0 commit comments

Comments
 (0)