Skip to content

Commit 1201e16

Browse files
committed
Fixed error when filtering with query strings where filter values with spaces wouldn't work, updated processForm method so submitting the map removes focus from any of the form input/select fields instead of just the address input, updated filterData string replace methods to match string replace method in filters setup
1 parent 638abb2 commit 1201e16

File tree

7 files changed

+27
-23
lines changed

7 files changed

+27
-23
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.7.3",
3+
"version": "2.7.4",
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 & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jQuery Google Maps Store Locator - v2.7.3 - 2017-05-07
1+
/*! jQuery Google Maps Store Locator - v2.7.4 - 2017-06-11
22
* http://www.bjornblog.com/web/jquery-store-locator-plugin
33
* Copyright (c) 2017 Bjorn Holine; Licensed MIT */
44

@@ -875,7 +875,7 @@
875875

876876
if(typeof data[k] !== 'undefined') {
877877
for (var l = 0; l < filterTests.length; l++) {
878-
exclusiveTest[l] = new RegExp(filterTests[l], 'i').test(data[k].replace(/[^\x00-\x7F]/g, ''));
878+
exclusiveTest[l] = new RegExp(filterTests[l], 'i').test(data[k].replace(/([^\x00-\x7F]|[.*+?^=!:${}()|\[\]\/\\])/g, ''));
879879
}
880880
}
881881

@@ -885,7 +885,7 @@
885885
}
886886
// Inclusive filtering
887887
else {
888-
if (typeof data[k] === 'undefined' || !(new RegExp(filters[k].join(''), 'i').test(data[k].replace(/[^\x00-\x7F]/g, '')))) {
888+
if (typeof data[k] === 'undefined' || !(new RegExp(filters[k].join(''), 'i').test(data[k].replace(/([^\x00-\x7F]|[.*+?^=!:${}()|\[\]\/\\])/g, '')))) {
889889
filterTest = false;
890890
}
891891
}
@@ -1522,8 +1522,8 @@
15221522
e.preventDefault();
15231523
}
15241524

1525-
// Blur the input field to hide mobile keyboards.
1526-
$addressInput.blur();
1525+
// Blur any form field to hide mobile keyboards.
1526+
$('.' + _this.settings.formContainer +' input, .' + _this.settings.formContainer + ' select').blur();
15271527

15281528
// Query string parameters
15291529
if(this.settings.querystringParams === true) {
@@ -1770,21 +1770,20 @@
17701770
if ( $taxGroupContainer.find('input[type="checkbox"]').length ) {
17711771

17721772
for ( var i = 0; i < value.length; i++ ) {
1773-
$taxGroupContainer.find('input:checkbox[value=' + value[i] + ']').prop('checked', true);
1773+
$taxGroupContainer.find('input:checkbox[value="' + value[i] + '"]').prop('checked', true);
17741774
}
1775-
17761775
}
17771776

17781777
// Handle select fields.
17791778
if ( $taxGroupContainer.find('select').length ) {
17801779
// Only expecting one value for select fields.
1781-
$taxGroupContainer.find('option[value=' + value[0] + ']').prop('selected', true);
1780+
$taxGroupContainer.find('option[value="' + value[0] + '"]').prop('selected', true);
17821781
}
17831782

17841783
// Handle radio buttons.
17851784
if ( $taxGroupContainer.find('input[type="radio"]').length ) {
17861785
// Only one value for radio button.
1787-
$taxGroupContainer.find('input:radio[value=' + value[0] + ']').prop('checked', true);
1786+
$taxGroupContainer.find('input:radio[value="' + value[0] + '"]').prop('checked', true);
17881787
}
17891788
},
17901789

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.

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": "2.7.3",
3+
"version": "2.7.4",
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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ filtering.
3535

3636
## Changelog
3737

38+
### Version 2.7.4
39+
40+
* Fixed error when filtering with query strings where filter values with spaces wouldn't work.
41+
* Updated processForm method so submitting the map removes focus from any of the form input/select fields instead of just the address input.
42+
* Updated filterData string replace methods to match string replace method in filters setup.
43+
3844
### Version 2.7.3
3945

4046
* Added ability to indicate multiple query string parameter values (for checkboxes) with a comma separated list value.

src/js/jquery.storelocator.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@
872872

873873
if(typeof data[k] !== 'undefined') {
874874
for (var l = 0; l < filterTests.length; l++) {
875-
exclusiveTest[l] = new RegExp(filterTests[l], 'i').test(data[k].replace(/[^\x00-\x7F]/g, ''));
875+
exclusiveTest[l] = new RegExp(filterTests[l], 'i').test(data[k].replace(/([^\x00-\x7F]|[.*+?^=!:${}()|\[\]\/\\])/g, ''));
876876
}
877877
}
878878

@@ -882,7 +882,7 @@
882882
}
883883
// Inclusive filtering
884884
else {
885-
if (typeof data[k] === 'undefined' || !(new RegExp(filters[k].join(''), 'i').test(data[k].replace(/[^\x00-\x7F]/g, '')))) {
885+
if (typeof data[k] === 'undefined' || !(new RegExp(filters[k].join(''), 'i').test(data[k].replace(/([^\x00-\x7F]|[.*+?^=!:${}()|\[\]\/\\])/g, '')))) {
886886
filterTest = false;
887887
}
888888
}
@@ -1519,8 +1519,8 @@
15191519
e.preventDefault();
15201520
}
15211521

1522-
// Blur the input field to hide mobile keyboards.
1523-
$addressInput.blur();
1522+
// Blur any form field to hide mobile keyboards.
1523+
$('.' + _this.settings.formContainer +' input, .' + _this.settings.formContainer + ' select').blur();
15241524

15251525
// Query string parameters
15261526
if(this.settings.querystringParams === true) {
@@ -1767,21 +1767,20 @@
17671767
if ( $taxGroupContainer.find('input[type="checkbox"]').length ) {
17681768

17691769
for ( var i = 0; i < value.length; i++ ) {
1770-
$taxGroupContainer.find('input:checkbox[value=' + value[i] + ']').prop('checked', true);
1770+
$taxGroupContainer.find('input:checkbox[value="' + value[i] + '"]').prop('checked', true);
17711771
}
1772-
17731772
}
17741773

17751774
// Handle select fields.
17761775
if ( $taxGroupContainer.find('select').length ) {
17771776
// Only expecting one value for select fields.
1778-
$taxGroupContainer.find('option[value=' + value[0] + ']').prop('selected', true);
1777+
$taxGroupContainer.find('option[value="' + value[0] + '"]').prop('selected', true);
17791778
}
17801779

17811780
// Handle radio buttons.
17821781
if ( $taxGroupContainer.find('input[type="radio"]').length ) {
17831782
// Only one value for radio button.
1784-
$taxGroupContainer.find('input:radio[value=' + value[0] + ']').prop('checked', true);
1783+
$taxGroupContainer.find('input:radio[value="' + value[0] + '"]').prop('checked', true);
17851784
}
17861785
},
17871786

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.7.3",
6+
"version": "2.7.4",
77
"author": {
88
"name": "Bjorn Holine",
99
"url": "http://www.bjornblog.com/"

0 commit comments

Comments
 (0)