Skip to content

Commit fb203e6

Browse files
committed
Added no results check to location list click handling
1 parent 1ae539b commit fb203e6

File tree

4 files changed

+72
-67
lines changed

4 files changed

+72
-67
lines changed

dist/assets/js/libs/handlebars.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/js/plugins/storeLocator/jquery.storelocator.js

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jQuery Google Maps Store Locator - v2.4.2 - 2016-02-21
1+
/*! jQuery Google Maps Store Locator - v2.4.2 - 2016-02-28
22
* http://www.bjornblog.com/web/jquery-store-locator-plugin
33
* Copyright (c) 2016 Bjorn Holine; Licensed MIT */
44

@@ -541,7 +541,7 @@
541541
}
542542

543543
// If there is already have a value in the address bar
544-
if ( $('#' + this.settings.addressID).val().trim() !== ''){
544+
if ($.trim($('#' + this.settings.addressID).val()) !== ''){
545545
_this.writeDebug('Using Address Field');
546546
_this.processForm(null);
547547
doAutoGeo = false; // No need for additional processing
@@ -2138,38 +2138,40 @@
21382138
}
21392139

21402140
// Handle clicks from the list
2141-
$(document).on('click.'+pluginName, '.' + _this.settings.locationList + ' li', function () {
2142-
var markerId = $(this).data('markerid');
2143-
var selectedMarker = markers[markerId];
2144-
2145-
// List click callback
2146-
if (_this.settings.callbackListClick) {
2147-
_this.settings.callbackListClick.call(this, markerId, selectedMarker);
2148-
}
2149-
2150-
// Focus on the list
2151-
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
2152-
$('.' + _this.settings.locationList + ' li[data-markerid=' + markerId + ']').addClass('list-focus');
2141+
if (typeof noResults === 'undefined') {
2142+
$(document).on('click.' + pluginName, '.' + _this.settings.locationList + ' li', function () {
2143+
var markerId = $(this).data('markerid');
2144+
var selectedMarker = markers[markerId];
2145+
2146+
// List click callback
2147+
if (_this.settings.callbackListClick) {
2148+
_this.settings.callbackListClick.call(this, markerId, selectedMarker);
2149+
}
21532150

2154-
map.panTo(selectedMarker.getPosition());
2155-
var listLoc = 'left';
2156-
if (_this.settings.bounceMarker === true) {
2157-
selectedMarker.setAnimation(google.maps.Animation.BOUNCE);
2158-
setTimeout(function () {
2159-
selectedMarker.setAnimation(null);
2160-
_this.createInfowindow(selectedMarker, listLoc, infowindow, storeStart, page);
2161-
}, 700
2162-
);
2163-
}
2164-
else {
2165-
_this.createInfowindow(selectedMarker, listLoc, infowindow, storeStart, page);
2166-
}
2151+
// Focus on the list
2152+
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
2153+
$('.' + _this.settings.locationList + ' li[data-markerid=' + markerId + ']').addClass('list-focus');
2154+
2155+
map.panTo(selectedMarker.getPosition());
2156+
var listLoc = 'left';
2157+
if (_this.settings.bounceMarker === true) {
2158+
selectedMarker.setAnimation(google.maps.Animation.BOUNCE);
2159+
setTimeout(function () {
2160+
selectedMarker.setAnimation(null);
2161+
_this.createInfowindow(selectedMarker, listLoc, infowindow, storeStart, page);
2162+
}, 700
2163+
);
2164+
}
2165+
else {
2166+
_this.createInfowindow(selectedMarker, listLoc, infowindow, storeStart, page);
2167+
}
21672168

2168-
// Custom selected marker override
2169-
if(_this.settings.selectedMarkerImg !== null) {
2170-
_this.changeSelectedMarker(selectedMarker);
2171-
}
2172-
});
2169+
// Custom selected marker override
2170+
if (_this.settings.selectedMarkerImg !== null) {
2171+
_this.changeSelectedMarker(selectedMarker);
2172+
}
2173+
});
2174+
}
21732175

21742176
// Prevent bubbling from list content links
21752177
$(document).on('click.'+pluginName, '.' + _this.settings.locationList + ' li a', function (e) {

dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js/jquery.storelocator.js

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,38 +2135,40 @@
21352135
}
21362136

21372137
// Handle clicks from the list
2138-
$(document).on('click.'+pluginName, '.' + _this.settings.locationList + ' li', function () {
2139-
var markerId = $(this).data('markerid');
2140-
var selectedMarker = markers[markerId];
2141-
2142-
// List click callback
2143-
if (_this.settings.callbackListClick) {
2144-
_this.settings.callbackListClick.call(this, markerId, selectedMarker);
2145-
}
2146-
2147-
// Focus on the list
2148-
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
2149-
$('.' + _this.settings.locationList + ' li[data-markerid=' + markerId + ']').addClass('list-focus');
2138+
if (typeof noResults === 'undefined') {
2139+
$(document).on('click.' + pluginName, '.' + _this.settings.locationList + ' li', function () {
2140+
var markerId = $(this).data('markerid');
2141+
var selectedMarker = markers[markerId];
2142+
2143+
// List click callback
2144+
if (_this.settings.callbackListClick) {
2145+
_this.settings.callbackListClick.call(this, markerId, selectedMarker);
2146+
}
21502147

2151-
map.panTo(selectedMarker.getPosition());
2152-
var listLoc = 'left';
2153-
if (_this.settings.bounceMarker === true) {
2154-
selectedMarker.setAnimation(google.maps.Animation.BOUNCE);
2155-
setTimeout(function () {
2156-
selectedMarker.setAnimation(null);
2157-
_this.createInfowindow(selectedMarker, listLoc, infowindow, storeStart, page);
2158-
}, 700
2159-
);
2160-
}
2161-
else {
2162-
_this.createInfowindow(selectedMarker, listLoc, infowindow, storeStart, page);
2163-
}
2148+
// Focus on the list
2149+
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
2150+
$('.' + _this.settings.locationList + ' li[data-markerid=' + markerId + ']').addClass('list-focus');
2151+
2152+
map.panTo(selectedMarker.getPosition());
2153+
var listLoc = 'left';
2154+
if (_this.settings.bounceMarker === true) {
2155+
selectedMarker.setAnimation(google.maps.Animation.BOUNCE);
2156+
setTimeout(function () {
2157+
selectedMarker.setAnimation(null);
2158+
_this.createInfowindow(selectedMarker, listLoc, infowindow, storeStart, page);
2159+
}, 700
2160+
);
2161+
}
2162+
else {
2163+
_this.createInfowindow(selectedMarker, listLoc, infowindow, storeStart, page);
2164+
}
21642165

2165-
// Custom selected marker override
2166-
if(_this.settings.selectedMarkerImg !== null) {
2167-
_this.changeSelectedMarker(selectedMarker);
2168-
}
2169-
});
2166+
// Custom selected marker override
2167+
if (_this.settings.selectedMarkerImg !== null) {
2168+
_this.changeSelectedMarker(selectedMarker);
2169+
}
2170+
});
2171+
}
21702172

21712173
// Prevent bubbling from list content links
21722174
$(document).on('click.'+pluginName, '.' + _this.settings.locationList + ' li a', function (e) {

0 commit comments

Comments
 (0)