11/*
2- * storeLocator v1.4.3 - jQuery Google Maps Store Locator Plugin
2+ * storeLocator v1.4.4 - jQuery Google Maps Store Locator Plugin
33* (c) Copyright 2013, Bjorn Holine (http://www.bjornblog.com)
44* Released under the MIT license
55* 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) {
5252 'callbackSuccess' : null ,
5353 'callbackModalOpen' : null ,
5454 'callbackModalClose' : null ,
55+ 'jsonpCallback' : null ,
5556 //Language options
5657 'geocodeErrorAlert' : 'Geocode was not successful for the following reason: ' ,
5758 'blankInputAlert' : 'The input box was blank.' ,
@@ -61,8 +62,7 @@ $.fn.storeLocator = function(options) {
6162 'mileLang' : 'mile' ,
6263 'milesLang' : 'miles' ,
6364 'kilometerLang' : 'kilometer' ,
64- 'kilometersLang' : 'kilometers' ,
65- 'jsonpCallback' : null
65+ 'kilometersLang' : 'kilometers'
6666 } , options ) ;
6767
6868 return this . each ( function ( ) {
@@ -112,7 +112,15 @@ $.fn.storeLocator = function(options) {
112112
113113 var userinput , olat , olng , marker , letter , storenum ;
114114 var locationset = [ ] ;
115+ var markers = [ ] ;
115116 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+ }
116124
117125 //Add modal window divs if set
118126 if ( settings . modalWindow === true )
@@ -315,7 +323,6 @@ $.fn.storeLocator = function(options) {
315323 $ ( function ( ) {
316324
317325 var dataTypeRead ;
318- locationset = [ ] ;
319326
320327 //KML is read as XML
321328 if ( settings . dataType === 'kml' ) {
@@ -371,6 +378,10 @@ $.fn.storeLocator = function(options) {
371378 if ( settings . fullMapStart === true && $ ( '#' + settings . mapDiv ) . hasClass ( 'mapOpen' ) === false ) {
372379 firstRun = true ;
373380 }
381+ else {
382+ reset ( ) ;
383+ }
384+
374385 $ ( '#' + settings . mapDiv ) . addClass ( 'mapOpen' ) ;
375386
376387 //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) {
672683 } ;
673684 }
674685
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 ) ;
677687 //Create one infowindow to fill later
678688 var infowindow = new google . maps . InfoWindow ( ) ;
679689
0 commit comments