1// Focus on Input Search 2focusMethod = function getFocus() { 3 document.querySelector('#search-support-input').focus(); 4} 5 6//Progress bar 7const progressBar = document.getElementById("blog-progress-bar"); 8const entryContent = document.querySelector("#main article"); 9 10if (progressBar !== null && entryContent !== null) { 11 let processScroll = () => { 12 const scrollTop = window.pageYOffset || document.documentElement.scrollTop; 13 const scrollHeight = entryContent.offsetHeight - window.innerHeight; 14 const scrollPercent = (scrollTop / scrollHeight) * 100 + "%"; 15 16 progressBar.style.setProperty("--scrollAmount", scrollPercent); 17 }; 18 document.addEventListener("scroll", processScroll); 19} 20 21//Helpscout Live Chat 22var isBeacon = document.getElementsByClassName('js-beacon'); 23if (isBeacon.length > 0) { 24 var FakeBeacon = { 25 init: function() { 26 document.querySelector('.js-beacon').addEventListener('click', function() { 27 FakeBeacon.load(this); 28 }); 29 }, 30 31 load: function(el) { 32 // Trigger beacon loading 33 FakeBeacon.loadScript(); 34 35 // Indicate that it's loading 36 el.classList.add('is-loading'); 37 38 // Once loaded, hide the fake beacon and open the real one 39 window.Beacon('once', 'ready', function() { 40 el.classList.add('d-none'); 41 window.Beacon('open'); 42 }); 43 44 // Once real beacon is closed, revert to the normal behavior 45 window.Beacon('on', 'close', function() { 46 el.classList.remove('d-none'); 47 }); 48 }, 49 50 loadScript: function() { 51 // Help Scout's original loading code 52 !function(e,t,n){function a(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://beacon-v2.helpscout.net",e.parentNode.insertBefore(n,e)}if(e.Beacon=n=function(t,n,a){e.Beacon.readyQueue.push({method:t,options:n,data:a})},n.readyQueue=[],"complete"===t.readyState)return a();e.attachEvent?e.attachEvent("onload",a):e.addEventListener("load",a,!1)}(window,document,window.Beacon||function(){}); 53 window.Beacon("init", globalScripts.mailbox); 54 Beacon("config", { 55 hideAvatars: true 56 } 57 ) 58 } 59 } 60 window.addEventListener("DOMContentLoaded", FakeBeacon.init); 61} 62 63//Modal Training Program 64jQuery(document).ready(function ($) { 65 // Function to open the modal 66 function openModal() { 67 $('#modal-training').modal('show'); 68 } 69 70 // Function to save the user's choice in a cookie 71 function saveChoice() { 72 // Set a cookie with an expiration of 30 days 73 var expirationDate = new Date(); 74 expirationDate.setDate(expirationDate.getDate() + 30); 75 document.cookie = "ModalUserChoice=1; expires=" + expirationDate.toUTCString() + "; path=/"; 76 } 77 78 // Open the modal when the user's intent to close the tab is detected 79 setTimeout(function() { 80 $(document).on('mouseleave', function (e) { 81 // Check if the user has previously made a choice 82 var userChoice = document.cookie.indexOf("ModalUserChoice="); 83 84 // Check if the mouse cursor is moving towards the top of the browser window 85 if (userChoice === -1 && e.clientY < 0) { 86 openModal(); 87 } 88 }); 89 }, 4000); 90 91 // Save the choice when clicking outside the modal 92 $('#modal-training').on('hide.bs.modal', function () { 93 saveChoice(); 94 }); 95 96 // Save the choice when clicking the close button 97 $('#modal-training').on('click', '.btn-close', function () { 98 saveChoice(); 99 }); 100 101 // Save the choice when submitting a form inside the modal 102 $('#modal-training').on('submit', 'form', function () { 103 saveChoice(); 104 }); 105});
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.