1$(document).ready(function () { 2 if (window.APP_CONFIG.base.currentCatgoryId == '') { 3 return; 4 } 5 ['sub', 'nav'].forEach(navigationType => { 6 let isMobile = 'nav' == navigationType; 7 getTree(window.APP_CONFIG.base.currentCatgoryId).forEach(categoryId => { 8 let template = generateCategoryTemplate(categoryId, isMobile); 9 if (template.length > 0 ) { 10 $('#' + navigationType + '_' + categoryId).html(generateCategoryTemplate(categoryId, isMobile)); 11 $('#' + navigationType + '_' + categoryId).collapse('show'); 12 } 13 }); 14 }); 15 }); 16$('.main-link').hover(function () { 17 $(getMainNavigationSubCategoryHtml($(this).data('category-id'))).appendTo(this); 18 }, function(){ 19 $(this).find('.navigation-flyout').remove(); 20 }); 21$('.responsive-navigation-layer').on('click', '.category_subcat_btn', function (e) { 22 triggerShow($(this), true) 23 }); 24$('.box-body').on('click', '.category_subcat_btn', function (e) { 25 triggerShow($(this), false) 26 }); 27function getSubCategories(categoryId) { 28 let result = []; 29 dynoCat[categoryId].subCats.forEach(subCatId => result.push(dynoCat[subCatId])); 30 return result; 31 } 32function getTree(categoryId) { 33 let resultCategories = []; 34 while (categoryId) { 35 if (dynoCat[categoryId] !== undefined) { 36 resultCategories.push(dynoCat[categoryId]); 37 categoryId = dynoCat[categoryId].parent; 38 } else { 39 break; 40 } 41 } 42 resultCategories.sort((a,b) => (a.level > b.level) ? 1 : ((b.level > a.level) ? -1 : 0)); 43 let result = []; 44 resultCategories.forEach(category => result.push(category.id)) 45 return result; 46 } 47function triggerShow(elem, isMobile) { 48 let prefix = isMobile ? 'nav' : 'sub' 49 let categoryId = $(elem).data('bs-target').split(prefix + '_')[1]; 50 let targetElement = $('#' + prefix + '_' + categoryId) 51 if (targetElement.children().length < 1) { 52 targetElement.html(generateCategoryTemplate(categoryId, isMobile)); 53 } 54 } 55function getSidebarFilterData() { 56 let result = []; 57 for (let categoryId in dynoCat) { 58 result.push({ 59 value: dynoCat[categoryId].name, 60 data: dynoCat[categoryId].url 61 }); 62 } 63 return result; 64 } 65function getMainNavigationSubCategoryHtml(parentCategoryId) { 66 let parentCategory = dynoCat[parentCategoryId]; 67 let subCategories = ''; 68 if (parentCategory === undefined || parentCategory.subCats === undefined) { 69 return ''; 70 } 71 parentCategory.subCats.forEach(function (e, i) { 72 let subCategory = dynoCat[e]; 73 if (subCategory.linkMasked) { 74 subCategories += ` <ul class="col-md-12 col-lg-6"> 75 <li> 76 <span id="category-id-${subCategory.id}" title="${subCategory.linkTitle}" alt="${subCategory.linkAltText}" data-href="${subCategory.url}" rel="${subCategory.indexFollow}"> 77 ${subCategory.name} 78 </span> 79 </li> 80 </ul> 81`; 82 } 83 else { 84 subCategories += ` <ul class="col-md-12 col-lg-6"> 85 <li> 86 <a id="category-id-${subCategory.id}" title="${subCategory.linkTitle}" alt="${subCategory.linkAltText}" href="${subCategory.url}" rel="${subCategory.indexFollow}"> 87 ${subCategory.name} 88 </a> 89 </li> 90 </ul> 91`; 92 } 93 }); 94 let navigationTemplate = ` <div class="navigation-flyout container dropdown" data-parent-category-id="${parentCategoryId}"> 95 <div class="row content"> 96 <div class="col-md-1 cat-bg"> 97 <div class="row left-container"> 98 <div class="title-banner"> 99 <span>${parentCategory.name}</span> 100 </div> 101 </div> 102 </div> 103 <div class="col-md-11 links"> 104 <h4>${parentCategory.name}</h4> 105 <div class="row no-margin"> 106 ${subCategories} 107 </div> 108 </div> 109 </div> 110 </div> 111`; 112 if (parentCategory.subCats.length > 0) { 113 return navigationTemplate; 114 } 115 } 116function generateCategoryTemplate(currentCategory, isMobile) { 117 let html = ''; 118 let prefix = isMobile ? 'nav' : 'sub'
119 getSubCategories(currentCategory).forEach(subCategory => { 120 let isActive = ''; 121 if (subCategory.id == window.APP_CONFIG.base.currentCatgoryId) { 122 isActive = 'active' 123 } 124 let link = `<a tabindex="-1" title="${subCategory.linkTitle}" alt="${subCategory.linkAltText}" href="${subCategory.url}" rel="${subCategory.indexFollow}" class="overcat">${subCategory.name}</a>`;; 125 if (subCategory.linkMasked) { 126 link = `<span tabindex="-1" title="${subCategory.linkTitle}" alt="${subCategory.linkAltText}" data-href="${subCategory.url}" rel="${subCategory.indexFollow}" class="overcat">${subCategory.name}</span>`; 127 } 128 let noSubTemplate = ` 129 <div class="category level_${subCategory.level} ${isActive}" id="${prefix}_${subCategory.id}"> 130 <button tabindex="-1" class="nochilds" aria-label="${subCategory.linkTitle}"> 131 <i class="fa fa-navigation fa-fw"></i> 132 </button> 133 ${link} 134 </div> 135 ` 136 let subTemplate = ` 137 <div class="wrapper"> 138 <div class="category level_${subCategory.level} ${isActive}" id="label_${prefix}_${subCategory.id}"> 139 <button tabindex="-1" class="collapsed category_subcat_btn" data-bs-toggle="collapse" aria-label="Kategorie ein- oder ausklappen" data-bs-target="#${prefix}_${subCategory.id}" aria-hidden="true" aria-expanded="false"> 140 <i class="fas fa-caret-right fa-fw nav-right"></i> 141 <i class="fas fa-caret-down fa-fw nav-down"></i> 142 </button> 143 ${link} 144 </div> 145 <div class="collapse" id="${prefix}_${subCategory.id}" aria-expanded="false"></div> 146 </div> 147 ` 148 html += (subCategory.subCats.length > 0) ? subTemplate : noSubTemplate; 149 }); 150 return html; 151 }
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.