Book Now
Your current location

Charlotte – Southend

2610 South Blvd.Charlotte, NC 28209(980) 308-0309
Studio Info

Charlotte – Elizabeth

2115 East 7th St., Suite 104Charlotte, NC 28204(980) 308-0360
Studio Info

Charlotte – NoDa

2315 North Davidson St.Charlotte, NC 28205(980) 944-4041
Studio Info
View All Locations
(function() {
    // Block JetEngine from requesting geolocation on load
    let blocked = false;
    const originalGeo = navigator.geolocation.getCurrentPosition;

    navigator.geolocation.getCurrentPosition = function(success, error, options) {
        // Block first auto-call (from JetEngine), allow future ones
        if (!blocked) {
            blocked = true;
            console.log("JetEngine geolocation auto-request blocked.");
            return;
        }

        // Allow manual calls (i.e. after user clicks the button)
        originalGeo.call(navigator.geolocation, success, error, options);
    };

    // Set up manual location trigger
    document.addEventListener("DOMContentLoaded", function() {
        const btn = document.getElementById("get-location-button");

        if (!btn) return;

        btn.addEventListener("click", function() {
            if (!navigator.geolocation) {
                alert("Geolocation is not supported.");
                return;
            }

            navigator.geolocation.getCurrentPosition(function(position) {
                const lat = position.coords.latitude;
                const lng = position.coords.longitude;

                console.log("User location acquired:", lat, lng);

                // Store location where JetEngine expects it
                window.JetEngineGeoData = {
                    lat: lat,
                    lng: lng,
                    timestamp: Date.now()
                };

                // Notify JetEngine to update geolocation filters
                document.dispatchEvent(new CustomEvent('jet-engine-geolocation-updated', {
                    detail: {
                        lat: lat,
                        lng: lng
                    }
                }));

                // Optionally refresh filters if using JetSmartFilters
                if (typeof JetSmartFilters !== 'undefined') {
                    // JetSmartFilters.filters.forEach(filter => filter.applyFilter());
                  Object.values(JetSmartFilters.filters).forEach(filter => {
                      if (typeof filter.applyFilter === 'function') {
                          filter.applyFilter();
                      }
                  });
                }

            }, function() {
                alert("Location access denied.");
            });
        });
    });
})();
setTimeout(function() {
  console.log('click');
  document.querySelector('.jsf-location-distance__location-locate').click();
}, 500); // 2000 milliseconds = 2 seconds
navigator.geolocation.getCurrentPosition(
  function success(position) {
    // They allowed location
    console.log('Location access granted');
  },
  function error(err) {
    if (err.code === err.PERMISSION_DENIED) {
      // This runs after they click "Never" or "Block"
      console.log('Location access denied');
      window.location.href = '/location-denied.html';
    }
  }
);