Skip to content

Commit 5d3b87b

Browse files
committed
Added checks to replace non-ASCII characters when filtering, removed non-standard $1 RegExp property in processData method, updated version
1 parent 9772f1a commit 5d3b87b

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-storelocator-plugin",
3-
"version": "2.6.3",
3+
"version": "2.7.0",
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",

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

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

@@ -862,7 +862,7 @@
862862
var exclusiveTest = [];
863863

864864
for(var l = 0; l < filterTests.length; l++) {
865-
exclusiveTest[l] = new RegExp(filterTests[l], 'i').test(data[k]);
865+
exclusiveTest[l] = new RegExp(filterTests[l], 'i').test(data[k].replace(/[^\x00-\x7F]/g, ''));
866866
}
867867

868868
if(exclusiveTest.indexOf(true) === -1) {
@@ -871,7 +871,7 @@
871871
}
872872
// Inclusive filtering
873873
else {
874-
if (!(new RegExp(filters[k].join(''), 'i').test(data[k]))) {
874+
if (!(new RegExp(filters[k].join(''), 'i').test(data[k].replace(/[^\x00-\x7F]/g, '')))) {
875875
filterTest = false;
876876
}
877877
}
@@ -2377,7 +2377,7 @@
23772377
if (!taxFilters[k]) {
23782378
taxFilters[k] = [];
23792379
}
2380-
taxFilters[k][z] = '(?=.*\\b' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1") + '\\b)';
2380+
taxFilters[k][z] = '(?=.*\\b' + filters[k][z].replace(/([^\x00-\x7F]|[.*+?^=!:${}()|\[\]\/\\])/g, '') + '\\b)';
23812381
}
23822382
}
23832383
}

dist/assets/js/plugins/storeLocator/jquery.storelocator.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.

readme.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,18 @@ filtering.
3535

3636
## Changelog
3737

38-
### Version 2.6.3
38+
### Version 2.7.0
3939

4040
* Added [callback documentation](callbacks.md).
4141
* Added callbackCreateMarker for custom marker overrides.
4242
* Added [InfoBubble](https://github.com/googlemaps/js-info-bubble) support and example file.
43-
* Added location results total count if HTML element with .bh-sl-total-results class exists.
44-
* Added markerAlphaColor setting to change the marker letter color.
43+
* Added location results total count if HTML element with "bh-sl-total-results" class exists.
44+
* Added checks to replace non-ASCII characters when filtering.
4545
* Added reset functionality that can be triggered via a button that has the CSS class "bh-sl-reset".
4646
* Added query string parameter filter check so that results can be filtered with URL query strings.
4747
* Fixed issue with maxDistance and querystringParams settings combination.
4848
* Moved some functionality from processData into new separate methods.
49+
* Removed non-standard $1 RegExp property in processData method.
4950

5051
### Version 2.6.2
5152

src/js/jquery.storelocator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@
859859
var exclusiveTest = [];
860860

861861
for(var l = 0; l < filterTests.length; l++) {
862-
exclusiveTest[l] = new RegExp(filterTests[l], 'i').test(data[k]);
862+
exclusiveTest[l] = new RegExp(filterTests[l], 'i').test(data[k].replace(/[^\x00-\x7F]/g, ''));
863863
}
864864

865865
if(exclusiveTest.indexOf(true) === -1) {
@@ -868,7 +868,7 @@
868868
}
869869
// Inclusive filtering
870870
else {
871-
if (!(new RegExp(filters[k].join(''), 'i').test(data[k]))) {
871+
if (!(new RegExp(filters[k].join(''), 'i').test(data[k].replace(/[^\x00-\x7F]/g, '')))) {
872872
filterTest = false;
873873
}
874874
}
@@ -2374,7 +2374,7 @@
23742374
if (!taxFilters[k]) {
23752375
taxFilters[k] = [];
23762376
}
2377-
taxFilters[k][z] = '(?=.*\\b' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1") + '\\b)';
2377+
taxFilters[k][z] = '(?=.*\\b' + filters[k][z].replace(/([^\x00-\x7F]|[.*+?^=!:${}()|\[\]\/\\])/g, '') + '\\b)';
23782378
}
23792379
}
23802380
}

storelocator.jquery.json

Lines changed: 1 addition & 1 deletion
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.6.3",
6+
"version": "2.7.0",
77
"author": {
88
"name": "Bjorn Holine",
99
"url": "http://www.bjornblog.com/"

0 commit comments

Comments
 (0)