1
1
/*
2
- * storeLocator v1.4.3 - jQuery Google Maps Store Locator Plugin
2
+ * storeLocator v1.4.4 - jQuery Google Maps Store Locator Plugin
3
3
* (c) Copyright 2013, Bjorn Holine (http://www.bjornblog.com)
4
4
* Released under the MIT license
5
5
* Distance calculation function by Chris Pietschmann: http://pietschsoft.com/post/2008/02/01/Calculate-Distance-Between-Geocodes-in-C-and-JavaScript.aspx
@@ -52,6 +52,7 @@ $.fn.storeLocator = function(options) {
52
52
'callbackSuccess' : null ,
53
53
'callbackModalOpen' : null ,
54
54
'callbackModalClose' : null ,
55
+ 'jsonpCallback' : null ,
55
56
//Language options
56
57
'geocodeErrorAlert' : 'Geocode was not successful for the following reason: ' ,
57
58
'blankInputAlert' : 'The input box was blank.' ,
@@ -61,8 +62,7 @@ $.fn.storeLocator = function(options) {
61
62
'mileLang' : 'mile' ,
62
63
'milesLang' : 'miles' ,
63
64
'kilometerLang' : 'kilometer' ,
64
- 'kilometersLang' : 'kilometers' ,
65
- 'jsonpCallback' : null
65
+ 'kilometersLang' : 'kilometers'
66
66
} , options ) ;
67
67
68
68
return this . each ( function ( ) {
@@ -112,7 +112,15 @@ $.fn.storeLocator = function(options) {
112
112
113
113
var userinput , olat , olng , marker , letter , storenum ;
114
114
var locationset = [ ] ;
115
+ var markers = [ ] ;
115
116
var prefix = 'storeLocator' ;
117
+
118
+ //Resets for multiple re-submissions
119
+ function reset ( ) {
120
+ locationset = [ ] ;
121
+ markers = [ ] ;
122
+ $ ( document ) . off ( 'click.' + prefix , '#' + settings . listDiv + ' li' ) ;
123
+ }
116
124
117
125
//Add modal window divs if set
118
126
if ( settings . modalWindow === true )
@@ -315,7 +323,6 @@ $.fn.storeLocator = function(options) {
315
323
$ ( function ( ) {
316
324
317
325
var dataTypeRead ;
318
- locationset = [ ] ;
319
326
320
327
//KML is read as XML
321
328
if ( settings . dataType === 'kml' ) {
@@ -371,6 +378,10 @@ $.fn.storeLocator = function(options) {
371
378
if ( settings . fullMapStart === true && $ ( '#' + settings . mapDiv ) . hasClass ( 'mapOpen' ) === false ) {
372
379
firstRun = true ;
373
380
}
381
+ else {
382
+ reset ( ) ;
383
+ }
384
+
374
385
$ ( '#' + settings . mapDiv ) . addClass ( 'mapOpen' ) ;
375
386
376
387
//Depending on your data structure and what you want to include in the maps, you may need to change the following variables or comment them out
@@ -672,8 +683,7 @@ $.fn.storeLocator = function(options) {
672
683
} ;
673
684
}
674
685
675
- var map = new google . maps . Map ( document . getElementById ( settings . mapDiv ) , myOptions ) ;
676
- var markers = [ ] ;
686
+ var map = new google . maps . Map ( document . getElementById ( settings . mapDiv ) , myOptions ) ;
677
687
//Create one infowindow to fill later
678
688
var infowindow = new google . maps . InfoWindow ( ) ;
679
689
0 commit comments