};function runPageScript(){ function onDocumentReady(callback) { if (document.readyState === 'loading') { // If the document is still loading, wait for the DOMContentLoaded event document.addEventListener('DOMContentLoaded', function() { callback(); }); } else { // If the document is already loaded, execute the callback immediately callback(); } }//END FUNCTION function addCssSheet(cssUrl) { var linkElement = document.createElement('link'); linkElement.rel = 'stylesheet'; linkElement.type = 'text/css'; linkElement.href = cssUrl; document.head.appendChild(linkElement); }//END FUNCTION function isHomepage() { // Get the current URL var currentUrl = window.location.href; // Get the base URL of the website var baseUrl = window.location.protocol + "//" + window.location.host; // Check if the current URL is the same as the base URL return currentUrl === baseUrl; }//END FUNCTION function addCustomClass(element, classesToAdd) { // Ensure the element and classesToAdd parameters are provided if (element && classesToAdd) { // Split the classesToAdd string into an array of individual classes var classesArray = classesToAdd.split(' '); // Loop through the array and add each class to the element for (var i = 0; i < classesArray.length; i++) { var currentClass = classesArray[i]; // Check if the class is not already present before adding it if (!element.classList.contains(currentClass)) { element.classList.add(currentClass); } } } }//END FUNCTION function bodyHasClass(className) { // Get the body element var bodyElement = document.body; // Check if the body element has the specified class return bodyElement.classList.contains(className); }//END FUNCTION function addBodyClassesFromUrlPath() { // Get the current URL path var currentPath = window.location.pathname; // Remove leading slash if present currentPath = currentPath.replace(/^\//, ''); // Split the path into segments var pathSegments = currentPath.split('/'); // Add a class for each path segment to the body element for (var i = 0; i < pathSegments.length; i++) { var className = 'page-' + pathSegments[i]; document.body.classList.add(className); } }//END FUNCTION function appendHtmlToBody(htmlString) { document.body.insertAdjacentHTML('beforeend', htmlString); }//END FUNCTION function updateAttribute(selector, attributeName, attributeValue) { var element = document.querySelector(selector); if (element) { element.setAttribute(attributeName, attributeValue); } else { console.error('Element with selector ' + selector + ' not found.'); } }//END FUNCTION function innerPageStyles(){ var bodyElement = document.body; addCustomClass(bodyElement, 'innerpage listing'); addBodyClassesFromUrlPath(); /* appendHtmlToBody(innerpageStyles); */ }//END FUNCTION // Example usage var isHomePage = isHomepage(); // Example usage var bodyElement = document.body; // Replace 'exampleElement' with the actual ID of your element //BEGIN MAIN LOGIC /* if(isHomePage != true){ //is inner page addCustomClass(bodyElement, 'innerpage'); }else{ }//END ELSE IF */ onDocumentReady(function() { // Your code here will be executed when the DOM is fully loaded console.log('Document is ready!'); innerPageStyles(); let headerTimer = setInterval(() => { let headerReady = document.querySelector( 'body.innerpage .md-header.fashion .header-container .logo img' ); if (headerReady) { updateAttribute('body.innerpage .md-header.fashion .header-container .logo img', 'src', 'https://cy-chime-assets.s3.amazonaws.com/sites/geneseecountyliving.com/images/logo-full.png'); addCssSheet('https://cy-chime-assets.s3.amazonaws.com/sites/geneseecountyliving.com/carrie-innerpage-styles-2.css?v=1a'); //CLEAR INTERVAL clearInterval(headerTimer); }//END IF }, 100); //END INTERVAL });//END FUNCTION };