(function () { if (window.__medspaClinicLoaderLoaded) return; window.__medspaClinicLoaderLoaded = true; const apiKey = "your_api_key_here"; const apiUrl = "https://api.medspacircle.com/api/v1/"; //update const remoteCss = "https://api.medspacircle.com/embed/1/style.css"; //update const linkUrl = `https://go.medspacircle.com/clinics/`; //update const targetDiv = document.getElementById("MCLoader"); if (!targetDiv) { console.error('MCLoader element not found'); return; } const slug = targetDiv.getAttribute("data-slug-id"); const withmap = targetDiv.getAttribute("data-with-map"); const mapApiKey = targetDiv.getAttribute("data-map-api-key"); const mapZoomLevel = targetDiv.getAttribute("data-map-zoom-level"); const stackingView = targetDiv.getAttribute("data-stacking-view"); const locationTitle = targetDiv.getAttribute("data-location-title"); const showSchedule = targetDiv.getAttribute("data-schedule") ?? "true"; let theslug = []; let theUrlsToCall = []; let branchData = []; let asscociateCityAndClinic = []; let theMarkerLists = []; let counter = 0; var arr_dropdown = []; //to save city list if multiple slugs are used // Browser compatibility check function checkBrowserCompatibility() { const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent); const iOSVersion = isIOS ? parseFloat( navigator.userAgent.match(/OS (\d+)_(\d+)/)?.[1] + "." + navigator.userAgent.match(/OS (\d+)_(\d+)/)?.[2] ) : null; console.log("iOS detected:", isIOS, "Version:", iOSVersion); if (isIOS && iOSVersion && iOSVersion < 14.9) { console.warn( "This device may have limited compatibility. Consider updating iOS for the best experience." ); // Load dialog polyfill for older iOS versions if (typeof HTMLDialogElement === "undefined") { console.log("Loading HTMLDialogElement polyfill..."); const polyfillCSS = document.createElement("link"); polyfillCSS.rel = "stylesheet"; polyfillCSS.href = "https://cdn.jsdelivr.net/npm/dialog-polyfill@0.5.6/dist/dialog-polyfill.css"; document.head.appendChild(polyfillCSS); const polyfillJS = document.createElement("script"); polyfillJS.src = "https://cdn.jsdelivr.net/npm/dialog-polyfill@0.5.6/dist/dialog-polyfill.js"; polyfillJS.onload = function () { console.log("Dialog polyfill loaded"); // Register dialogs after polyfill loads const dialogs = document.querySelectorAll("dialog"); dialogs.forEach((dialog) => { if (typeof dialogPolyfill !== "undefined") { dialogPolyfill.registerDialog(dialog); } }); }; document.head.appendChild(polyfillJS); } } } // Call this before other initializations checkBrowserCompatibility(); //load remote stylesheet function loadRemoteStylesheet(url) { const linkElement = document.createElement("link"); linkElement.rel = "stylesheet"; linkElement.href = url; document.head.appendChild(linkElement); } function loadGoogleFont(fontFamily) { const linkElement = document.createElement("link"); linkElement.rel = "stylesheet"; linkElement.href = `https://fonts.googleapis.com/css2?family=${encodeURIComponent( fontFamily )}`; document.head.appendChild(linkElement); } function loadScript(url, callback) { var script = document.createElement("script"); script.type = "text/javascript"; if (script.readyState) { // IE script.onreadystatechange = function () { if ( script.readyState === "loaded" || script.readyState === "complete" ) { script.onreadystatechange = null; if (callback) { callback(); } } }; } else { // Others script.onload = function () { if (callback) { callback(); } }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); } // load momentjs loadScript( "https://cdn.jsdelivr.net/npm/moment@2.29.4/moment.min.js", function () { // Do something after the script has loaded } ); //loadRemoteStylesheet(remoteCss); //we load style directly // Create a