1function showHideContent() { 2 3 let blockClassList = ["wp-block-button", "wp-block-image", "wp-block-group"]; 4 5 let main = document.getElementById("primary"); 6 7 if (typeof (main) != 'undefined' && main != null) { 8 9 let domElementList = []; 10 11 let contentParagraphs = main.getElementsByTagName("p"); 12 13 for (let i = 0; i < contentParagraphs.length; i++) { 14 if (contentParagraphs[i].dataset.status && contentParagraphs[i].dataset.startTime) { 15 domElementList.push(contentParagraphs[i]) 16 } 17 } 18 19 blockClassList.forEach(item => { 20 21 let content = main.getElementsByClassName(item); 22 23 for (let i = 0; i < content.length; i++) { 24 if (content[i].dataset.status && content[i].dataset.startTime) { 25 domElementList.push(content[i]) 26 } 27 } 28 }) 29 30 if (domElementList.length !== 0) { 31 for (let i = 0; i < domElementList.length; i++) { 32 if (domElementList[i].dataset.status && domElementList[i].dataset.startTime) { 33 let status = domElementList[i].dataset.status; 34 let unixStartTime = domElementList[i].dataset.startTime; 35 let unixEndTime = domElementList[i].dataset.endTime; 36 let now = new Date(); 37 let offsetInMs = now.getTimezoneOffset() * 60000; // convert minutes to milliseconds 38 let currentUnixTime = Math.floor( new Date(new Date().getTime() - offsetInMs).getTime() / 1000) 39 40 if (unixEndTime !== undefined) { 41 if (status === 'show') { 42 if (unixEndTime >= currentUnixTime && currentUnixTime >= unixStartTime) { 43 domElementList[i].style.display = 'block'; 44 } else { 45 domElementList[i].style.display = 'none'; 46 } 47 } else if (status === 'hide') { 48 if (unixEndTime >= currentUnixTime && currentUnixTime >= unixStartTime) { 49 domElementList[i].style.display = 'none'; 50 } else { 51 domElementList[i].style.display = 'block'; 52 } 53 } else if (status === 'none') { 54 domElementList[i].style.display = 'block'; 55 } 56 } else { 57 if (status === 'show') { 58 domElementList[i].style.display = 'none'; 59 if (currentUnixTime >= unixStartTime) { 60 domElementList[i].style.display = 'block'; 61 } 62 } else if (status === 'hide') { 63 domElementList[i].style.display = 'block'; 64 if (currentUnixTime >= unixStartTime) { 65 domElementList[i].style.display = 'none'; 66 } 67 } else if (status === 'none') { 68 domElementList[i].style.display = 'block'; 69 } 70 } 71 } 72 } 73 } 74 75 } 76 77} 78 79window.addEventListener("load", showHideContent); 80 81; 82 83function hamburgerOnClick() { 84 let main = document.getElementById('primary'); 85 let footer = document.getElementsByClassName('gb-footer'); 86 let hamburger_button = document.getElementById('hamburger'); 87 let nav_container = document.getElementById('off-canvas-nav'); 88 89 if(hamburger_button.classList.contains('is-active') && nav_container.classList.contains('open')) { 90 hamburger_button.classList.remove('is-active'); 91 nav_container.classList.remove('open'); 92 main.classList.remove('open'); 93 footer[0].classList.remove('open'); 94 } else { 95 hamburger_button.classList.add('is-active'); 96 nav_container.classList.add('open'); 97 main.classList.add('open'); 98 footer[0].classList.add('open'); 99 } 100} 101 102let acc = document.getElementsByClassName('btn-accordion-trigger'); 103 104let firstAccordion; 105let firstPanel; 106 107if(acc.length > 0) { 108// Open the first accordion 109 firstAccordion = acc[0]; 110 firstPanel = firstAccordion.nextElementSibling; 111} 112 113// firstAccordion.classList.add("active"); 114// firstPanel.style.maxHeight = firstPanel.scrollHeight + "px"; 115
116// Add onclick listener to every accordion element 117for (let i = 0; i < acc.length; i++) { 118 acc[i].onclick = function() { 119 120 // For toggling purposes detect if the clicked section is already "active" 121 let isActive = this.classList.contains("active"); 122 123 // Close all accordions 124 let allAccordions = document.getElementsByClassName("btn-accordion-trigger"); 125 126 let j; 127 128 for (j = 0; j < allAccordions.length; j++) { 129 130 // Remove active class from section header 131 allAccordions[j].classList.remove("active"); 132 133 // Remove the max-height class from the panel to close it 134 let panel = allAccordions[j].nextElementSibling; 135 136 let maxHeightValue = getStyle(panel, "maxHeight"); 137 138 if (maxHeightValue !== "0px") { 139 panel.style.maxHeight = null; 140 } 141 } 142 143 144 // Toggle the clicked section using a ternary operator 145 isActive ? this.classList.remove("active") : this.classList.add("active"); 146 147 // Toggle the panel element 148 let panel = this.nextElementSibling; 149 let maxHeightValue = getStyle(panel, "maxHeight"); 150 151 if (maxHeightValue !== "0px") { 152 panel.style.maxHeight = null; 153 } else { 154 panel.style.maxHeight = panel.scrollHeight + "px"; 155 } 156 }; 157} 158 159// Cross-browser way to get the computed height of a certain element. Credit to @CMS on StackOverflow (http://stackoverflow.com/a/2531934/7926565) 160function getStyle(el, styleProp) { 161 var value, defaultView = (el.ownerDocument || document).defaultView; 162 // W3C standard way: 163 if (defaultView && defaultView.getComputedStyle) { 164 // sanitize property name to css notation 165 // (hypen separated words eg. font-Size) 166 styleProp = styleProp.replace(/([A-Z])/g, "-$1").toLowerCase(); 167 return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); 168 } else if (el.currentStyle) { // IE 169 // sanitize property name to camelCase 170 styleProp = styleProp.replace(/\-(\w)/g, function(str, letter) { 171 return letter.toUpperCase(); 172 }); 173 value = el.currentStyle[styleProp]; 174 // convert other units to pixels on IE 175 if (/^\d+(em|pt|%|ex)?$/i.test(value)) { 176 return (function(value) { 177 var oldLeft = el.style.left, oldRsLeft = el.runtimeStyle.left; 178 el.runtimeStyle.left = el.currentStyle.left; 179 el.style.left = value || 0; 180 value = el.style.pixelLeft + "px"; 181 el.style.left = oldLeft; 182 el.runtimeStyle.left = oldRsLeft; 183 return value; 184 })(value); 185 } 186 return value; 187 } 188} 189 190 191 192;
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.