1/* 2 * tawk-lazy.js 3 * 4 * Defers loading of the Tawk.to chat widget until the first user interaction 5 * (scroll, click, pointermove, keydown, or touchstart). Keeps the initial page 6 * load fast â the Tawk embed is ~80 KB plus images/iframes that we don't want 7 * on the critical-render path of a marketing page. 8 * 9 * Once the widget loads it stays loaded for the rest of the SPA session. 10 * 11 * Property + Widget IDs were carried over from the old website (used pre-redesign). 12 * If they need to change, edit the TAWK_SRC constant below. 13 * 14 * CSP note: requires the following to be allow-listed in Program.cs CSP headers: 15 * script-src https://embed.tawk.to https://*.tawk.to 16 * connect-src https://*.tawk.to wss://*.tawk.to 17 * img-src https://*.tawk.to 18 * frame-src https://*.tawk.to 19 */ 20(function () { 21 'use strict'; 22 23 var TAWK_SRC = 'https://embed.tawk.to/5aad610ad7591465c708a85e/1fh01bqoa'; 24 var loaded = false; 25 26 function loadTawk() { 27 if (loaded) return; 28 loaded = true; 29 30 // Standard Tawk.to bootstrap block. The API object must exist before 31 // the embed script runs so any subsequent Tawk_API.* calls queue 32 // correctly until the widget initialises. 33 window.Tawk_API = window.Tawk_API || {}; 34 window.Tawk_LoadStart = new Date(); 35 36 var s1 = document.createElement('script'); 37 var s0 = document.getElementsByTagName('script')[0]; 38 s1.async = true; 39 s1.src = TAWK_SRC; 40 s1.charset = 'UTF-8'; 41 s1.setAttribute('crossorigin', '*'); 42 s0.parentNode.insertBefore(s1, s0); 43 44 // Tear down our triggers â they served their purpose. 45 triggers.forEach(function (t) { 46 window.removeEventListener(t, loadTawk, { passive: true }); 47 }); 48 document.removeEventListener('visibilitychange', visibilityTrigger); 49 } 50 51 var triggers = ['scroll', 'click', 'pointermove', 'keydown', 'touchstart']; 52 triggers.forEach(function (t) { 53 window.addEventListener(t, loadTawk, { once: true, passive: true }); 54 }); 55 56 // Also load when the tab is unhidden â handles the case where the visitor 57 // opened the page in a background tab and switches to it (no interaction yet). 58 function visibilityTrigger() { 59 if (document.visibilityState === 'visible') loadTawk(); 60 } 61 document.addEventListener('visibilitychange', visibilityTrigger); 62 63 // Hard fallback: load after 8 seconds regardless, so the bubble is 64 // available on slow / "read but don't scroll" sessions. 65 setTimeout(loadTawk, 8000); 66})();
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.