|
13 | 13 | } |
14 | 14 |
|
15 | 15 | // Variables used across multiple methods |
16 | | - var $this, listTemplate, infowindowTemplate, dataTypeRead, originalOrigin, originalData, originalZoom, dataRequest, searchInput, addressInput, olat, olng, storeNum, directionsDisplay, directionsService, prevSelectedMarkerBefore, prevSelectedMarkerAfter; |
| 16 | + var $this, listTemplate, infowindowTemplate, dataTypeRead, originalOrigin, originalData, originalZoom, dataRequest, searchInput, addressInput, olat, olng, storeNum, directionsDisplay, directionsService, prevSelectedMarkerBefore, prevSelectedMarkerAfter, firstRun; |
17 | 17 | var featuredset = [], locationset = [], normalset = [], markers = []; |
18 | 18 | var filters = {}, locationData = {}, GeoCodeCalc = {}, mappingObj = {}; |
19 | 19 |
|
|
243 | 243 | featuredset = []; |
244 | 244 | normalset = []; |
245 | 245 | markers = []; |
| 246 | + firstRun = false; |
246 | 247 | $(document).off('click.'+pluginName, '.' + this.settings.locationList + ' li'); |
247 | 248 | if( $('.' + this.settings.locationList + ' .bh-sl-close-directions-container').length ) { |
248 | 249 | $('.bh-sl-close-directions-container').remove(); |
|
941 | 942 | } |
942 | 943 |
|
943 | 944 | // Create the default markers |
944 | | - if (this.settings.storeLimit === -1 || this.settings.storeLimit > 26 || this.settings.catMarkers !== null || this.settings.markerImg !== null) { |
| 945 | + if (this.settings.storeLimit === -1 || this.settings.storeLimit > 26 || this.settings.catMarkers !== null || this.settings.markerImg !== null || (this.settings.fullMapStart === true && firstRun === true && (isNaN(this.settings.fullMapStartListLimit) || this.settings.fullMapStartListLimit > 26 || this.settings.fullMapStartListLimit === -1))) { |
945 | 946 | marker = new google.maps.Marker({ |
946 | 947 | position : point, |
947 | 948 | map : map, |
|
1001 | 1002 | // Set up alpha character |
1002 | 1003 | var markerId = currentMarker.get('id'); |
1003 | 1004 | // Use dot markers instead of alpha if there are more than 26 locations |
1004 | | - if (this.settings.storeLimit === -1 || this.settings.storeLimit > 26) { |
| 1005 | + if (this.settings.storeLimit === -1 || this.settings.storeLimit > 26 || (this.settings.fullMapStart === true && firstRun === true && (isNaN(this.settings.fullMapStartListLimit) || this.settings.fullMapStartListLimit > 26 || this.settings.fullMapStartListLimit === -1))) { |
1005 | 1006 | indicator = markerId + 1; |
1006 | 1007 | } |
1007 | 1008 | else { |
|
1406 | 1407 | * @param data {Object} location data object |
1407 | 1408 | * @param lat {number} origin latitude |
1408 | 1409 | * @param lng {number} origin longitude |
1409 | | - * @param firstRun {boolean} initial load check |
1410 | 1410 | * @param origin {string} origin address |
1411 | 1411 | * @param maxDistance {number} maximum distance if set |
1412 | 1412 | */ |
1413 | | - locationsSetup: function (data, lat, lng, firstRun, origin, maxDistance) { |
| 1413 | + locationsSetup: function (data, lat, lng, origin, maxDistance) { |
1414 | 1414 | this.writeDebug('locationsSetup',arguments); |
1415 | 1415 | if (typeof origin !== 'undefined') { |
1416 | 1416 | if (!data.distance) { |
|
1765 | 1765 | this.writeDebug('processData',mappingObject); |
1766 | 1766 | var _this = this; |
1767 | 1767 | var i = 0; |
1768 | | - var orig_lat, orig_lng, origin, name, maxDistance, firstRun, marker, bounds, storeStart, storeNumToShow, myOptions, noResults, distError; |
| 1768 | + var orig_lat, orig_lng, origin, name, maxDistance, marker, bounds, storeStart, storeNumToShow, myOptions, noResults, distError; |
1769 | 1769 | if (!this.isEmptyObject(mappingObject)) { |
1770 | 1770 | orig_lat = mappingObject.lat; |
1771 | 1771 | orig_lng = mappingObject.lng; |
|
1812 | 1812 | } |
1813 | 1813 | } |
1814 | 1814 |
|
1815 | | - _this.locationsSetup(locationData, orig_lat, orig_lng, firstRun, origin, maxDistance); |
| 1815 | + _this.locationsSetup(locationData, orig_lat, orig_lng, origin, maxDistance); |
1816 | 1816 |
|
1817 | 1817 | i++; |
1818 | 1818 | } |
|
1827 | 1827 | 'description': $(this).find('description').text() |
1828 | 1828 | }; |
1829 | 1829 |
|
1830 | | - _this.locationsSetup(locationData, orig_lat, orig_lng, firstRun, origin, maxDistance); |
| 1830 | + _this.locationsSetup(locationData, orig_lat, orig_lng, origin, maxDistance); |
1831 | 1831 |
|
1832 | 1832 | i++; |
1833 | 1833 | }); |
|
1843 | 1843 | } |
1844 | 1844 | } |
1845 | 1845 |
|
1846 | | - _this.locationsSetup(locationData, orig_lat, orig_lng, firstRun, origin, maxDistance); |
| 1846 | + _this.locationsSetup(locationData, orig_lat, orig_lng, origin, maxDistance); |
1847 | 1847 |
|
1848 | 1848 | i++; |
1849 | 1849 | }); |
|
1970 | 1970 | } |
1971 | 1971 |
|
1972 | 1972 | // Avoid error if number of locations is less than the default of 26 |
1973 | | - if (_this.settings.storeLimit === -1 || locationset.length < _this.settings.storeLimit) { |
| 1973 | + if (_this.settings.storeLimit === -1 || locationset.length < _this.settings.storeLimit || (this.settings.fullMapStart === true && firstRun === true && (isNaN(this.settings.fullMapStartListLimit) || this.settings.fullMapStartListLimit > 26 || this.settings.fullMapStartListLimit === -1))) { |
1974 | 1974 | storeNum = locationset.length; |
1975 | 1975 | } |
1976 | 1976 | else { |
|
2124 | 2124 | } |
2125 | 2125 | else { |
2126 | 2126 | // Set up the location list markup |
2127 | | - if (_this.settings.fullMapStartListLimit !== false && ! isNaN(_this.settings.fullMapStartListLimit)) { |
| 2127 | + if (firstRun && _this.settings.fullMapStartListLimit !== false && !isNaN(_this.settings.fullMapStartListLimit) && _this.settings.fullMapStartListLimit !== -1) { |
2128 | 2128 | for (var m = 0; m < _this.settings.fullMapStartListLimit; m++) { |
2129 | 2129 | var currentMarker = markers[m]; |
2130 | 2130 | _this.listSetup(currentMarker, storeStart, page); |
|
0 commit comments