1jQuery(document).ready(function ($) { 2 jQuery('a').each(function () { 3 var a = new RegExp('/' + window.location.host + '/'); 4 if (!a.test(this.href) && this.href != '' && this.href.toLowerCase().indexOf("javascript") < 0 && this.target != '_self') { 5 jQuery(this).click(function (event) { 6 event.preventDefault(); 7 event.stopPropagation(); 8 window.open(this.href, '_blank'); 9 }); 10 } 11 }); 12}); 13 14(function () { 15 const cookieName = 'anonymous_id'; 16 17 function getCookie(name) { 18 const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)')); 19 return match ? match[2] : null; 20 } 21 22 let anonId = getCookie(cookieName); 23 24 if (!anonId) { 25 // Try to get from localStorage 26 anonId = store.get(cookieName); 27 28 if (anonId) { 29 // Restore cookie from localStorage 30 document.cookie = cookieName + '=' + anonId + '; path=/; max-age=' + (365 * 24 * 60 * 60); 31 } 32 } else { 33 // Sync cookie to localStorage 34 store.set(cookieName, anonId); 35 } 36 37})(); 38 39 40jQuery(document).ready(function ($) { 41 42 function closeMegaMenu() { 43 $('#megaMenu').removeClass('open'); 44 $('#menuToggle .dropdown-arrow').removeClass('d-none'); 45 $('#menuToggle .dropdown-x').addClass('d-none'); 46 $('body').removeClass('hide-scrollbars'); 47 } 48 49 function openMegaMenu() { 50 $('#megaMenu').addClass('open'); 51 $('#menuToggle .dropdown-arrow').addClass('d-none'); 52 $('#menuToggle .dropdown-x').removeClass('d-none'); 53 $('body').addClass('hide-scrollbars'); 54 55 if (window.innerWidth >= 992) { 56 $('.menu-item').removeClass('active'); 57 $('.menu-item[data-panel="topics"]').addClass('active'); 58 $('#panelContent > div').addClass('d-none'); 59 $('#panel-topics').removeClass('d-none'); 60 } 61 } 62 63 $('#menuToggle').click(function () { 64 if ($('#megaMenu').hasClass('open')) { 65 closeMegaMenu(); 66 } else { 67 closeMiniMenu(); 68 openMegaMenu(); 69 } 70 }); 71 72 // close links inside panels 73 $(document).on('click', '.mega-close-link', function (e) { 74 e.preventDefault(); 75 closeMegaMenu(); 76 }); 77 78 // Existing click handlers remain the same 79 $('.menu-item-special').click(function (e) { 80 e.preventDefault(); 81 let panel = $(this).data('panel'); 82 83 $('#panelContent > div').addClass('d-none'); 84 $('#panel-' + panel).removeClass('d-none'); 85 $('.menu-item').removeClass('active'); 86 $(this).addClass('active'); 87 }); 88 89 $('.mobile-menu-item').click(function (e) { 90 e.preventDefault(); 91 let panel = $(this).data('panel'); 92 93 $('#mobile-main-menu').addClass('d-none'); 94 $('#mobile-subpanel').removeClass('d-none'); 95 96 let description = $('#mobile-' + panel + '-description').html(); 97 let body = $('#mobile-' + panel + '-body').html(); 98 99 $('#mobile-panel-description').html(description); 100 $('#mobile-panel-body').html(body); 101 }); 102 103 $('#mobile-back-btn').click(function () { 104 $('#mobile-subpanel').addClass('d-none'); 105 $('#mobile-main-menu').removeClass('d-none'); 106 $('#mobile-panel-description').html(''); 107 $('#mobile-panel-body').html(''); 108 }); 109 110 // MINI MENU toggle 111 function closeMiniMenu() { 112 $('#miniMenu').removeClass('open'); 113 $('#miniMenuToggle .icon-menu-2').removeClass('d-none'); 114 $('#miniMenuToggle .icon-x-close').addClass('d-none'); 115 $('body').removeClass('hide-scrollbars'); 116 } 117 118 function openMiniMenu() { 119 $('#miniMenu').addClass('open'); 120 $('#miniMenuToggle .icon-menu-2').addClass('d-none'); 121 $('#miniMenuToggle .icon-x-close').removeClass('d-none'); 122 $('body').addClass('hide-scrollbars'); 123 124 if (window.innerWidth >= 992) { 125 $('#miniMenu .menu-item').removeClass('active'); 126 $('#miniMenu .menu-item[data-panel="topics"]').addClass('active'); 127 $('#miniMenu #panelContent > div').addClass('d-none'); 128 $('#miniMenu #panel-topics').removeClass('d-none'); 129 } 130 } 131 132 $('#miniMenuToggle').click(function () { 133 if ($('#miniMenu').hasClass('open')) { 134 closeMiniMenu(); 135 } else { 136 // About to open mini â close mega first 137 closeMegaMenu(); 138 openMiniMenu(); 139 } 140 }); 141 142 // Desktop click: show specific panel inside miniMenu 143 $('#miniMenu .menu-item-special').click(function (e) { 144 e.preventDefault(); 145 let panel = $(this).data('panel'); 146 147 $('#miniMenu #panelContent > div').addClass('d-none'); 148 $('#miniMenu #panel-' + panel).removeClass('d-none'); 149 $('#miniMenu .menu-item').removeClass('active'); 150 $(this).addClass('active'); 151 }); 152 153 // Mobile submenu handling 154 $('#miniMenu .mobile-menu-item').click(function (e) { 155 e.preventDefault(); 156 let panel = $(this).data('panel'); 157 158 $('#miniMenu #mobile-main-menu').addClass('d-none'); 159 $('#miniMenu #mobile-subpanel').removeClass('d-none'); 160 161 let description = $('#miniMenu #mobile-' + panel + '-description').html(); 162 let body = $('#miniMenu #mobile-' + panel + '-body').html(); 163 164 $('#miniMenu #mobile-panel-description').html(description); 165 $('#miniMenu #mobile-panel-body').html(body); 166 }); 167 168 $('#miniMenu #mobile-back-btn').click(function () { 169 $('#miniMenu #mobile-subpanel').addClass('d-none'); 170 $('#miniMenu #mobile-main-menu').removeClass('d-none'); 171 $('#miniMenu #mobile-panel-description').html(''); 172 $('#miniMenu #mobile-panel-body').html(''); 173 }); 174}); 175 176 177document.addEventListener('DOMContentLoaded', function () { 178 var button = document.getElementById('miso-question-button'); 179 var input = document.getElementById('miso-question'); 180 181 if (!button || !input) { 182 return; 183 } 184 185 button.onclick = function () { 186 var inputValue = input.value || ''; 187 188 // Use localized home URL if available, otherwise fall back to root 189 var base = (typeof MISO !== 'undefined' && MISO.baseUrl) ? MISO.baseUrl : '/'; 190 191 window.location.href = base + 'ask?q=' + encodeURIComponent(inputValue); 192 }; 193}); 194 195 196var input = document.getElementById("miso-question"); 197 198input.addEventListener("keydown", function (event) { 199 // If the user presses the "Enter" key on the keyboard 200 if (event.key === "Enter") { 201 // Cancel the default action, if needed 202 event.preventDefault();
203 // Trigger the button element with a click 204 document.getElementById("miso-question-button").click(); 205 } 206}); 207 208 209(function () { 210 var cookieName = 'wpforms_submission_email'; 211 var domain = '.sapinsider.org'; 212 213 // Delete your marketing cookie 214 function deleteMarketingCookie() { 215 document.cookie = cookieName + '=; path=/; domain=' + domain + '; expires=Thu, 01 Jan 1970 00:00:00 GMT'; 216 console.log('Marketing cookie deleted'); 217 } 218 219 // Parse CookieYes consent string into an object 220 function parseCookieYesConsent(cookieValue) { 221 if (!cookieValue) return {}; 222 var consent = {}; 223 cookieValue.split(',').forEach(function (part) { 224 var kv = part.split(':'); 225 if (kv.length === 2) { 226 consent[kv[0]] = kv[1] === 'yes'; 227 } 228 }); 229 return consent; 230 } 231 232 // Check if marketing consent was given 233 function checkMarketingConsent() { 234 try { 235 var match = document.cookie.match(/(?:^|; )cookieyes-consent=([^;]+)/); 236 237 if (match) { 238 // Only act if CookieYes is installed 239 var consent = parseCookieYesConsent(decodeURIComponent(match[1])); 240 if (!consent.marketing && !consent.advertisement) { 241 deleteMarketingCookie(); 242 } 243 } else { 244 // CookieYes not installed â do nothing 245 console.log('CookieYes not detected, leaving cookie intact'); 246 } 247 } catch (err) { 248 console.warn('CookieYes consent check failed:', err); 249 } 250 } 251 252 // Run on page load 253 window.addEventListener('load', checkMarketingConsent); 254 255 // Respond to consent changes in real time 256 window.addEventListener('cookieyes_consent_update', function (e) { 257 var consent = e.detail || {}; 258 if (!consent.marketing && !consent.advertisement) { 259 deleteMarketingCookie(); 260 } 261 }); 262})(); 263 264 265 266// When setting topic 267document.addEventListener('click', function (e) { 268 const link = e.target.closest('a[href][data-top-level-term]'); 269 if (!link) return; 270 271 //e.preventDefault(); 272 const termSlug = link.getAttribute('data-top-level-term'); 273 274 // Set cookie for 30 days 275 document.cookie = "active_tlt=" + encodeURIComponent(termSlug) + 276 "; path=/; max-age=" + (60 * 60 * 24 * 30) + "; SameSite=Lax"; 277 278 // Add/update ?tlt param on the target URL 279 /* const url = new URL(link.href); 280 url.searchParams.set('tlt', termSlug); 281 window.location.href = url.toString(); */ 282}); 283 284// When clearing topic 285document.addEventListener('click', function (e) { 286 const clear = e.target.closest('.tlt-clear-filter'); 287 if (!clear) return; 288 289 e.preventDefault(); 290 291 // Always clear the cookie 292 document.cookie = "active_tlt=; path=/; max-age=0; SameSite=Lax"; 293 294 const mode = clear.getAttribute('data-tlt-clear-mode'); 295 296 /* if (mode === 'webinars') { 297 // Special case: go to the link's href (no pw=t), with cache buster 298 const url = new URL(clear.href, window.location.origin); 299 url.searchParams.delete('tlt'); 300 url.searchParams.set('_tltcb', Date.now().toString()); 301 window.location.href = url.toString(); 302 } else { 303 // Default behavior: reload current page 304 const url = new URL(window.location.href); 305 url.searchParams.delete('tlt'); 306 url.searchParams.set('_tltcb', Date.now().toString()); 307 window.location.href = url.toString(); 308 } */ 309 310 // New default behavior: go to home page (no cache-buster; front page sends no-cache headers) 311 window.location.href = '/'; 312}); 313 314 315 316 317 318document.addEventListener('DOMContentLoaded', function () { 319 320 function saveToCookie(data) { 321 document.cookie = "wpforms_autofill=" + encodeURIComponent(JSON.stringify(data)) + 322 "; path=/; max-age=" + (60 * 60 * 24 * 180); 323 } 324 325 // Listen to ALL WPForms submissions 326 document.querySelectorAll('.wpforms-form').forEach(function (form) { 327 form.addEventListener('submit', function () { 328 329 const fields = form.querySelectorAll('input[type="text"], input[type="email"], input[type="tel"], textarea'); 330 let storedData = {}; 331 332 fields.forEach(field => { 333 if (field.name && field.value.trim() !== "") { 334 storedData[field.name] = field.value.trim(); 335 } 336 }); 337 338 saveToCookie(storedData); 339 console.log("Saved WPForms data to cookie:", storedData); 340 }); 341 }); 342 343}); 344 345 346 347document.addEventListener('DOMContentLoaded', function () { 348 349 function getCookie(name) { 350 const value = `; ${document.cookie}`; 351 const parts = value.split(`; ${name}=`); 352 if (parts.length === 2) return decodeURIComponent(parts.pop().split(';').shift()); 353 } 354 355 const cookie = getCookie("wpforms_autofill"); 356 if (!cookie) return; 357 358 let savedValues = {}; 359 try { 360 savedValues = JSON.parse(cookie); 361 } catch { 362 return; 363 } 364 365 document.querySelectorAll('.wpforms-form').forEach(form => { 366 const fields = form.querySelectorAll('input[type="text"], input[type="email"], input[type="tel"], textarea'); 367 fields.forEach(field => { 368 if (field.name && savedValues[field.name] && !field.value) { 369 field.value = savedValues[field.name]; 370 } 371 }); 372 }); 373 374}); 375 376/** 377 * GA4 (via GTM dataLayer) + Microsoft Clarity â lead events (WPForms AJAX or auto-submit AJAX). 378 * GTM: add a trigger on custom event name `wpforms_lead_submit`. 379 * Cookie `sapinsider_utm` is set by the theme (first-touch UTMs). 380 * Exposed globally for wis-brevo `submit_wp_form_click` (does not fire wpformsAjaxSubmitSuccess). 381 */ 382(function () { 383 function getCookie(name) { 384 const value = `; ${document.cookie}`; 385 const parts = value.split(`; ${name}=`); 386 if (parts.length === 2) { 387 return decodeURIComponent(parts.pop().split(';').shift()); 388 } 389 return null; 390 } 391 392 function parseSapinsiderUtmCookie() { 393 const raw = getCookie('sapinsider_utm'); 394 if (!raw) { 395 return {}; 396 } 397 try { 398 const o = JSON.parse(raw); 399 if (Array.isArray(o)) { 400 const latest = o.length > 0 ? o[o.length - 1] : null; 401 if (latest && typeof latest === 'object' && latest.utm && typeof latest.utm === 'object') { 402 return Object.assign({}, latest.utm, { utm_history_count: o.length }); 403 } 404 return {}; 405 } 406 return typeof o === 'object' && o !== null ? o : {}; 407 } catch (e) { 408 return {}; 409 } 410 } 411 412 window.sapinsiderPushWpformsLeadAnalytics = function (formId) { 413 window.dataLayer = window.dataLayer || []; 414 const utm = parseSapinsiderUtmCookie(); 415 const payload = Object.assign( 416 { 417 event: 'wpforms_lead_submit', 418 form_id: formId != null && formId !== '' ? String(formId) : '', 419 }, 420 utm 421 ); 422 window.dataLayer.push(payload); 423 424 if (typeof window.clarity === 'function') { 425 window.clarity('event', 'wpforms_lead_submit'); 426 } 427 }; 428 429 document.addEventListener('wpformsAjaxSubmitSuccess', function (event) { 430 const detail = event.detail || {}; 431 const d = detail.data || {}; 432 const formId = 433 detail.formId !== undefined && detail.formId !== null 434 ? detail.formId 435 : detail.form_id !== undefined 436 ? detail.form_id 437 : d.form_id !== undefined 438 ? d.form_id 439 : d.formId; 440 441 window.sapinsiderPushWpformsLeadAnalytics(formId); 442 }); 443})();
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.