1function initFooter() { 2 const isNested = window.location.pathname.toLowerCase().includes('/workshops') || window.location.pathname.toLowerCase().includes('/regulatory-portal') || window.location.pathname.toLowerCase().includes('/blog'); 3 const prefix = isNested ? "../" : ""; 4 5 // 1. Create the footer container 6 const footerContainer = document.createElement("div"); 7 footerContainer.innerHTML = ` 8 <!-- Footer Start --> 9 <div class="container-fluid bg-dark text-light footer mt-5 pt-5 wow fadeIn" data-wow-delay="0.1s"> 10 <div class="container py-5"> 11 <div class="row g-5"> 12 <div class="col-lg-3 col-md-6"> 13 <h4 class="text-light mb-4">Address</h4> 14 <p class="mb-2"><i class="fa fa-map-marker-alt me-3"></i>DLF FORUM, Gurgaon, India</p> 15 <p class="mb-2"><i class="fa fa-phone-alt me-3"></i>+91 98101 64338</p> 16 <p class="mb-2"><i class="fa fa-envelope me-3"></i>[email protected]</p> 17 </div> 18 <div class="col-lg-3 col-md-6"> 19 <h4 class="text-light mb-4">Services</h4> 20 <a class="btn btn-link" href="${prefix}service.html?tab=cloud">Intelligent Cloud & Infrastructure</a> 21 <a class="btn btn-link" href="${prefix}service.html?tab=software">AI-Driven Software & Data Engineering</a> 22 <a class="btn btn-link" href="${prefix}service.html?tab=cybersecurity">Cognitive Cybersecurity & Compliance</a> 23 24 </div> 25 <div class="col-lg-3 col-md-6"> 26 <h4 class="text-light mb-4">Quick Links</h4> 27 <a class="btn btn-link" href="${prefix}about.html">About Us</a> 28 <a class="btn btn-link" href="${prefix}contact.html">Contact Us</a> 29 <a class="btn btn-link" href="${prefix}blog/index.html">Insights</a> 30 <a class="btn btn-link" href="${prefix}privacy-policy.html">Privacy Policy</a> 31 <a class="btn btn-link" href="#" id="cookieSettingsFooterBtn">Cookie Settings</a> 32 </div> 33 <div class="col-lg-3 col-md-6"> 34 <h4 class="text-light mb-4">Newsletter</h4> 35 <p>Stay ahead in a rapidly changing world.</p> 36 <form id="newsletterForm" novalidate> 37 <div class="input-group"> 38 <input type="email" id="subscriberEmail" class="form-control" placeholder="Your Email" required> 39 <button type="submit" id="subscribeBtn" class="btn btn-primary">Subscribe</button> 40 </div> 41 </form> 42 <p id="newsletterMessage" class="mt-2"></p> 43 <h6 class="text-light mt-4 mb-2">Follow Us</h6> 44 <div class="d-flex"> 45 <a class="btn btn-outline-light btn-social" href="https://www.linkedin.com/company/vibhank/" target="_blank"><i class="fab fa-linkedin-in"></i></a> 46 </div> 47 </div> 48 </div> 49 </div> 50 </div> 51 <!-- Footer End --> 52 `; 53 54 // 2. Append the footer to the body 55 document.body.appendChild(footerContainer); 56 57 // 3. ATTACH THE LOGIC HERE (After it's added to the DOM) 58 const newsletterForm = document.getElementById('newsletterForm'); 59 const emailInput = document.getElementById('subscriberEmail'); 60 const messageBox = document.getElementById('newsletterMessage'); 61 const subscribeBtn = document.getElementById('subscribeBtn'); 62 63 async function handleNewsletterSubmit(e) { 64 if (e) e.preventDefault(); // This is now handled correctly by the submit event 65 66 const email = emailInput.value.trim(); 67 68 if (!email || !email.includes('@')) { 69 messageBox.style.color = "#ff4d4d"; 70 messageBox.innerText = "Please enter a valid email address."; 71 return; 72 } 73 74 messageBox.style.color = "white"; 75 messageBox.innerText = "Subscribing..."; 76 subscribeBtn.disabled = true; // Use standard button disabling 77 78 try { 79 const apiPrefix = (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') 80 && window.location.port !== '4280' 81 ? 'http://localhost:7071' 82 : ''; 83 84 const response = await fetch(`${apiPrefix}/api/newsletter`, { 85 method: 'POST', 86 headers: { 'Content-Type': 'application/json' }, 87 body: JSON.stringify({ email: email }) 88 }); 89 90 if (response.ok) { 91 messageBox.style.color = "var(--primary-gold)"; 92 messageBox.innerText = "Success! You are subscribed."; 93 emailInput.value = ""; 94 } else { 95 const errText = await response.text(); 96 messageBox.style.color = "#ff4d4d"; 97 messageBox.innerText = `Error: ${errText || 'Please try again later.'}`; 98 } 99 } catch (err) { 100 messageBox.style.color = "#ff4d4d"; 101 messageBox.innerText = `Could not connect to server.`; 102 } finally { 103 subscribeBtn.disabled = false; 104 } 105 } 106 107 // Only listen to the form's submit event 108 if (newsletterForm) { 109 newsletterForm.addEventListener('submit', handleNewsletterSubmit); 110 } 111 112 // 4. Load Cookie Consent script dynamically 113 const cookieScript = document.createElement("script"); 114 cookieScript.src = `${prefix}js/cookies.js`; 115 document.body.appendChild(cookieScript); 116 117 // 5. Wire up the cookie settings link in the footer 118 const cookieLink = document.getElementById("cookieSettingsFo
118oterBtn"); 119 if (cookieLink) { 120 cookieLink.addEventListener("click", function (e) { 121 e.preventDefault(); 122 if (typeof window.openCookieSettings === "function") { 123 window.openCookieSettings(); 124 } 125 }); 126 } 127} 128 129if (document.readyState === "loading") { 130 document.addEventListener("DOMContentLoaded", initFooter); 131} else { 132 initFooter(); 133}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.