1(function (Drupal) { 2 'use strict'; 3 4 window.addEventListener('load', function () { 5 document.querySelectorAll('.tabs .tab').forEach(e => { 6 e.addEventListener('click', (ev) => { 7 const currentActive = e.parentElement.querySelector('.active'); 8 if (currentActive) currentActive.classList.remove('active'); 9 e.classList.add('active'); 10 11 const contentActive = e.parentElement.parentElement.querySelector('.tab-content .active'); 12 if (contentActive) contentActive.classList.remove('active'); 13 14 const targetContent = document.getElementById(e.dataset.for); 15 if (targetContent) targetContent.classList.add('active'); 16 }); 17 }); 18 19 document.querySelectorAll('#tabs-select').forEach(e => { 20 e.addEventListener('change', (ev) => { 21 var selectedValue = ev.target.value; 22 var tabContainer = ev.target.parentElement; 23 var contentContainer = tabContainer.querySelector('.tab-content'); 24 25 if (contentContainer) { 26 const activeContent = contentContainer.querySelector('.active'); 27 if (activeContent) activeContent.classList.remove('active'); 28 } 29 30 const newActive = document.getElementById(selectedValue); 31 if (newActive) newActive.classList.add('active'); 32 }) 33 }); 34 }); 35 36 document.addEventListener('DOMContentLoaded', function () { 37 const selectElement = document.getElementById('tabs-selection'); 38 const loadingIndicator = document.getElementById('loadingIndicator'); 39 40 if (selectElement) { 41 selectElement.addEventListener('change', function () { 42 if (loadingIndicator) { 43 loadingIndicator.classList.remove('hidden'); 44 } 45 46 document.body.offsetHeight; 47 48 const selectedOption = this.options[this.selectedIndex]; 49 const url = selectedOption.getAttribute('data-url'); 50 51 if (url) { 52 setTimeout(() => { 53 window.location.href = url; 54 }, 500); 55 } else if (loadingIndicator) { 56 setTimeout(() => { 57 loadingIndicator.classList.add('hidden'); 58 }, 1500); 59 } 60 }); 61 } 62 }); 63 64 // INBOX TABLES 65 var inboxTab = document.querySelectorAll(".inbox-tab"); 66 var inboxTables = document.querySelectorAll(".inbox-table"); 67 inboxTab.forEach(inbox => { 68 inbox.addEventListener("click", function () { 69 inboxTab.forEach(element => { 70 element.classList.remove("inbox-tab-active") 71 }); 72 var hiddenInboxTable = document.querySelector(`.${inbox.getAttribute('data-name')}`); 73 inbox.classList.add("inbox-tab-active") 74 inboxTables.forEach(item => { 75 item.classList.add("hidden"); 76 }); 77 if (hiddenInboxTable) hiddenInboxTable.classList.remove("hidden"); 78 }) 79 }); 80 81 // OPTIONS TABS 82 var options2a = document.querySelectorAll(".option-hidden"); 83 var options = document.querySelectorAll(".option"); 84 85 // Helper: activate a tab by its data-name. 86 function activateEventTab(dataName) { 87 if (!options.length) return; 88 89 options.forEach(function (item) { item.classList.remove('tabs-view-2'); }); 90 options2a.forEach(function (el) { el.classList.remove('display-content'); }); 91 92 document.querySelectorAll('.option-content').forEach(function (el) { 93 el.classList.remove('display-content'); 94 el.classList.add('hidden'); 95 }); 96 97 var tab = document.querySelector('.option[data-name="' + dataName + '"]'); 98 if (tab) tab.classList.add('tabs-view-2'); 99 100 var subOption = document.querySelector('.option-' + dataName); 101 if (subOption) { 102 subOption.classList.add('display-content'); 103 subOption.classList.remove('hidden'); 104 } 105 var secondOption = document.querySelector('.option2-' + dataName); 106 if (secondOption) { 107 secondOption.classList.add('display-content'); 108 } 109 110 var mobileSelect = document.getElementById('options'); 111 if (mobileSelect) mobileSelect.value = dataName; 112 } 113 114 // Find a tab's data-name by matching its data-hash to the URL hash. 115 function getTabNameByHash(hash) { 116 if (!hash) return null; 117 var tab = document.querySelector('.option[data-hash="' + hash + '"]'); 118 return tab ? tab.getAttribute('data-name') : null; 119 } 120 121 if (options.length) { 122 options.forEach(item => { 123 item.addEventListener('click', function () { 124 var dataName = this.getAttribute('data-name'); 125 activateEventTab(dataName); 126 127 var boxes = document.querySelectorAll('.section-4-boxes');
128 boxes.forEach(aBox => { 129 aBox.classList.remove("tabs-view") 130 }) 131 132 var box = document.querySelector(`.${this.getAttribute('data-type')}`) 133 if (box) { 134 box.classList.add('tabs-view') 135 } 136 137 // Update URL hash. 138 var tabHash = this.getAttribute('data-hash'); 139 if (tabHash) { 140 history.replaceState(null, '', '#' + tabHash); 141 } else { 142 // General Info - remove hash. 143 history.replaceState(null, '', window.location.pathname + window.location.search); 144 } 145 }) 146 }); 147 148 // On page load: activate tab matching URL hash. 149 var initialHash = window.location.hash.replace('#', ''); 150 if (initialHash) { 151 var tabName = getTabNameByHash(initialHash); 152 if (tabName) { 153 activateEventTab(tabName); 154 } 155 } 156 157 // Handle browser back/forward. 158 window.addEventListener('hashchange', function () { 159 var hash = window.location.hash.replace('#', ''); 160 if (hash) { 161 var tabName = getTabNameByHash(hash); 162 if (tabName) activateEventTab(tabName); 163 } else { 164 activateEventTab('general'); 165 } 166 }); 167 } 168 169 var optionsId = document.getElementById("options"); 170 if (optionsId) { 171 optionsId.addEventListener("change", function () { 172 const selectedValue = this.value; 173 174 document.querySelectorAll(".option-content").forEach(div => { 175 div.classList.remove("display-content"); 176 div.classList.add('hidden'); 177 }); 178 179 document.querySelectorAll(".option-hidden").forEach(div => { 180 div.style.display = 'none'; 181 }); 182 183 const selectedSection = document.querySelector(`.option-${selectedValue}`); 184 const selectedSection2 = document.querySelector(`.option2-${selectedValue}`); 185 186 if (selectedSection) { 187 selectedSection.classList.add("display-content"); 188 selectedSection.classList.remove('hidden'); 189 } 190 if (selectedSection2) { 191 selectedSection2.style.display = 'block'; 192 } 193 194 // Update URL hash. 195 const selectedOption = this.options[this.selectedIndex]; 196 const tabHash = selectedOption ? selectedOption.getAttribute('data-hash') : ''; 197 if (tabHash) { 198 history.replaceState(null, '', '#' + tabHash); 199 } else { 200 history.replaceState(null, '', window.location.pathname + window.location.search); 201 } 202 203 // Sync desktop tabs. 204 options.forEach(function (opt) { 205 opt.classList.remove('tabs-view-2'); 206 if (opt.getAttribute('data-name') === selectedValue) { 207 opt.classList.add('tabs-view-2'); 208 } 209 }); 210 }); 211 } 212 213 function adjustHeaderForToolbar() { 214 if (window.innerWidth <= 610) { 215 const toolbarHeader = document.querySelector('.toolbar-vertical header'); 216 const trayHeader = document.querySelector('.toolbar-tray-open header'); 217 const header = document.querySelector('header'); 218 219 if (window.scrollY == 0) { 220 if (toolbarHeader) toolbarHeader.style.marginTop = '40px'; 221 if (trayHeader) trayHeader.style.marginTop = '120px'; 222 } else { 223 if (header) header.style.marginTop = '0'; 224 } 225 } 226 } 227 228 window.addEventListener("load", adjustHeaderForToolbar); 229 window.addEventListener("scroll", adjustHeaderForToolbar); 230 231 window.addEventListener("resize", (event) => { 232 if (window.innerWidth > 1023) { 233 document.body.classList.remove('fixed'); 234 } 235 }); 236 237 // Accessibility widget behavior - unchanged 238 if (typeof Drupal !== 'undefined') { 239 Drupal.behaviors = Drupal.behaviors || {}; 240 Drupal.behaviors.accessibilityWidget = { 241 attach: function (context) { 242 if (typeof AccessibilityWidget === 'undefined') { 243 return; 244 } 245 246 const once = Drupal.once || function (key, selector) { 247 const elements = document.querySelectorAll(selector); 248 return Array.from(elements).filter(el => !el.getAttribute(`data-${key}`)) 249 .map(el => { 250 el.setAttribute(`data-${key}`, 'true'); 251 return el; 252 }); 253 }; 254 255 once('accessibilityWidget', 'body', context).forEach(() => { 256 new AccessibilityWidget(); 257 }); 258 } 259 }; 260 } else { 261 document.addEventListener('DOMContentLoaded', () => { 262 if (typeof AccessibilityWidget !== 'undefined') { 263 new AccessibilityWidget(); 264 } 265 }); 266 } 267 268})(Drupal);
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.