1const element = document.querySelector("#zamboni-manuals-content"); 2var scrollDirection = 'down'; 3element.addEventListener('wheel', function(event) { 4 if (event.deltaY < 0) { 5 scrollDirection = 'up'; 6 } else if (event.deltaY > 0) { 7 scrollDirection = 'down'; 8 } 9}); 10 11jQuery(document).ready(function(){ 12 13 if (jQuery('#toc-wrap').length > 0) { 14 15 var toc = document.getElementById('toc'); 16 var h2 = document.querySelectorAll("#zamboni-manuals-content h2"); 17 if (h2.length) { 18 19 var id = null; 20 var current = 'section-1'; // 'section-1'; 21 22 var tocStart = document.createElement("li"); 23 tocStart.innerHTML = 'Jump to: '; 24 toc.appendChild(tocStart); 25 26 for (var i = 0; i < h2.length; i++) { 27 28 var li = document.createElement("li"); 29 var textContent = h2[i].textContent; 30 var linkedTextContent = '<a href="#section-' + (i + 1) + '">' + textContent + '</a>'; 31 32 li.innerHTML = linkedTextContent; 33 h2[i].setAttribute("id","section-" + (i + 1)); 34 toc.appendChild(li); 35 36 } 37 38 var observer = new IntersectionObserver( 39 function (entries) { 40 var delay = 0; 41 entries.forEach(function (entry) { 42 43 var el = entry.target; 44 var id = el.getAttribute('id'); // e.g. section-1 45 // console.log("ID: " + id); 46 var number = id.match(/\d+/g); 47 // console.log("Number: " + number); 48 49 if (entry.isIntersecting) { 50 console.log("Intersecting " + id + "..."); 51 // document.querySelector('#toc li a[href="#' + id + '"]').classList.add('active'); 52 53 if (scrollDirection == 'down') { 54 document.querySelector('#toc li a[href="#section-' + number + '"]').classList.add('active'); 55 if (number > 1) { 56 document.querySelector('#toc li a[href="#section-' + (number - 1) + '"]').classList.remove('active'); 57 } 58 } 59 60 } else { 61 62 console.log("Not intersecting " + id + " during scroll " + scrollDirection ); 63 // document.querySelector('#toc li a[href="#' + id + '"]').classList.remove('active'); 64 65 if (scrollDirection == 'up') { 66 document.querySelector('#toc li a[href="#section-' + number + '"]').classList.remove('active'); 67 if (number > 1) { 68 document.querySelector('#toc li a[href="#section-' + (number - 1) + '"]').classList.add('active'); 69 } 70 } 71 72 } 73 74 75 if ( current !== id ) { 76 77 console.log('Variable changed from section ' + current + ' to section ' + id); 78 79 jQuery("#toc li a").each(function() { 80 jQuery(this).removeClass("active"); 81 }); 82 document.querySelector('#toc li a[href="#' + id + '"]').classList.add('active'); 83 current = id; 84 85 } 86 87 88 }); 89 }, 90 { rootMargin: "0px 0px -50% 0px" } 91 ); 92 document.querySelectorAll("#zamboni-manuals-content h2").forEach(function (i) { 93 if (i) { 94 observer.observe(i); 95 } 96 }); 97 98 } 99 100 } 101 102 /* 103 var productCookie = readCookie('product'); 104 console.log("Product cookie: " + productCookie); 105 106 if (productCookie) { 107 jQuery('div.product-toc').hide(); 108 jQuery('#' + productCookie).show(); 109 jQuery("#product-toc-selector").val(productCookie); // Pre-select form if already selected previously 110 } 111 112 jQuery('#product-toc-selector').change(function() { 113 var selectedValue = jQuery(this).val(); 114 jQuery('div.product-toc').hide(); 115 jQuery('#' + selectedValue).show(); 116 createCookie('product', selectedValue, '365'); 117 }); 118 */ 119 120 if (jQuery('.wp-block-zamboni-manuals-zamboni-danger-block').length > 0) { 121 console.log("Article has danger(s)"); 122 jQuery('.wp-block-zamboni-manuals-zamboni-danger-block').each(function() { 123 jQuery(this).prepend('<div class="danger-label">DANGER!</div>'); 124 }); 125 } 126 127 if (jQuery('.wp-block-zamboni-manuals-zamboni-warning-block').length > 0) { 128 console.log("Article has warning(s)"); 129 jQuery('.wp-block-zamboni-manuals-zamboni-warning-block').each(function() { 130 jQuery(this).prepend('<div class="warning-label">WARNING!</div>'); 131 }); 132 } 133 134 if (jQuery('.wp-block-zamboni-manuals-zamboni-caution-block').length > 0) { 135 console.log("Article has caution(s)"); 136 jQuery('.wp-block-zamboni-manuals-zamboni-caution-block').each(function() { 137 jQuery(this).prepend('<div class="caution-label">CAUTION!</div>'); 138 }); 139 } 140 141 if (jQuery('.wp-block-zamboni-manuals-zamboni-dropbox-block').length > 0) { 142 console.log("Article has Dropbox embed(s)"); 143 jQuery('.wp-block-zamboni-manuals-zamboni-dropbox-block').each(function() { 144 var shareURL = jQuery(this).data('url'); 145 console.log("Share URL: " + shareURL); 146 jQuery(this).append('<small class="dropbox-embed-footer-utility"><a href="' + shareURL + '" download class="wp-block-file__button wp-element-button">Download</a> <a href="/owners-area/">See more downloads</a></small>'); 147 }); 148 } 149 150}); 151 152function createCookie(name, value, days) { 153 var expires; 154 if (days) { 155 var date = new Date(); 156 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 157 expires = "; expires=" + date.toGMTString(); 158 } else { 159 expires = ""; 160 } 161 document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/"; 162} 163 164function readCookie(name) { 165 var nameEQ = encodeURIComponent(name) + "="; 166 var ca = document.cookie.split(';'); 167 for (var i = 0; i < ca.length; i++) { 168 var c = ca[i]; 169 while (c.charAt(0) === ' ') 170 c = c.substring(1, c.length); 171 if (c.indexOf(nameEQ) === 0) 172 return decodeURIComponent(c.substring(nameEQ.length, c.length)); 173 } 174 return null; 175} 176
177function eraseCookie(name) { 178 createCookie(name, "", -1); 179}
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.