MR.DOLLAR (2024)

' + // "

Uluru, also referred to as Ayers Rock, is a large " + // "sandstone rock formation in the southern part of the " + // "Northern Territory, central Australia. It lies 335km (208mi) " + // "south west of the nearest large town, Alice Springs; 450km " + // "(280mi) by road. Kata Tjuta and Uluru are the two major " + // "features of the Uluru - Kata Tjuta National Park. Uluru is " + // "sacred to the Pitjantjatjara and Yankunytjatjara, the " + // "Aboriginal people of the area. It has many springs, waterholes, " + // "rock caves and ancient paintings. Uluru is listed as a World " + // "Heritage Site.

" + // '

Attribution: Uluru, ' + // "https://en.wikipedia.org/w/index.php?title=Uluru " + // "(last visited June 22, 2009).

" + // "

${location[0]}

Address

${location[3] ? location[3] : '-' }

MR.DOLLAR (1) MR.DOLLAR (2)

Contact Number

${location[4] ? location[4] : '-' }

Business Hour

${location[5] ? location[5] : '-' }

`; marker.addListener("click", () => { $('.store').removeClass('active show'); $('.storelisting-' + i).addClass('active'); markers.forEach(function(marker) { marker.setIcon(defaultIcon); }) if ($(window).width() > 768) { infowindow.setContent(contentString) infowindow.open({ anchor: marker, map, }); } marker.setIcon(currentIcon); map.panTo(marker.getPosition()); map.setZoom(15); }); }); $(".store").on("click", function() { $('.store').removeClass('active show'); var laLatLng = new google.maps.LatLng($(this).data('lat'), $(this).data('lng')); markers.forEach(function(marker) { marker.setIcon(defaultIcon); }) map.setCenter(laLatLng); $(this).addClass('active show'); new google.maps.event.trigger(markers[$(this).data('id')], 'click'); markers[$(this).data('id')].setIcon(currentIcon); }); } function initBoundMarkers(map) { let bounds = map.getBounds(), count = 0, sortedClosestMarkers = find_closest_markers(); $('.store').removeClass('first show active').removeAttr('style'); for (let i = 0; i < sortedClosestMarkers.length; i++) { const marker = sortedClosestMarkers[i].marker, distance = sortedClosestMarkers[i].distance * 0.001, mapinfo = $('.storelisting-' + marker.index); marker.setIcon(defaultIcon); if (bounds.contains(marker.getPosition()) === true) { mapinfo.css('order', count).addClass('show'); //nearest marker add class first if (mapinfo.css('order') == 0) { mapinfo.addClass('first') } //set current marker markers[$('.store.show.first').data('id')].setIcon(currentIcon); mapinfo.show(); mapinfo.find('.distance').text(distance.toFixed(2)) count++; } else { mapinfo.hide() } } //nearest marker add class active //$('.store.show.first').addClass('active'); $('.store-count').text(count); new google.maps.event.trigger(markers[$('.store.show.first').data('id')], 'click'); } function updateBoundMarkers() { var bounds = map.getBounds(), count = 0, sortedClosestMarkers = find_closest_markers(); for (var i = 0; i < sortedClosestMarkers.length; i++) { const marker = sortedClosestMarkers[i].marker, distance = sortedClosestMarkers[i].distance * 0.001, mapinfo = $('.storelisting-' + marker.index); if (bounds.contains(marker.getPosition()) === true) { mapinfo.css('order', count).addClass('show'); mapinfo.show(); count++; mapinfo.find('.distance').text(distance.toFixed(2)) } else { mapinfo.hide(); } } $('.store-count').text(count); } // function calcDistance(fromLatLng, toLatLng) { // return (google.maps.geometry.spherical.computeDistanceBetween(fromLatLng, toLatLng) / 1000).toFixed(2); // } // function degreesToRadians(degrees) { // return degrees * Math.PI / 180; // } // function getDistanceBetweenPoints(lat1, lng1, lat2, lng2) { // // The radius of the planet earth in meters // let R = 6378137; // let dLat = degreesToRadians(lat2 - lat1); // let dLong = degreesToRadians(lng2 - lng1); // let a = Math.sin(dLat / 2) * // Math.sin(dLat / 2) + // Math.cos(degreesToRadians(lat1)) * // Math.cos(degreesToRadians(lat1)) * // Math.sin(dLong / 2) * // Math.sin(dLong / 2); // let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); // let distance = R * c; // return distance * 0.001; // } function find_closest_markers(n) { var markers_distances = []; for (i = 0; i < markers.length; i++) { var d = google.maps.geometry.spherical.computeDistanceBetween(markers[i].position, curPos); markers_distances[i] = { distance: d, marker: markers[i] } } var closest_markers = markers_distances.sort((a, b) => { return a.distance - b.distance }).slice(0, n) return closest_markers.map((item) => { return item }) } function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition((position) => { if (curPosMarker) { curPosMarker.setMap(null); } userIcon = { url: 'https://www.mrdollar.co/public/img/mrdollar/current-position.png', // This marker is 20 pixels wide by 32 pixels high. scaledSize: new google.maps.Size(42, 42), // The origin for this image is (0, 0). origin: new google.maps.Point(0, 0), // The anchor for this image is the base of the flagpole at (0, 32). anchor: new google.maps.Point(0, 42), }; const bounds = new google.maps.LatLngBounds(); var pos = { lat: position.coords.latitude, lng: position.coords.longitude }; curPosMarker = new google.maps.Marker({ position: pos, icon: userIcon, map }); curPos = new google.maps.LatLng(pos); //map.setZoom(15); //map.setCenter(pos); bounds.extend(curPos); bounds.extend(find_closest_markers(1)[0].marker.getPosition()); map.fitBounds(bounds); google.maps.event.addListenerOnce(map, 'idle', function() { initBoundMarkers(map); }); //map.panTo(find_closest_markers(1)[0].marker.getPosition()) }, () => { alert('Unable to locate your current location. Please allow your location settings and try again.') //handleLocationError(true, infoWindow, map.getCenter()); }); } else { alert('Unable to locate your current location. Please check your location settings and try again.') // Browser doesn't support Geolocation //handleLocationError(false, infoWindow, map.getCenter()); } } document.getElementById('search-location-btn').onclick = function() { var input = document.getElementById('search-input'); google.maps.event.trigger(input, 'focus', {}); google.maps.event.trigger(input, 'keydown', { keyCode: 13 }); google.maps.event.trigger(this, 'focus', {}); };

MR.DOLLAR (2024)

References

Top Articles
Latest Posts
Article information

Author: Lidia Grady

Last Updated:

Views: 5745

Rating: 4.4 / 5 (65 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Lidia Grady

Birthday: 1992-01-22

Address: Suite 493 356 Dale Fall, New Wanda, RI 52485

Phone: +29914464387516

Job: Customer Engineer

Hobby: Cryptography, Writing, Dowsing, Stand-up comedy, Calligraphy, Web surfing, Ghost hunting

Introduction: My name is Lidia Grady, I am a thankful, fine, glamorous, lucky, lively, pleasant, shiny person who loves writing and wants to share my knowledge and understanding with you.