Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
web
/
vhosts
/
www.shinegis.mu
/
htdocs
/
/srv/data/web/vhosts/www.shinegis.mu/htdocs/js.php
<?php include_once "functions/recaptcha.php"; ?> <script src="https://www.google.com/recaptcha/api.js?render=<?php echo $recaptcha_site_key; ?>"></script> <script src="<?= asset("js/bootstrap.bundle.min.js") ?>"></script> <script> document.addEventListener("DOMContentLoaded", () => { const slug = window.location.pathname; const header = document.querySelector('.header'); const overlayAnimate = document.querySelector('.overlay-animate'); const about = document.getElementById('about'); const ourTeamMembers = document.getElementById('our-team-members'); const joinUs = document.getElementById('join-us'); const sections = [about, ourTeamMembers, joinUs]; const linksNav = document.querySelectorAll('.links>a'); const linksNavArray = Array.from(linksNav); // fixed navbar const navbarEnglish = document.querySelector('.navbar'); window.addEventListener('scroll', () => { const positionHeader = header.getBoundingClientRect(); const positionNavbar = navbarEnglish.getBoundingClientRect(); if (positionNavbar.top < 0) { navbarEnglish.classList.add("fixed-navbar"); } else if (positionHeader.bottom >= 0) { navbarEnglish.classList.remove("fixed-navbar"); } }) linksNavArray.forEach(link => { link.addEventListener('click', () => { linksNavArray.forEach(a => { a.classList.remove('active'); }) link.classList.add("active"); }) }) // mobile navbar version const menuHamburger = document.querySelector(".menu-hamburger"); const navMobile = document.querySelector(".navbar-mobile"); const cross = document.querySelector('.cross'); const linksNavMobile = document.querySelectorAll(".links-mobile>a"); const linksNavMobileArray = Array.from(linksNavMobile); menuHamburger.addEventListener("click", () => { navMobile.style.display = "flex"; }) cross.addEventListener("click", () => { navMobile.style.display = "none"; }) linksNavMobileArray.forEach(linkMobile => { linkMobile.addEventListener("click", () => { navMobile.style.display = "none"; }) }) let scrollPosition = window.pageYOffset; if (slug === "/") { window.addEventListener('scroll', () => { const positionHeader = header.getBoundingClientRect(); let currentScale = overlayAnimate.style.transform ? parseFloat(overlayAnimate.style.transform?.split('(')[1]?.split(')')[0]) : 1.2501; if (positionHeader.top >= -window.innerHeight && positionHeader.bottom <= window.innerHeight) { const newScrollPosition = window.pageYOffset; if (newScrollPosition > scrollPosition) { const scaleValue = currentScale - 1 * 0.003; if (scaleValue > 1) { overlayAnimate.style.transform = `scale(${scaleValue})`; } } else { const scaleValue = currentScale + 1 * 0.005; if (scaleValue < 1.2501) { overlayAnimate.style.transform = `scale(${scaleValue})`; } } scrollPosition = newScrollPosition; } sections.forEach(section => { if (section.getBoundingClientRect().top <= 10 && section.getBoundingClientRect().top >= -400) { linksNavArray.forEach(link => { if (link.href.includes(section.id)) { linksNavArray.forEach(a => { a.classList.remove('active'); }) link.classList.add("active"); } }) } else if (positionHeader.bottom > 0) { linksNavArray.forEach(a => { a.classList.remove('active'); }) linksNavArray[0].classList.add("active"); } }) }) } }) </script> <!-- reCAPTCHA Form Handling --> <script> // Function to execute reCAPTCHA on all forms function executeRecaptcha(formName, submitButton) { if (typeof grecaptcha !== 'undefined') { try { grecaptcha.ready(function () { grecaptcha.execute('<?php echo $recaptcha_site_key; ?>', { action: formName }) .then(function (token) { document.getElementById('g-recaptcha-response-' + formName).value = token; console.log("reCAPTCHA token obtained successfully for " + formName); }) .catch(function (error) { console.error("reCAPTCHA execution error:", error); }); }); } catch (error) { console.error("Error in reCAPTCHA execution:", error); } } else { console.error("grecaptcha is undefined. Make sure the reCAPTCHA script is loaded properly."); } } // Initialize reCAPTCHA on all forms when page loads document.addEventListener('DOMContentLoaded', function () { // Contact form if (document.querySelector('button[name="contact"]')) { executeRecaptcha('contact'); // Set up form submission document.querySelector('button[name="contact"]').addEventListener('click', function (e) { if (!document.getElementById('g-recaptcha-response-contact').value) { e.preventDefault(); console.log("No reCAPTCHA token found, executing reCAPTCHA..."); executeRecaptcha('contact'); setTimeout(function () { console.log("Attempting to submit form after reCAPTCHA execution"); document.querySelector('button[name="contact"]').click(); }, 1500); // Increased timeout to ensure token is obtained } else { console.log("reCAPTCHA token found, form will submit normally"); } }); } // Devis form if (document.querySelector('button[name="devis"]')) { executeRecaptcha('devis'); // Set up form submission document.querySelector('button[name="devis"]').addEventListener('click', function (e) { if (!document.getElementById('g-recaptcha-response-devis').value) { e.preventDefault(); executeRecaptcha('devis'); setTimeout(function () { document.querySelector('button[name="devis"]').click(); }, 1000); } }); } // Pre-devis form (using input with name="devis") if (document.querySelector('button[name="devis2"]')) { executeRecaptcha('devis2'); // Set up form submission document.querySelector('button[name="devis2"]').addEventListener('click', function (e) { if (!document.getElementById('g-recaptcha-response-devis2').value) { e.preventDefault(); executeRecaptcha('devis2'); setTimeout(function () { document.querySelector('button[name="devis2"]').click(); }, 1000); } }); } // Pre-devis form (using input with name="devis") if (document.querySelector('button[name="precontact"]')) { executeRecaptcha('precontact'); // Set up form submission document.querySelector('button[name="precontact"]').addEventListener('click', function (e) { if (!document.getElementById('g-recaptcha-response-precontact').value) { e.preventDefault(); executeRecaptcha('precontact'); setTimeout(function () { document.querySelector('button[name="precontact"]').click(); }, 1000); } }); } // Any other forms can be added here following the same pattern }); // Refresh reCAPTCHA tokens every 90 seconds (tokens expire after 2 minutes) setInterval(function () { if (document.querySelector('button[name="contact"]')) { executeRecaptcha('contact'); } if (document.querySelector('button[name="devis"]')) { executeRecaptcha('devis'); } if (document.querySelector('button[name="devis2"]')) { executeRecaptcha('devis2'); } if (document.querySelector('button[name="precontact"]')) { executeRecaptcha('precontact'); } // Add other forms here }, 90000); </script>