1// Fix bootstrap components 2(function($) { 3 4 // Accordion 5 $('.accordion-button').click(accordionPatch); 6 $('.accordion-button').each(accordionPatch); 7 8 function accordionPatch() { 9 $(this).closest('.accordion').find('.accordion-item').removeClass('expanded'); 10 if(!$(this).hasClass('collapsed')) { 11 $(this).closest('.accordion-item').addClass('expanded'); 12 } 13 } 14 15 16 $('.selectmenu').selectmenu(); 17 18 19 // console.log('dol:', $.selectmenu); 20 // if($.selectmenu){ 21 // console.log('smal'); 22 // }else{ 23 // console.log('qs:', document.querySelector('#jquery-ui-selectmenu-js')); 24 // document.querySelector('#jquery-ui-selectmenu-js').addEventListener('load', function() { 25 // console.log('jquery loaded'); 26 // // Dropdown - Select - Selectmenu (jQuery-ui) 27 // $('.selectmenu').selectmenu(); 28 // }); 29 // } 30 // console.log('load anyway s:', $('.selectmenu')); 31 // setTimeout(function(){ 32 33 // $('.selectmenu').selectmenu(); 34 // }, 0); 35 36 $('header .large-menu .bi-search, header .mobile-menu .bi-search').mouseenter(function() { 37 $(this).closest('form').addClass('expanded'); 38 }); 39 $('header .large-menu form, header .mobile-menu form').mouseleave(function() { 40 $(this).removeClass('expanded'); 41 }); 42 43 $('header .mobile-menu button.menu').click(function(){ 44 $(this).closest('.mobile-menu').addClass('expanded'); 45 }); 46 $('header .mobile-menu button.close').click(function(){ 47 $(this).closest('.mobile-menu').removeClass('expanded'); 48 }); 49 50 51 // Local navigation link list, mark active subelements 52 var subelementAnchors = []; 53 var subelements = $('.link-list .subelement a').each(function(){ 54 let splitted = $(this).attr('href')?$(this).attr('href').split('#'):[]; 55 if(splitted.length>1 && $('#'+splitted[1]).length>0){ 56 subelementAnchors.push($('#'+splitted[1])[0]); 57 } 58 }); 59 60 $(window).scroll(debounce(function(evt){ 61 let index = -1; 62 subelements.each(function(i, e){ 63 $(e).removeClass('active').parent().removeClass('active'); 64 }) 65 let woffset = (window.innerHeight/2)+window.scrollY; 66 subelementAnchors.forEach(function(el, i){ 67 if(getOffset(el).top<woffset){ 68 index=i; 69 } 70 }); 71 if(index>-1){ 72 $(subelements[index]).addClass('active').parent().addClass('active'); 73 } 74 }, 200)); 75 76 function getOffset(el) { 77 const rect = el.getBoundingClientRect(); 78 return { 79 left: rect.left + window.scrollX, 80 top: rect.top + window.scrollY 81 }; 82 } 83 84 $('.navigation.pagination .page-numbers.dots').click(function(){ 85 $(this).find('select').change(function(e){ 86 window.location.href=$(this).val(); 87 }); 88 }) 89 90 // Enable Bootstrap tooltips 91 var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) 92 var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { 93 return new bootstrap.Tooltip(tooltipTriggerEl) 94 }); 95 96 //Video player 97 $('.video-player .cover-image').click(function(){ 98 $(this).closest('.video-player').find('video').css('opacity', '1').get(0).play(); 99 $(this).hide(); 100 }); 101 102 // Fix Bootstrap not allowing links on accordions 103 $('.accordion-body a').click(function(e){ 104 window.location.href=e.target.href; 105 }); 106 107})(jQuery); 108 109 110function debounce(func, interval) { 111 var lastCall = -1; 112 return function() { 113 clearTimeout(lastCall); 114 var args = arguments; 115 var self = this; 116 lastCall = setTimeout(function() { 117 func.apply(self, args); 118 }, interval); 119 }; 120}
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.