11/*
2- * storeLocator v1.4.7 - jQuery Google Maps Store Locator Plugin
2+ * storeLocator v1.4.8 - 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
@@ -162,7 +162,7 @@ $.fn.storeLocator = function(options) {
162162 geocoder = new google . maps . Geocoder ( ) ;
163163 this . geocode = function ( address , callbackFunction ) {
164164 geocoder . geocode ( { 'address' : address } , function ( results , status ) {
165- if ( status == google . maps . GeocoderStatus . OK ) {
165+ if ( status === google . maps . GeocoderStatus . OK ) {
166166 var result = { } ;
167167 result . latitude = results [ 0 ] . geometry . location . lat ( ) ;
168168 result . longitude = results [ 0 ] . geometry . location . lng ( ) ;
@@ -180,7 +180,7 @@ $.fn.storeLocator = function(options) {
180180 geocoder = new google . maps . Geocoder ( ) ;
181181 this . geocode = function ( latlng , callbackFunction ) {
182182 geocoder . geocode ( { 'latLng' : latlng } , function ( results , status ) {
183- if ( status == google . maps . GeocoderStatus . OK ) {
183+ if ( status === google . maps . GeocoderStatus . OK ) {
184184 if ( results [ 0 ] ) {
185185 var result = { } ;
186186 result . address = results [ 0 ] . formatted_address ;
@@ -377,25 +377,25 @@ $.fn.storeLocator = function(options) {
377377 if ( settings . dataType === 'json' || settings . dataType === 'jsonp' ) {
378378 //Process JSON
379379 $ . each ( data , function ( ) {
380- var key , value , locationData = { } ;
380+ var key , value , locationData = { } ;
381381
382- // Parse each data variables
383- for ( key in this ) {
384- value = this [ key ] ;
382+ // Parse each data variables
383+ for ( key in this ) {
384+ value = this [ key ] ;
385385
386- if ( key == 'locname' ) {
387- key = 'name' ; // Translate locname to name (todo: should NOT be done)
388- }
389- else if ( key == 'web' ) {
390- if ( value ) value = value . replace ( "http://" , "" ) ; // Remove scheme (todo: should NOT be done)
391- }
386+ if ( key === 'locname' ) {
387+ key = 'name' ; // Translate locname to name (todo: should NOT be done)
388+ }
389+ else if ( key === 'web' ) {
390+ if ( value ) value = value . replace ( "http://" , "" ) ; // Remove scheme (todo: should NOT be done)
391+ }
392392
393- locationData [ key ] = value ;
394- }
393+ locationData [ key ] = value ;
394+ }
395395
396- if ( ! locationData [ 'distance' ] ) {
397- locationData [ 'distance' ] = GeoCodeCalc . CalcDistance ( orig_lat , orig_lng , locationData [ 'lat' ] , locationData [ 'lng' ] , GeoCodeCalc . EarthRadius ) ;
398- }
396+ if ( ! locationData [ 'distance' ] ) {
397+ locationData [ 'distance' ] = GeoCodeCalc . CalcDistance ( orig_lat , orig_lng , locationData [ 'lat' ] , locationData [ 'lng' ] , GeoCodeCalc . EarthRadius ) ;
398+ }
399399
400400 //Create the array
401401 if ( settings . maxDistance === true && firstRun !== true ) {
@@ -416,14 +416,14 @@ $.fn.storeLocator = function(options) {
416416 else if ( settings . dataType === 'kml' ) {
417417 //Process KML
418418 $ ( data ) . find ( 'Placemark' ) . each ( function ( ) {
419- var locationData = {
420- 'name' : $ ( this ) . find ( 'name' ) . text ( ) ,
421- 'lat' : $ ( this ) . find ( 'coordinates' ) . text ( ) . split ( "," ) [ 1 ] ,
422- 'lng' : $ ( this ) . find ( 'coordinates' ) . text ( ) . split ( "," ) [ 0 ] ,
423- 'description' : $ ( this ) . find ( 'description' ) . text ( )
424- } ;
419+ var locationData = {
420+ 'name' : $ ( this ) . find ( 'name' ) . text ( ) ,
421+ 'lat' : $ ( this ) . find ( 'coordinates' ) . text ( ) . split ( "," ) [ 1 ] ,
422+ 'lng' : $ ( this ) . find ( 'coordinates' ) . text ( ) . split ( "," ) [ 0 ] ,
423+ 'description' : $ ( this ) . find ( 'description' ) . text ( )
424+ } ;
425425
426- locationData [ 'distance' ] = GeoCodeCalc . CalcDistance ( orig_lat , orig_lng , locationData [ 'lat' ] , locationData [ 'lng' ] , GeoCodeCalc . EarthRadius ) ;
426+ locationData [ 'distance' ] = GeoCodeCalc . CalcDistance ( orig_lat , orig_lng , locationData [ 'lat' ] , locationData [ 'lng' ] , GeoCodeCalc . EarthRadius ) ;
427427
428428 //Create the array
429429 if ( settings . maxDistance === true && firstRun !== true ) {
@@ -444,27 +444,27 @@ $.fn.storeLocator = function(options) {
444444 else {
445445 //Process XML
446446 $ ( data ) . find ( 'marker' ) . each ( function ( ) {
447- var locationData = {
448- 'name' : $ ( this ) . attr ( 'name' ) ,
449- 'lat' : $ ( this ) . attr ( 'lat' ) ,
450- 'lng' : $ ( this ) . attr ( 'lng' ) ,
451- 'address' : $ ( this ) . attr ( 'address' ) ,
452- 'address2' : $ ( this ) . attr ( 'address2' ) ,
453- 'city' : $ ( this ) . attr ( 'city' ) ,
454- 'state' : $ ( this ) . attr ( 'state' ) ,
455- 'postal' : $ ( this ) . attr ( 'postal' ) ,
456- 'country' : $ ( this ) . attr ( 'country' ) ,
457- 'phone' : $ ( this ) . attr ( 'phone' ) ,
458- 'email' : $ ( this ) . attr ( 'email' ) ,
459- 'web' : $ ( this ) . attr ( 'web' ) ,
460- 'hours1' : $ ( this ) . attr ( 'hours1' ) ,
461- 'hours2' : $ ( this ) . attr ( 'hours2' ) ,
462- 'hours3' : $ ( this ) . attr ( 'hours3' ) ,
463- 'category' : $ ( this ) . attr ( 'category' ) ,
464- 'featured' : $ ( this ) . attr ( 'featured' )
465- } ;
466-
467- if ( locationData [ 'web' ] ) locationData [ 'web' ] = locationData [ 'web' ] . replace ( "http://" , "" ) ; // Remove scheme (todo: should NOT be done)
447+ var locationData = {
448+ 'name' : $ ( this ) . attr ( 'name' ) ,
449+ 'lat' : $ ( this ) . attr ( 'lat' ) ,
450+ 'lng' : $ ( this ) . attr ( 'lng' ) ,
451+ 'address' : $ ( this ) . attr ( 'address' ) ,
452+ 'address2' : $ ( this ) . attr ( 'address2' ) ,
453+ 'city' : $ ( this ) . attr ( 'city' ) ,
454+ 'state' : $ ( this ) . attr ( 'state' ) ,
455+ 'postal' : $ ( this ) . attr ( 'postal' ) ,
456+ 'country' : $ ( this ) . attr ( 'country' ) ,
457+ 'phone' : $ ( this ) . attr ( 'phone' ) ,
458+ 'email' : $ ( this ) . attr ( 'email' ) ,
459+ 'web' : $ ( this ) . attr ( 'web' ) ,
460+ 'hours1' : $ ( this ) . attr ( 'hours1' ) ,
461+ 'hours2' : $ ( this ) . attr ( 'hours2' ) ,
462+ 'hours3' : $ ( this ) . attr ( 'hours3' ) ,
463+ 'category' : $ ( this ) . attr ( 'category' ) ,
464+ 'featured' : $ ( this ) . attr ( 'featured' )
465+ } ;
466+
467+ if ( locationData [ 'web' ] ) locationData [ 'web' ] = locationData [ 'web' ] . replace ( "http://" , "" ) ; // Remove scheme (todo: should NOT be done)
468468
469469 locationData [ 'distance' ] = GeoCodeCalc . CalcDistance ( orig_lat , orig_lng , locationData [ 'lat' ] , locationData [ 'lng' ] , GeoCodeCalc . EarthRadius ) ;
470470
@@ -523,27 +523,27 @@ $.fn.storeLocator = function(options) {
523523 }
524524 }
525525 else {
526- if ( settings . distanceAlert != - 1 && locationset [ 0 ] [ 'distance' ] > settings . distanceAlert ) {
526+ if ( settings . distanceAlert !== - 1 && locationset [ 0 ] [ 'distance' ] > settings . distanceAlert ) {
527527 alert ( settings . distanceErrorAlert + settings . distanceAlert + " " + distUnit ) ;
528528 }
529529 }
530530
531531 //Create the map with jQuery
532532 $ ( function ( ) {
533533
534- var key , value , locationData = { } ;
534+ var key , value , locationData = { } ;
535535
536536 //Instead of repeating the same thing twice below
537537 function create_location_variables ( loopcount ) {
538- for ( key in locationset [ loopcount ] ) {
539- value = locationset [ loopcount ] [ key ] ;
538+ for ( key in locationset [ loopcount ] ) {
539+ value = locationset [ loopcount ] [ key ] ;
540540
541- if ( key == 'distance' ) {
542- value = roundNumber ( value , 2 ) ;
543- }
541+ if ( key === 'distance' ) {
542+ value = roundNumber ( value , 2 ) ;
543+ }
544544
545- locationData [ key ] = value ;
546- }
545+ locationData [ key ] = value ;
546+ }
547547 }
548548
549549 //Define the location data for the templates
@@ -571,7 +571,7 @@ $.fn.storeLocator = function(options) {
571571 //Set up alpha character
572572 var markerId = currentMarker . get ( "id" ) ;
573573 //Use dot markers instead of alpha if there are more than 26 locations
574- if ( settings . storeLimit == - 1 || settings . storeLimit > 26 ) {
574+ if ( settings . storeLimit === - 1 || settings . storeLimit > 26 ) {
575575 var indicator = markerId + 1 ;
576576 }
577577 else {
@@ -580,13 +580,13 @@ $.fn.storeLocator = function(options) {
580580
581581 //Define location data
582582 var locations = {
583- location : [ $ . extend ( locationData , {
584- 'markerid' : markerId ,
585- 'marker' : indicator ,
586- 'length' : distLength ,
587- 'origin' : origin
588- } ) ]
589- } ;
583+ location : [ $ . extend ( locationData , {
584+ 'markerid' : markerId ,
585+ 'marker' : indicator ,
586+ 'length' : distLength ,
587+ 'origin' : origin
588+ } ) ]
589+ } ;
590590
591591 return locations ;
592592 }
@@ -651,7 +651,7 @@ $.fn.storeLocator = function(options) {
651651 var infowindow = new google . maps . InfoWindow ( ) ;
652652
653653 //Avoid error if number of locations is less than the default of 26
654- if ( settings . storeLimit == - 1 || ( locationset . length - 1 ) < settings . storeLimit - 1 ) {
654+ if ( settings . storeLimit === - 1 || ( locationset . length - 1 ) < settings . storeLimit - 1 ) {
655655 storenum = locationset . length - 1 ;
656656 }
657657 else {
@@ -749,7 +749,7 @@ $.fn.storeLocator = function(options) {
749749 new google . maps . Point ( 12 , 35 ) ) ;
750750
751751 //Create the markers
752- if ( settings . storeLimit == - 1 || settings . storeLimit > 26 ) {
752+ if ( settings . storeLimit === - 1 || settings . storeLimit > 26 ) {
753753 var marker = new google . maps . Marker ( {
754754 position : point ,
755755 map : map ,
@@ -813,4 +813,4 @@ $.fn.storeLocator = function(options) {
813813
814814 } ) ;
815815} ;
816- } ) ( jQuery ) ;
816+ } ) ( jQuery ) ;
0 commit comments