Skip to content

Commit 01b91d2

Browse files
committed
Merge branch 'development'
2 parents 8eb120b + 7793c8a commit 01b91d2

File tree

7 files changed

+69
-22
lines changed

7 files changed

+69
-22
lines changed

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

+27-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/*! jQuery Google Maps Store Locator - v2.0.4 - 2014-12-15
1+
/*! jQuery Google Maps Store Locator - v2.0.5 - 2015-01-04
22
* http://www.bjornblog.com/web/jquery-store-locator-plugin
3-
* Copyright (c) 2014 Bjorn Holine; Licensed MIT */
3+
* Copyright (c) 2015 Bjorn Holine; Licensed MIT */
44

55
;(function ($, window, document, undefined) {
66
'use strict';
@@ -87,8 +87,9 @@
8787
'callbackDirectionsRequest': null,
8888
'callbackCloseDirections' : null,
8989
'callbackNoResults' : null,
90+
'callbackListClick' : null,
91+
'callbackMarkerClick' : null,
9092
// Language options
91-
'geocodeErrorAlert' : 'Geocode was not successful for the following reason: ',
9293
'addressErrorAlert' : 'Unable to find address',
9394
'autoGeocodeErrorAlert' : 'Automatic location detection failed. Please fill in your address or zip code.',
9495
'distanceErrorAlert' : 'Unfortunately, our closest location is more than ',
@@ -225,6 +226,9 @@
225226
normalset = [];
226227
markers = [];
227228
$(document).off('click.'+pluginName, '.' + this.settings.locationList + ' li');
229+
if( $('.' + this.settings.locationList + ' .bh-sl-close-directions-container').length ) {
230+
$('.bh-sl-close-directions-container').remove();
231+
}
228232
},
229233

230234
/**
@@ -483,8 +487,8 @@
483487
result.longitude = results[0].geometry.location.lng();
484488
callbackFunction(result);
485489
} else {
486-
_this.notify(_this.settings.geocodeErrorAlert + status);
487490
callbackFunction(null);
491+
throw new Error('Geocode was not successful for the following reason: ' + status);
488492
}
489493
});
490494
};
@@ -505,8 +509,8 @@
505509
callbackFunction(result);
506510
}
507511
} else {
508-
_this.notify(_this.settings.geocodeErrorAlert + status);
509512
callbackFunction(null);
513+
throw new Error('Reverse geocode was not successful for the following reason: ' + status);
510514
}
511515
});
512516
};
@@ -913,9 +917,15 @@
913917
infowindow.setContent(formattedAddress);
914918
infowindow.open(marker.get('map'), marker);
915919
// Focus on the list
916-
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
917920
var markerId = marker.get('id');
918921
var $selectedLocation = $('.' + _this.settings.locationList + ' li[data-markerid=' + markerId + ']');
922+
923+
// Marker click callback
924+
if (_this.settings.callbackMarkerClick) {
925+
_this.settings.callbackMarkerClick.call(this, marker, markerId, $selectedLocation);
926+
}
927+
928+
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
919929
$selectedLocation.addClass('list-focus');
920930

921931
// Scroll list to selected marker
@@ -1059,7 +1069,6 @@
10591069
}
10601070

10611071
// Remove the close icon, remove the directions, add the list back
1062-
$('.bh-sl-close-directions-container').remove();
10631072
$('.' + this.settings.locationList + ' .adp').remove();
10641073
$('.' + this.settings.locationList + ' ul').fadeIn();
10651074

@@ -1724,7 +1733,12 @@
17241733
}
17251734
else{
17261735
if(_this.settings.originMarkerImg !== null) {
1727-
originImg = this.markerImage(_this.settings.originMarkerImg, _this.settings.originMarkerDim.width, _this.settings.originMarkerDim.height);
1736+
if(_this.settings.originMarkerDim === null) {
1737+
originImg = _this.markerImage(_this.settings.originMarkerImg);
1738+
}
1739+
else {
1740+
originImg = _this.markerImage(_this.settings.originMarkerImg, _this.settings.originMarkerDim.width, _this.settings.originMarkerDim.height);
1741+
}
17281742
}
17291743
else {
17301744
originImg = {
@@ -1806,9 +1820,13 @@
18061820
// Handle clicks from the list
18071821
$(document).on('click.'+pluginName, '.' + _this.settings.locationList + ' li', function () {
18081822
var markerId = $(this).data('markerid');
1809-
18101823
var selectedMarker = markers[markerId];
18111824

1825+
// List click callback
1826+
if (_this.settings.callbackListClick) {
1827+
_this.settings.callbackListClick.call(this, markerId, selectedMarker);
1828+
}
1829+
18121830
// Focus on the list
18131831
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
18141832
$('.' + _this.settings.locationList + ' li[data-markerid=' + markerId + ']').addClass('list-focus');

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

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

options.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
| callbackDirectionsRequest | null | Callback that fires upon a directions request when using the inline directions option. |
6666
| callbackCloseDirections | null | Callback that fires when the directions panel closes. |
6767
| callbackNoResults | null | Callback that fires when no results are found. |
68-
| geocodeErrorAlert | 'Geocode was not successful for the following reason: ' | Language setting |
68+
| callbackListClick | null | Callback that fires when a list element is clicked in the location list. |
69+
| callbackMarkerClick | null | Callback that fires when a map marker is clicked. |
6970
| addressErrorAlert | 'Unable to find address' | Language setting |
7071
| autoGeocodeErrorAlert | 'Automatic location detection failed. Please fill in your address or zip code.' | Language setting |
7172
| distanceErrorAlert | 'Unfortunately, our closest location is more than ' | Language setting |

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-storelocator-plugin",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"description": "This jQuery plugin takes advantage of Google Maps API version 3 to create an easy to implement store locator. No back-end programming is required, you just need to feed it KML, XML, or JSON data with all the location information.",
55
"repository": {
66
"type": "git",

readme.md

+10
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ for even faster loading.
2727

2828
## Changelog
2929

30+
### Version 2.0.5
31+
32+
- Fixed typo with originMarker setup.
33+
- Made the originMarkerDim setting optional when setting a custom origin marker image - defaults to 32px by 32px.
34+
- Removed geocodeErrorAlert language option and switched error alerts to custom exceptions so users aren't shown
35+
multiple alerts.
36+
- Fixed bug with inline directions where close icon wasn't being removed on page reload.
37+
- Added callbackListClick that fires when a list element is clicked.
38+
- Added callbackMarkerClick that fires when a map marker is clicked.
39+
3040
### Version 2.0.4
3141

3242
* Fixed bug with maxDistance and pagination setting combination. The last page of of the pagination results was set to

src/js/jquery.storelocator.js

+25-7
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@
8585
'callbackDirectionsRequest': null,
8686
'callbackCloseDirections' : null,
8787
'callbackNoResults' : null,
88+
'callbackListClick' : null,
89+
'callbackMarkerClick' : null,
8890
// Language options
89-
'geocodeErrorAlert' : 'Geocode was not successful for the following reason: ',
9091
'addressErrorAlert' : 'Unable to find address',
9192
'autoGeocodeErrorAlert' : 'Automatic location detection failed. Please fill in your address or zip code.',
9293
'distanceErrorAlert' : 'Unfortunately, our closest location is more than ',
@@ -223,6 +224,9 @@
223224
normalset = [];
224225
markers = [];
225226
$(document).off('click.'+pluginName, '.' + this.settings.locationList + ' li');
227+
if( $('.' + this.settings.locationList + ' .bh-sl-close-directions-container').length ) {
228+
$('.bh-sl-close-directions-container').remove();
229+
}
226230
},
227231

228232
/**
@@ -481,8 +485,8 @@
481485
result.longitude = results[0].geometry.location.lng();
482486
callbackFunction(result);
483487
} else {
484-
_this.notify(_this.settings.geocodeErrorAlert + status);
485488
callbackFunction(null);
489+
throw new Error('Geocode was not successful for the following reason: ' + status);
486490
}
487491
});
488492
};
@@ -503,8 +507,8 @@
503507
callbackFunction(result);
504508
}
505509
} else {
506-
_this.notify(_this.settings.geocodeErrorAlert + status);
507510
callbackFunction(null);
511+
throw new Error('Reverse geocode was not successful for the following reason: ' + status);
508512
}
509513
});
510514
};
@@ -911,9 +915,15 @@
911915
infowindow.setContent(formattedAddress);
912916
infowindow.open(marker.get('map'), marker);
913917
// Focus on the list
914-
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
915918
var markerId = marker.get('id');
916919
var $selectedLocation = $('.' + _this.settings.locationList + ' li[data-markerid=' + markerId + ']');
920+
921+
// Marker click callback
922+
if (_this.settings.callbackMarkerClick) {
923+
_this.settings.callbackMarkerClick.call(this, marker, markerId, $selectedLocation);
924+
}
925+
926+
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
917927
$selectedLocation.addClass('list-focus');
918928

919929
// Scroll list to selected marker
@@ -1057,7 +1067,6 @@
10571067
}
10581068

10591069
// Remove the close icon, remove the directions, add the list back
1060-
$('.bh-sl-close-directions-container').remove();
10611070
$('.' + this.settings.locationList + ' .adp').remove();
10621071
$('.' + this.settings.locationList + ' ul').fadeIn();
10631072

@@ -1722,7 +1731,12 @@
17221731
}
17231732
else{
17241733
if(_this.settings.originMarkerImg !== null) {
1725-
originImg = this.markerImage(_this.settings.originMarkerImg, _this.settings.originMarkerDim.width, _this.settings.originMarkerDim.height);
1734+
if(_this.settings.originMarkerDim === null) {
1735+
originImg = _this.markerImage(_this.settings.originMarkerImg);
1736+
}
1737+
else {
1738+
originImg = _this.markerImage(_this.settings.originMarkerImg, _this.settings.originMarkerDim.width, _this.settings.originMarkerDim.height);
1739+
}
17261740
}
17271741
else {
17281742
originImg = {
@@ -1804,9 +1818,13 @@
18041818
// Handle clicks from the list
18051819
$(document).on('click.'+pluginName, '.' + _this.settings.locationList + ' li', function () {
18061820
var markerId = $(this).data('markerid');
1807-
18081821
var selectedMarker = markers[markerId];
18091822

1823+
// List click callback
1824+
if (_this.settings.callbackListClick) {
1825+
_this.settings.callbackListClick.call(this, markerId, selectedMarker);
1826+
}
1827+
18101828
// Focus on the list
18111829
$('.' + _this.settings.locationList + ' li').removeClass('list-focus');
18121830
$('.' + _this.settings.locationList + ' li[data-markerid=' + markerId + ']').addClass('list-focus');

storelocator.jquery.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "jQuery Google Maps Store Locator",
44
"description": "This jQuery plugin takes advantage of Google Maps API version 3 to create an easy to implement store locator. No back-end programming is required, you just need to feed it KML, XML, or JSON data with all the location information.",
55
"keywords": ["jquery","locator","store", "location", "locations", "maps", "map", "stores", "find"],
6-
"version": "2.0.4",
6+
"version": "2.0.5",
77
"author": {
88
"name": "Bjorn Holine",
99
"url": "http://www.bjornblog.com/"

0 commit comments

Comments
 (0)