|
1 |
| -/*! jQuery Google Maps Store Locator - v3.1.9 - 2023-02-02 |
| 1 | +/*! jQuery Google Maps Store Locator - v3.1.9 - 2023-02-03 |
2 | 2 | * http://www.bjornblog.com/web/jquery-store-locator-plugin
|
3 | 3 | * Copyright (c) 2023 Bjorn Holine; Licensed MIT */
|
4 | 4 |
|
|
13 | 13 | }
|
14 | 14 |
|
15 | 15 | // Variables used across multiple methods
|
16 |
| - var $this, map, listTemplate, infowindowTemplate, dataTypeRead, originalOrigin, originalData, originalZoom, dataRequest, searchInput, addressInput, olat, olng, storeNum, directionsDisplay, directionsService, prevSelectedMarkerBefore, prevSelectedMarkerAfter, firstRun, reload; |
| 16 | + var $this, map, listTemplate, infowindowTemplate, dataTypeRead, originalOrigin, originalData, originalZoom, dataRequest, searchInput, addressInput, olat, olng, storeNum, directionsDisplay, directionsService, prevSelectedMarkerBefore, prevSelectedMarkerAfter, firstRun, reload, nameAttrs; |
17 | 17 | var featuredset = [], locationset = [], normalset = [], markers = [];
|
18 | 18 | var filters = {}, locationData = {}, GeoCodeCalc = {}, mappingObj = {};
|
19 | 19 |
|
|
1062 | 1062 | }
|
1063 | 1063 | }
|
1064 | 1064 |
|
1065 |
| - if (testResults.indexOf(true) === -1) { |
1066 |
| - filterTest = false; |
| 1065 | + if (nameAttrs.indexOf(k) !== -1 && testResults.indexOf(true) !== -1) { |
| 1066 | + return true; |
| 1067 | + } else { |
| 1068 | + if (testResults.indexOf(true) === -1) { |
| 1069 | + filterTest = false; |
| 1070 | + } |
1067 | 1071 | }
|
1068 | 1072 | }
|
1069 | 1073 | }
|
|
2869 | 2873 | // Name search - using taxonomy filter to handle
|
2870 | 2874 | if (_this.settings.nameSearch === true) {
|
2871 | 2875 | if (typeof searchInput !== 'undefined' && '' !== searchInput) {
|
2872 |
| - filters[_this.settings.nameAttribute] = [searchInput]; |
| 2876 | + |
| 2877 | + if (_this.settings.nameAttribute.indexOf(',')) { |
| 2878 | + nameAttrs = _this.settings.nameAttribute.split(','); |
| 2879 | + |
| 2880 | + // Multiple name attributes should swap to exclusive filtering. |
| 2881 | + if (_this.settings.exclusiveTax !== null) { |
| 2882 | + _this.settings.exclusiveTax.concat(nameAttrs); |
| 2883 | + } else { |
| 2884 | + _this.settings.exclusiveTax = nameAttrs; |
| 2885 | + } |
| 2886 | + |
| 2887 | + for (var a = 0; a < nameAttrs.length; a++) { |
| 2888 | + filters[nameAttrs[a].trim()] = [searchInput]; |
| 2889 | + } |
| 2890 | + } else { |
| 2891 | + filters[_this.settings.nameAttribute] = [searchInput]; |
| 2892 | + } |
2873 | 2893 | }
|
2874 | 2894 |
|
2875 | 2895 | // Check for a previous value.
|
|
2895 | 2915 | }
|
2896 | 2916 |
|
2897 | 2917 | // Swap pattern matching depending on name search vs. taxonomy filtering.
|
2898 |
| - if ( k === _this.settings.nameAttribute ) { |
2899 |
| - taxFilters[k][z] = '(?:^|\\s)' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, ''); |
| 2918 | + if (typeof nameAttrs !== 'undefined') { |
| 2919 | + if (nameAttrs.indexOf(k) !== -1) { |
| 2920 | + taxFilters[k][z] = '(?:^|\\s)' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, ''); |
| 2921 | + } else { |
| 2922 | + taxFilters[k][z] = '(?=.*' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '') + '(?!\\s))'; |
| 2923 | + } |
2900 | 2924 | } else {
|
2901 |
| - taxFilters[k][z] = '(?=.*' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '') + '(?!\\s))'; |
| 2925 | + if (k === _this.settings.nameAttribute) { |
| 2926 | + taxFilters[k][z] = '(?:^|\\s)' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, ''); |
| 2927 | + } else { |
| 2928 | + taxFilters[k][z] = '(?=.*' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '') + '(?!\\s))'; |
| 2929 | + } |
2902 | 2930 | }
|
2903 | 2931 | }
|
2904 | 2932 | }
|
2905 | 2933 | }
|
| 2934 | + |
2906 | 2935 | // Filter the data
|
2907 | 2936 | if (!_this.isEmptyObject(taxFilters)) {
|
2908 | 2937 | locationset = $.grep(locationset, function (val) {
|
|
0 commit comments