|
10 | 10 | }
|
11 | 11 |
|
12 | 12 | // Variables used across multiple methods
|
13 |
| - var $this, listTemplate, infowindowTemplate, dataTypeRead, originalOrigin, originalData, originalZoom, dataRequest, searchInput, addressInput, olat, olng, storeNum, directionsDisplay, directionsService, prevSelectedMarkerBefore, prevSelectedMarkerAfter; |
| 13 | + var $this, listTemplate, infowindowTemplate, dataTypeRead, originalOrigin, originalData, originalZoom, dataRequest, searchInput, addressInput, olat, olng, storeNum, directionsDisplay, directionsService, prevSelectedMarkerBefore, prevSelectedMarkerAfter, firstRun; |
14 | 14 | var featuredset = [], locationset = [], normalset = [], markers = [];
|
15 | 15 | var filters = {}, locationData = {}, GeoCodeCalc = {}, mappingObj = {};
|
16 | 16 |
|
|
240 | 240 | featuredset = [];
|
241 | 241 | normalset = [];
|
242 | 242 | markers = [];
|
| 243 | + firstRun = false; |
243 | 244 | $(document).off('click.'+pluginName, '.' + this.settings.locationList + ' li');
|
244 | 245 | if( $('.' + this.settings.locationList + ' .bh-sl-close-directions-container').length ) {
|
245 | 246 | $('.bh-sl-close-directions-container').remove();
|
|
938 | 939 | }
|
939 | 940 |
|
940 | 941 | // Create the default markers
|
941 |
| - if (this.settings.storeLimit === -1 || this.settings.storeLimit > 26 || this.settings.catMarkers !== null || this.settings.markerImg !== null) { |
| 942 | + 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))) { |
942 | 943 | marker = new google.maps.Marker({
|
943 | 944 | position : point,
|
944 | 945 | map : map,
|
|
998 | 999 | // Set up alpha character
|
999 | 1000 | var markerId = currentMarker.get('id');
|
1000 | 1001 | // Use dot markers instead of alpha if there are more than 26 locations
|
1001 |
| - if (this.settings.storeLimit === -1 || this.settings.storeLimit > 26) { |
| 1002 | + 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))) { |
1002 | 1003 | indicator = markerId + 1;
|
1003 | 1004 | }
|
1004 | 1005 | else {
|
|
1403 | 1404 | * @param data {Object} location data object
|
1404 | 1405 | * @param lat {number} origin latitude
|
1405 | 1406 | * @param lng {number} origin longitude
|
1406 |
| - * @param firstRun {boolean} initial load check |
1407 | 1407 | * @param origin {string} origin address
|
1408 | 1408 | * @param maxDistance {number} maximum distance if set
|
1409 | 1409 | */
|
1410 |
| - locationsSetup: function (data, lat, lng, firstRun, origin, maxDistance) { |
| 1410 | + locationsSetup: function (data, lat, lng, origin, maxDistance) { |
1411 | 1411 | this.writeDebug('locationsSetup',arguments);
|
1412 | 1412 | if (typeof origin !== 'undefined') {
|
1413 | 1413 | if (!data.distance) {
|
|
1762 | 1762 | this.writeDebug('processData',mappingObject);
|
1763 | 1763 | var _this = this;
|
1764 | 1764 | var i = 0;
|
1765 |
| - var orig_lat, orig_lng, origin, name, maxDistance, firstRun, marker, bounds, storeStart, storeNumToShow, myOptions, noResults, distError; |
| 1765 | + var orig_lat, orig_lng, origin, name, maxDistance, marker, bounds, storeStart, storeNumToShow, myOptions, noResults, distError; |
1766 | 1766 | if (!this.isEmptyObject(mappingObject)) {
|
1767 | 1767 | orig_lat = mappingObject.lat;
|
1768 | 1768 | orig_lng = mappingObject.lng;
|
|
1809 | 1809 | }
|
1810 | 1810 | }
|
1811 | 1811 |
|
1812 |
| - _this.locationsSetup(locationData, orig_lat, orig_lng, firstRun, origin, maxDistance); |
| 1812 | + _this.locationsSetup(locationData, orig_lat, orig_lng, origin, maxDistance); |
1813 | 1813 |
|
1814 | 1814 | i++;
|
1815 | 1815 | }
|
|
1824 | 1824 | 'description': $(this).find('description').text()
|
1825 | 1825 | };
|
1826 | 1826 |
|
1827 |
| - _this.locationsSetup(locationData, orig_lat, orig_lng, firstRun, origin, maxDistance); |
| 1827 | + _this.locationsSetup(locationData, orig_lat, orig_lng, origin, maxDistance); |
1828 | 1828 |
|
1829 | 1829 | i++;
|
1830 | 1830 | });
|
|
1840 | 1840 | }
|
1841 | 1841 | }
|
1842 | 1842 |
|
1843 |
| - _this.locationsSetup(locationData, orig_lat, orig_lng, firstRun, origin, maxDistance); |
| 1843 | + _this.locationsSetup(locationData, orig_lat, orig_lng, origin, maxDistance); |
1844 | 1844 |
|
1845 | 1845 | i++;
|
1846 | 1846 | });
|
|
1967 | 1967 | }
|
1968 | 1968 |
|
1969 | 1969 | // Avoid error if number of locations is less than the default of 26
|
1970 |
| - if (_this.settings.storeLimit === -1 || locationset.length < _this.settings.storeLimit) { |
| 1970 | + 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))) { |
1971 | 1971 | storeNum = locationset.length;
|
1972 | 1972 | }
|
1973 | 1973 | else {
|
|
2121 | 2121 | }
|
2122 | 2122 | else {
|
2123 | 2123 | // Set up the location list markup
|
2124 |
| - if (_this.settings.fullMapStartListLimit !== false && ! isNaN(_this.settings.fullMapStartListLimit)) { |
| 2124 | + if (firstRun && _this.settings.fullMapStartListLimit !== false && !isNaN(_this.settings.fullMapStartListLimit) && _this.settings.fullMapStartListLimit !== -1) { |
2125 | 2125 | for (var m = 0; m < _this.settings.fullMapStartListLimit; m++) {
|
2126 | 2126 | var currentMarker = markers[m];
|
2127 | 2127 | _this.listSetup(currentMarker, storeStart, page);
|
|
0 commit comments