Skip to content

Commit 3b5bd77

Browse files
committed
Fixed bug with inline directions panel that occurred after multiple address submissions
1 parent e784bce commit 3b5bd77

File tree

7 files changed

+58
-22
lines changed

7 files changed

+58
-22
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.0.9",
3+
"version": "2.0.10",
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: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jQuery Google Maps Store Locator - v2.0.9 - 2015-09-19
1+
/*! jQuery Google Maps Store Locator - v2.0.9 - 2015-09-20
22
* http://www.bjornblog.com/web/jquery-store-locator-plugin
33
* Copyright (c) 2015 Bjorn Holine; Licensed MIT */
44

@@ -79,7 +79,7 @@
7979
'taxonomyFiltersContainer' : 'bh-sl-filters-container',
8080
'exclusiveFiltering' : false,
8181
'querystringParams' : false,
82-
'debug' : true,
82+
'debug' : false,
8383
'sessionStorage' : false,
8484
'callbackNotify' : null,
8585
'callbackBeforeSend' : null,
@@ -145,10 +145,8 @@
145145
dataTypeRead = this.settings.dataType;
146146
}
147147

148-
// Set up the directionsService if it's true
148+
// Add directions panel if enabled
149149
if(this.settings.inlineDirections === true) {
150-
directionsDisplay = new google.maps.DirectionsRenderer();
151-
directionsService = new google.maps.DirectionsService();
152150
$('.' + this.settings.locationList).prepend('<div class="bh-sl-directions-panel"></div>');
153151
}
154152

@@ -238,6 +236,15 @@
238236
if( $('.' + this.settings.locationList + ' .bh-sl-close-directions-container').length ) {
239237
$('.bh-sl-close-directions-container').remove();
240238
}
239+
if(this.settings.inlineDirections === true) {
240+
// Remove directions panel if it's there
241+
var $adp = $('.' + this.settings.locationList + ' .adp');
242+
if ( $adp.length > 0 ) {
243+
$adp.remove();
244+
$('.' + this.settings.locationList + ' ul').fadeIn();
245+
}
246+
$(document).off('click', '.' + this.settings.locationList + ' li .loc-directions a');
247+
}
241248
},
242249

243250
/**
@@ -1150,7 +1157,16 @@
11501157
$('.' + this.settings.locationList + ' ul').hide();
11511158
// Remove the markers
11521159
this.clearMarkers();
1160+
1161+
// Clear the previous directions request
1162+
if(directionsDisplay !== null && typeof directionsDisplay !== 'undefined') {
1163+
directionsDisplay.setMap(null);
1164+
directionsDisplay = null;
1165+
}
11531166

1167+
directionsDisplay = new google.maps.DirectionsRenderer();
1168+
directionsService = new google.maps.DirectionsService();
1169+
11541170
// Directions request
11551171
directionsDisplay.setMap(map);
11561172
directionsDisplay.setPanel($('.bh-sl-directions-panel').get(0));
@@ -1184,11 +1200,8 @@
11841200
}
11851201

11861202
// Remove the close icon, remove the directions, add the list back
1187-
$('.' + this.settings.locationList + ' .adp').remove();
1188-
$('.' + this.settings.locationList + ' ul').fadeIn();
1189-
11901203
this.reset();
1191-
1204+
11921205
if ((olat) && (olng)) {
11931206
if (this.countFilters() === 0) {
11941207
this.settings.mapSettings.zoom = originalZoom;

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.0.9",
3+
"version": "2.0.10",
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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ for even faster loading.
2727

2828
## Changelog
2929

30+
### Version 2.0.10
31+
32+
Includes contributions from from [Giancarlo Gomez](https://github.com/GiancarloGomez).
33+
34+
* Added ability to pass in array object as dataRaw.
35+
* Added writeDebug console.log helper function for debugging.
36+
* Added sessionStorage option to store user's location when autoGeocode in enabled to prevent multiple lookups per session.
37+
* Fixed bug with inline directions panel that occurred after multiple address submissions.
38+
* Updated processForm method form field variables with empty string fallback values.
39+
3040
### Version 2.0.9
3141

3242
* Fixed issue when using catMarkers setting and not setting a location's category resulted in an error.

src/js/jquery.storelocator.js

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
'taxonomyFiltersContainer' : 'bh-sl-filters-container',
7777
'exclusiveFiltering' : false,
7878
'querystringParams' : false,
79-
'debug' : true,
79+
'debug' : false,
8080
'sessionStorage' : false,
8181
'callbackNotify' : null,
8282
'callbackBeforeSend' : null,
@@ -142,10 +142,8 @@
142142
dataTypeRead = this.settings.dataType;
143143
}
144144

145-
// Set up the directionsService if it's true
145+
// Add directions panel if enabled
146146
if(this.settings.inlineDirections === true) {
147-
directionsDisplay = new google.maps.DirectionsRenderer();
148-
directionsService = new google.maps.DirectionsService();
149147
$('.' + this.settings.locationList).prepend('<div class="bh-sl-directions-panel"></div>');
150148
}
151149

@@ -235,6 +233,15 @@
235233
if( $('.' + this.settings.locationList + ' .bh-sl-close-directions-container').length ) {
236234
$('.bh-sl-close-directions-container').remove();
237235
}
236+
if(this.settings.inlineDirections === true) {
237+
// Remove directions panel if it's there
238+
var $adp = $('.' + this.settings.locationList + ' .adp');
239+
if ( $adp.length > 0 ) {
240+
$adp.remove();
241+
$('.' + this.settings.locationList + ' ul').fadeIn();
242+
}
243+
$(document).off('click', '.' + this.settings.locationList + ' li .loc-directions a');
244+
}
238245
},
239246

240247
/**
@@ -1147,7 +1154,16 @@
11471154
$('.' + this.settings.locationList + ' ul').hide();
11481155
// Remove the markers
11491156
this.clearMarkers();
1157+
1158+
// Clear the previous directions request
1159+
if(directionsDisplay !== null && typeof directionsDisplay !== 'undefined') {
1160+
directionsDisplay.setMap(null);
1161+
directionsDisplay = null;
1162+
}
11501163

1164+
directionsDisplay = new google.maps.DirectionsRenderer();
1165+
directionsService = new google.maps.DirectionsService();
1166+
11511167
// Directions request
11521168
directionsDisplay.setMap(map);
11531169
directionsDisplay.setPanel($('.bh-sl-directions-panel').get(0));
@@ -1181,11 +1197,8 @@
11811197
}
11821198

11831199
// Remove the close icon, remove the directions, add the list back
1184-
$('.' + this.settings.locationList + ' .adp').remove();
1185-
$('.' + this.settings.locationList + ' ul').fadeIn();
1186-
11871200
this.reset();
1188-
1201+
11891202
if ((olat) && (olng)) {
11901203
if (this.countFilters() === 0) {
11911204
this.settings.mapSettings.zoom = originalZoom;

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.0.9",
6+
"version": "2.0.10",
77
"author": {
88
"name": "Bjorn Holine",
99
"url": "http://www.bjornblog.com/"

0 commit comments

Comments
 (0)