Skip to content

Commit a485a63

Browse files
committed
Fixed name search issue introduced in v3.1.1. Reverted to previous matching pattern only for name searches and still using the new patter for taxonomy matching.
1 parent abe4648 commit a485a63

File tree

7 files changed

+24
-8
lines changed

7 files changed

+24
-8
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": "3.1.1",
3+
"version": "3.1.2",
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: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jQuery Google Maps Store Locator - v3.1.1 - 2021-01-09
1+
/*! jQuery Google Maps Store Locator - v3.1.2 - 2021-01-12
22
* http://www.bjornblog.com/web/jquery-store-locator-plugin
33
* Copyright (c) 2021 Bjorn Holine; Licensed MIT */
44

@@ -2828,7 +2828,13 @@
28282828
if (!taxFilters[k]) {
28292829
taxFilters[k] = [];
28302830
}
2831-
taxFilters[k][z] = '(?=.*' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '') + '(?!\\s))';
2831+
2832+
// Swap pattern matching depending on name search vs. taxonomy filtering.
2833+
if ( k === _this.settings.nameAttribute ) {
2834+
taxFilters[k][z] = '(?:^|\\s)' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '');
2835+
} else {
2836+
taxFilters[k][z] = '(?=.*' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '') + '(?!\\s))';
2837+
}
28322838
}
28332839
}
28342840
}

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

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

package.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": "3.1.1",
3+
"version": "3.1.2",
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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ filtering.
3535

3636
## Changelog
3737

38+
### Version 3.1.2
39+
40+
* Fixed name search issue introduced in v3.1.1. Reverted to previous matching pattern only for name searches and still using the new patter for taxonomy matching.
41+
3842
### Version 3.1.1
3943

4044
* Enhanced filtering regular expression to better account for exact matches vs. substrings.

src/js/jquery.storelocator.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2824,7 +2824,13 @@
28242824
if (!taxFilters[k]) {
28252825
taxFilters[k] = [];
28262826
}
2827-
taxFilters[k][z] = '(?=.*' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '') + '(?!\\s))';
2827+
2828+
// Swap pattern matching depending on name search vs. taxonomy filtering.
2829+
if ( k === _this.settings.nameAttribute ) {
2830+
taxFilters[k][z] = '(?:^|\\s)' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '');
2831+
} else {
2832+
taxFilters[k][z] = '(?=.*' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '') + '(?!\\s))';
2833+
}
28282834
}
28292835
}
28302836
}

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","dealer","location", "locations", "maps", "map", "stores", "find"],
6-
"version": "3.1.1",
6+
"version": "3.1.2",
77
"author": {
88
"name": "Bjorn Holine",
99
"url": "http://www.bjornblog.com/"

0 commit comments

Comments
 (0)