Skip to content

Commit 2a40ab9

Browse files
committed
Update jquery.storelocator.js
Added the possibility to set the 'storeLimit' option to -1 that means unlimited. Added the possibility to set the 'distanceAlert' option to -1 that means disable distance alert. Added little checks to only format 'web' variable when it is not null otherwise javascript would gives an error.
1 parent dbfc12e commit 2a40ab9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

js/jquery.storelocator.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ $.fn.storeLocator = function(options) {
389389
var phone = this.phone;
390390
var email = this.email;
391391
var web = this.web;
392-
web = web.replace("http://","");
392+
if ( web ) web = web.replace("http://","");
393393
var hours1 = this.hours1;
394394
var hours2 = this.hours2;
395395
var hours3 = this.hours3;
@@ -455,7 +455,7 @@ $.fn.storeLocator = function(options) {
455455
var phone = $(this).attr('phone');
456456
var email = $(this).attr('email');
457457
var web = $(this).attr('web');
458-
web = web.replace("http://","");
458+
if ( web ) web = web.replace("http://","");
459459
var hours1 = $(this).attr('hours1');
460460
var hours2 = $(this).attr('hours2');
461461
var hours3 = $(this).attr('hours3');
@@ -521,7 +521,7 @@ $.fn.storeLocator = function(options) {
521521
}
522522
}
523523
else{
524-
if(locationset[0][0] > settings.distanceAlert){
524+
if(settings.distanceAlert != -1 && locationset[0][0] > settings.distanceAlert){
525525
alert(settings.distanceErrorAlert + settings.distanceAlert + " " + distUnit);
526526
}
527527
}
@@ -590,7 +590,7 @@ $.fn.storeLocator = function(options) {
590590
//Set up alpha character
591591
var markerId = currentMarker.get("id");
592592
//Use dot markers instead of alpha if there are more than 26 locations
593-
if(settings.storeLimit > 26){
593+
if(settings.storeLimit == -1 || settings.storeLimit > 26){
594594
var indicator = markerId + 1;
595595
}
596596
else{
@@ -703,7 +703,7 @@ $.fn.storeLocator = function(options) {
703703
var infowindow = new google.maps.InfoWindow();
704704

705705
//Avoid error if number of locations is less than the default of 26
706-
if((locationset.length-1) < settings.storeLimit-1){
706+
if(settings.storeLimit == -1 || (locationset.length-1) < settings.storeLimit-1){
707707
storenum = locationset.length-1;
708708
}
709709
else{
@@ -801,7 +801,7 @@ $.fn.storeLocator = function(options) {
801801
new google.maps.Point(12, 35));
802802

803803
//Create the markers
804-
if(settings.storeLimit > 26){
804+
if(settings.storeLimit == -1 || settings.storeLimit > 26){
805805
var marker = new google.maps.Marker({
806806
position: point,
807807
map: map,
@@ -865,4 +865,4 @@ $.fn.storeLocator = function(options) {
865865

866866
});
867867
};
868-
})(jQuery);
868+
})(jQuery);

0 commit comments

Comments
 (0)