1function initMenu(SprachId, MenuOnr, Langs, StartseiteText, SucheText, StartSearch) { 2 document.addEventListener('DOMContentLoaded', function () { 3 if (document.querySelectorAll('.mobilemenudiv').length <= 0 && 4 ((document.querySelectorAll('li.TreeView-Root').length > 0 && document.querySelector('li.TreeView-Root').innerHTML.length > 0) || 5 (document.querySelectorAll('div[class^="Menu-"]').length > 0 && document.querySelector('div[class^="Menu-"]').innerHTML.length > 0) || 6 (document.querySelectorAll('div[class^="megamenu"]').length > 0 && document.querySelector('div[class^="megamenu"]').innerHTML.length > 0))) { 7 8 var isMenu = false; 9 var isMegaMenu = false; 10 11 if (document.querySelector('div[class^="Menu-"]') !== null) 12 isMenu = true; 13 if (document.querySelector('div[class^="megamenu"]') !== null) 14 isMegaMenu = true; 15 16 var mobilehtml = '<div class="TreeView none mobilemenudiv" style="display:none;"><nav><div id="pullnav"><div id="pull" role="button" tabindex="0" aria-expanded="false" aria-label="Menü"></div>'; 17 mobilehtml += '<div id="mobilityhome" class="mobilityhome"><a title="' + StartseiteText + '" href="' + envurl + 'system/web/default.aspx' + (SprachId > 0 ? '?sprache=' + SprachId : '') + '"><span class="mobilityiconhome"></span><span class="hide">' + StartseiteText + '</span></a></div>'; 18 19 if (Langs && Langs != null && Langs.length > 1) { 20 mobilehtml += '<div id="mobilitylang" class="mobilitylang">'; 21 22 Langs.forEach(function (v) { 23 if (v.sprachid == SprachId) { 24 var sprachid = v.sprachid; 25 var datei = v.datei; 26 if (datei.indexOf("dummy") >= 0) 27 mobilehtml += '<p class="mobilitycurrentlang" title="' + v.title + '"><span class="mobilityiconlang mobilityiconsprache' + sprachid + '">' + v.bez + '</span></p>'; 28 else 29 mobilehtml += '<p class="mobilitycurrentlang" title="' + v.title + '"><span class="mobilityiconlang mobilityiconsprache' + sprachid + '" style="background-image:url(\'' + envurl + 'system/web/images/icons/' + datei + '\');"></span></p>'; 30 return; 31 } 32 }); 33 Langs.forEach(function (v) { 34 if (v.sprachid != SprachId) { 35 var sprachid = v.sprachid; 36 var datei = v.datei; 37 var langlink = decodeURIComponent(v.langlink); 38 if (datei.indexOf("dummy") >= 0) 39 mobilehtml += '<p class="mobilityaltlang"><a href="' + langlink + '" title="' + v.title + '"><span class="mobilityiconlang mobilityiconsprache' + sprachid + '">' + v.bez + '</span></a></p>'; 40 else 41 mobilehtml += '<p class="mobilityaltlang"><a href="' + langlink + '" title="' + v.title + '"><span class="mobilityiconlang mobilityiconsprache' + sprachid + '" style="background-image:url(\'' + envurl + 'system/web/images/icons/' + datei + '\');"></span><span class="hide">' + v.bez + '</span></a></p>'; 42 } 43 }); 44 mobilehtml += '</div>'; 45 } 46 mobilehtml += '<div id="mobilitysearch" class="mobilitysearch"><form method="get" action="' + envurl + 'system/web/suche.aspx" id="mobilitysearchform" ><input type="hidden" value="' + SprachId + '" name="sprache"><input type="hidden" value="' + MenuOnr + '" name="menuonr"><input class="mobilitysearchinput" type="search" value="" name="search" id="mobilitysearchinput" title="' + SucheText + '" placeholder="' + SucheText + '"><input class="mobilitysearchsubmit" type="submit" title="' + StartSearch + '" value="' + StartSearch + '"><span class="mobilityiconsearch"></span></form></div>'; 47 mobilehtml += '</div><div id="mobilityspacer"></div> '; 48 49 if (isMenu) 50 mobilehtml += document.querySelector('div[class^="Menu-"]').innerHTML; 51 else if (isMegaMenu) { 52 var megamenuElement = document.querySelector('div[class^="megamenu"]'); 53 var megamenuhtml = megamenuElement.innerHTML; 54 megamenuhtml = megamenuhtml.replace(new RegExp("</div>", "g"), ""); 55 megamenuhtml = megamenuhtml.replace(new RegExp("</h3>", "g"), ""); 56 megamenuhtml = megamenuhtml.replace(new RegExp("<div class=\"mm-block forceHide\">", "g"), ""); 57 megamenuhtml = megamenuhtml.replace(new RegExp("<div\\s+[^>]*class\\s*=\\s*[\"'][^\"']*\\bmm-block\\b[^\"']*[\"'][^>]*>", "g"), ""); 58 megamenuhtml = megamenuhtml.replace(new RegExp("<div class=\"mm-row mm-row1\">", "g"), ""); 59 megamenuhtml = megamenuhtml.replace(new RegExp("<div class=\"mm-row mm-rowX\">", "g"), ""); 60 megamenuhtml = megamenuhtml.replace(new RegExp("<div\\s+[^>]*class\\s*=\\s*[\"'][^\"']*\\bmm-col\\b[^\"']*\\bmm-size25\\b[^\"']*[\"'][^>]*>", "g"), ""); 61 megamenuhtml = megamenuhtml.replace(new RegExp("<h3>", "g"), ""); 62 mobilehtml += megamenuhtml; 63 } 64 else { 65 var treeViewRoot = document.querySelector('li.TreeView-Root').parentElement; 66 mobilehtml += '<ul>' + treeViewRoot.innerHTML + '</ul>'; 67 } 68 69 mobilehtml += '</nav></div>'; 70 71 document.getElementById('header').insertAdjacentHTML('beforebegin', mobilehtml); 72 var firstNavUl = document.querySelector('.mobilemenudiv nav ul'); 73 firstNavUl.removeAttribute('class'); 74 firstNavUl.removeAttribute('id'); 75 76 if (isMenu || isMegaMenu) { 77 78 document.querySelectorAll('.mobilemenudiv [class^="MegaMenu"]').forEach(function (el) { 79 var classes = el.className.replace(/MegaMenu/ig, 'TreeView').replace(/WithChildren/ig, 'Parent').split(' '); 80 el.className = ''; 81
82 classes.forEach(function (cls) { 83 if (cls.indexOf('TreeView') >= 0 || cls.indexOf('ext-mp') >= 0) { 84 el.classList.add(cls); 85 } 86 }); 87 }); 88 document.querySelectorAll('.mobilemenudiv [class^="Menu"]').forEach(function (el) { 89 var classes = el.className.replace(/Menu/ig, 'TreeView').replace(/WithChildren/ig, 'Parent').split(' '); 90 el.className = ''; 91 92 classes.forEach(function (cls) { 93 if (cls.indexOf('TreeView') >= 0 || cls.indexOf('ext-mp') >= 0) { 94 el.classList.add(cls); 95 } 96 }); 97 }); 98 document.querySelectorAll('.mobilemenudiv [class^="forceHide"]').forEach(function (el) { 99 el.classList.remove("forceHide"); 100 }); 101 if (isMegaMenu) { 102 document.querySelectorAll('.mobilemenudiv ul li').forEach(function (el) { 103 var classes = el.className.split(' '); 104 el.className = ''; 105 classes.forEach(function (cls) { 106 if (cls.indexOf('ext-mp') >= 0 || cls.indexOf('MegaMenu-Expanded') >= 0 || cls.indexOf('MegaMenu-Selected') >= 0) { 107 el.classList.add(cls.replace("MegaMenu", "TreeView")); 108 } 109 }); 110 }); 111 112 document.querySelectorAll('.mobilemenudiv ul a').forEach(function (el) { 113 el.className = ''; 114 }); 115 } 116 117 document.querySelectorAll('.mobilemenudiv nav ul ul').forEach(function (el) { 118 el.classList.add('TreeView-Hide'); 119 }); 120 if (isMegaMenu) { 121 document.querySelectorAll('.mobilemenudiv .TreeView-Expanded > ul').forEach(function (el) { 122 el.classList.remove('TreeView-Hide'); 123 }); 124 } else { 125 document.querySelectorAll('.mobilemenudiv .TreeView-Expanded').forEach(function (el) { 126 var firstUl = el.querySelector('ul'); 127 if (firstUl) { 128 firstUl.classList.remove('TreeView-Hide'); 129 firstUl.querySelectorAll('.TreeView-Expanded ul').forEach(function (nestedUl) { 130 nestedUl.classList.remove('TreeView-Hide'); 131 }); 132 } 133 }); 134 } 135 136 if (document.querySelector('li.TreeView-Root ul') != null && document.querySelector('li.TreeView-Root ul').firstElementChild) { 137 var menulis = document.querySelector('.mobilemenudiv ul'); 138 var lastparent = menulis.lastElementChild.firstElementChild.innerHTML.replace(/\s/g, ''); 139 var selectedNode = (menulis.querySelector('li.TreeView-Expanded a') != null ? menulis.querySelector('li.TreeView-Expanded a').innerHTML.replace(/\s/g, '') : null); 140 var last = false; 141 var selectedFound = false; 142 143 document.querySelectorAll('li.TreeView-Root ul').forEach(function (el) { 144 if (last) { 145 var elem = el.firstElementChild; 146 menulis.appendChild(elem.cloneNode(true)); 147 } else { 148 if (el.firstElementChild.innerHTML.replace(/\s/g, '') == lastparent) { 149 last = true; 150 } else if (selectedNode != null && el.firstElementChild.innerHTML.replace(/\s/g, '') == selectedNode) { 151 selectedFound = true; 152 } 153 } 154 }); 155 156 if (!selectedFound && selectedNode != null && document.querySelector('li.TreeView-Root.TreeView-Expanded a').innerHTML.replace(/\s/g, '') == selectedNode) { 157 menulis.querySelector('li.TreeView-Expanded').innerHTML = document.querySelector('li.TreeView-Root.TreeView-Expanded').innerHTML; 158 } 159 } 160 } 161 else { 162 document.querySelectorAll('.mobilemenudiv [class^="TreeView"]').forEach(function (el) { 163 var classes = el.className.split(' '); 164 el.className = '';
165 classes.forEach(function (cls) { 166 if (cls.indexOf('TreeView') >= 0 || cls.indexOf('ext-mp') >= 0) { 167 el.classList.add(cls); 168 } 169 }); 170 }); 171 } 172 173 174 document.querySelector('.mobilemenudiv nav ul').style.display = 'none'; 175 document.querySelectorAll('.mobilemenudiv ul').forEach(function (ul) { 176 ul.classList.add('mobilityul'); 177 }); 178 document.querySelectorAll('.mobilemenudiv ul li').forEach(function (li) { 179 li.classList.add('mobilityli'); 180 }); 181 document.querySelectorAll('.mobilemenudiv li span').forEach(function (span) { 182 span.classList.add('mobilityspan'); 183 }); 184 document.querySelectorAll('.mobilemenudiv li a').forEach(function (a) { 185 a.classList.add('mobilitya'); 186 }); 187 document.querySelector('.mobilemenudiv').removeAttribute('style'); 188 document.querySelectorAll('.mobilemenudiv li a').forEach(function (a) { 189 var li = a.parentElement; 190 var ul = li.querySelector('ul:first-of-type'); 191 if (ul && !li.querySelector(':scope > span:first-of-type')) { 192 var span = document.createElement('span'); 193 var isExpanded = window.getComputedStyle(ul).display !== 'none'; 194 span.setAttribute('role', 'button'); 195 span.setAttribute('tabindex', '0'); 196 span.setAttribute('aria-expanded', isExpanded ? 'true' : 'false'); 197 span.classList.add(isExpanded ? 'TreeView-Collapse' : 'TreeView-Expand', 'mobilityspan'); 198 span.innerHTML = ' '; 199 a.before(span); 200 } 201 }); 202 203 if (document.querySelector(".mobilemenudiv nav ul").style.display === "block") { 204 document.querySelector(".mobilemenudiv nav ul").removeAttribute('aria-hidden'); 205 document.querySelectorAll(".mobilemenudiv nav ul a").forEach(function (a) { 206 a.removeAttribute("tabindex"); 207 }); 208 } else { 209 document.querySelector(".mobilemenudiv nav ul").setAttribute("aria-hidden", "true"); 210 document.querySelectorAll(".mobilemenudiv nav ul a").forEach(function (a) { 211 a.setAttribute("tabindex", "-1"); 212 }); 213 } 214 document.querySelectorAll('.mobilemenudiv li span:first-child').forEach(function (span) { 215 span.removeAttribute('onclick'); 216 }); 217 218 // document.addEventListener('DOMContentLoaded', function () { 219 var mobilitySpacer = document.getElementById('mobilityspacer'); 220 var pullNav = document.getElementById('pullnav'); 221 var pull = document.getElementById('pull'); 222 var mobileMenuDiv = document.querySelector('.mobilemenudiv'); 223 var mobileMenuNavUl = document.querySelector('.mobilemenudiv nav ul'); 224 225 function updateSpacerHeight() { 226 mobilitySpacer.style.height = pullNav.offsetHeight + 'px'; 227 } 228 229 updateSpacerHeight(); 230 window.addEventListener('resize', function () { 231 updateSpacerHeight(); 232 if (mobileMenuNavUl.style.display === 'block') { 233 mobileMenuNavUl.removeAttribute('aria-hidden'); 234 mobileMenuNavUl.querySelectorAll('a').forEach(function (a) { 235 a.removeAttribute('tabindex'); 236 }); 237 } else { 238 mobileMenuNavUl.setAttribute('aria-hidden', 'true'); 239 mobileMenuNavUl.querySelectorAll('a').forEach(function (a) { 240 a.setAttribute('tabindex', '-1'); 241 }); 242 } 243 }); 244 245 window.addEventListener('scroll', function () { 246 if (pullNav.style.position === 'fixed' && window.scrollY > 0) { 247 pull.classList.add('mobilitynavigator'); 248 } else { 249 pull.classList.remove('mobilitynavigator'); 250 } 251 }); 252 253 mobileMenuDiv.querySelectorAll('li span:first-child').forEach(function (span) { 254 if (span.parentElement.querySelector('ul') !== null) { 255 span.setAttribute('role', 'button'); 256 span.setAttribute('tabindex', '0'); 257 span.setAttribute('aria-expanded', span.classList.contains('TreeView-Collapse') ? 'true' : 'false'); 258 } 259 span.addEventListener('click', function () { 260 if (span.classList.contains('TreeView-Collapse')) { 261 span.classList.remove('TreeView-Collapse'); 262 span.classList.add('TreeView-Expand'); 263 span.setAttribute('aria-expanded', 'false'); 264 if (isMegaMenu) { 265 span.parentElement.querySelectorAll(':scope > ul').forEach(function (ul) { 266 ul.classList.add('TreeView-Hide'); 267 }); 268 } else { 269 span.parentElement.querySelector('ul:first-of-type').classList.add('TreeView-Hide'); 270 } 271 } else { 272 span.classList.remove('TreeView-Expand'); 273 span.classList.add('TreeView-Collapse'); 274 span.setAttribute('aria-expanded', 'true'); 275 if (isMegaMenu) { 276 span.parentElement.querySelectorAll(':scope > ul').forEach(function (ul) { 277 ul.classList.remove('TreeView-Hide'); 278 }); 279 } else { 280 span.parentElement.querySelector('ul:first-of-type').classList.remove('TreeView-Hide'); 281 } 282 } 283 }); 284 span.addEventListener('keydown', function (e) { 285 if (e.key === 'Enter' || e.key === ' ') { 286 e.preventDefault(); 287 span.click(); 288 } 289 }); 290 }); 291 292 pull.addEventListener('click', function (e) { 293 e.preventDefault(); 294 var mobilityLang = document.getElementById('mobilitylang'); 295 if (mobilityLang != null && mobilityLang.classList.contains('selected')) { 296 mobilityLang.classList.remove('selected'); 297 } 298 if (pullNav.style.position === 'fixed' && window.scrollY > 0) { 299 mobileMenuNavUl.style.display = 'block'; 300 mobileMenuNavUl.removeAttribute('aria-hidden'); 301 mobileMenuNavUl.querySelectorAll('a').forEach(function (a) { 302 a.removeAttribute('tabindex'); 303 }); 304 pull.setAttribute('aria-expanded', 'true'); 305 window.scrollTo(0, 0); 306 } else { 307 if (mobileMenuNavUl.style.display === 'block') { 308 mobileMenuNavUl.style.display = 'none'; 309 mobileMenuNavUl.setAttribute('aria-hidden', 'true'); 310 mobileMenuNavUl.querySelectorAll('a').forEach(function (a) { 311 a.setAttribute('tabindex', '-1'); 312 }); 313 pull.setAttribute('aria-expanded', 'false'); 314 } else { 315 mobileMenuNavUl.style.display = 'block'; 316 mobileMenuNavUl.removeAttribute('aria-hidden'); 317 mobileMenuNavUl.querySelectorAll('a').forEach(function (a) { 318 a.removeAttribute('tabindex'); 319 }); 320 pull.setAttribute('aria-expanded', 'true'); 321 } 322 window.scrollTo(0, 0); 323 } 324 }); 325 pull.addEventListener('keydown', function (e) { 326 if (e.key === 'Enter' || e.key === ' ') { 327 e.preventDefault(); 328 pull.click(); 329 } 330 }); 331 document.addEventListener('keydown', function (e) { 332 if (e.key === 'Escape' && mobileMenuNavUl.style.display === 'block') { 333 mobileMenuNavUl.style.display = 'none'; 334 mobileMenuNavUl.setAttribute('aria-hidden', 'true'); 335 mobileMenuNavUl.querySelectorAll('a').forEach(function (a) { 336 a.setAttribute('tabindex', '-1'); 337 }); 338 pull.setAttribute('aria-expanded', 'false'); 339 pull.focus(); 340 } 341 }); 342 // }); 343 } 344 345 function initMobilitySearchBox(id) { 346 var searchIcon = document.querySelector('#' + id + ' span.mobilityiconsearch'); 347 if (searchIcon) { 348 searchIcon.setAttribute('role', 'button'); 349 searchIcon.setAttribute('tabindex', '0'); 350 searchIcon.addEventListener('click', function (e) { 351 if (document.querySelector('#mobilitylang') != null && document.querySelector('#mobilitylang').classList.contains('selected')) { 352 document.querySelector('#mobilitylang').classList.remove('selected'); 353 } 354 var searchBox = document.querySelector('#' + id); 355 if (searchBox.classList.contains('mobilitysearchopen')) { 356 searchBox.classList.remove('mobilitysearchopen'); 357 var searchInput = searchBox.querySelector('form > input.mobilitysearchinput'); 358 if (searchInput != null && searchInput.value.trim() === '') { 359 searchInput.blur(); 360 e.preventDefault(); 361 } else { 362 searchBox.querySelector('form').submit(); 363 } 364 } else { 365 searchBox.classList.add('mobilitysearchopen'); 366 searchBox.querySelector('form > input.mobilitysearchinput').focus(); 367 e.preventDefault(); 368 } 369 }); 370 searchIcon.addEventListener('keydown', function (e) { 371 if (e.key === 'Enter' || e.key === ' ') { 372 e.preventDefault(); 373 searchIcon.click(); 374 } 375 }); 376 } 377 } 378 function initMobilityLangBox(id) { 379 if (document.querySelector('#' + id)) { 380 var langIcon = document.querySelector('#' + id + ' p.mobilitycurrentlang > span.mobilityiconlang'); 381 langIcon.setAttribute('role', 'button'); 382 langIcon.setAttribute('tabindex', '0'); 383 langIcon.addEventListener('click', function (e) { 384 var element = document.getElementById(id); 385 if (element.classList.contains('selected')) { 386 element.classList.remove('selected'); 387 } else { 388 element.classList.add('selected'); 389 } 390 }); 391 langIcon.addEventListener('keydown', function (e) { 392 if (e.key === 'Enter' || e.key === ' ') { 393 e.preventDefault(); 394 langIcon.click(); 395 } 396 }); 397 } 398 } 399 initMobilitySearchBox('mobilitysearch'); 400 initMobilityLangBox('mobilitylang'); 401 });
vendor: 1 bytes, line 402
402}
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.