1// JavaScript Document 2var baseURL = 'https://'+window.location.hostname+'/'; 3// lazy load home page video 4document.addEventListener('DOMContentLoaded', function() { 5 const placeholder = document.getElementById('youtube-module-placeholder'); 6 const template = document.getElementById('youtube-content-template'); 7 if(placeholder && template){ 8 const fragment = template.content; 9 const iframeElement = fragment.querySelector('iframe'); 10 if (iframeElement) { 11 const iframeSrc = iframeElement.getAttribute('src'); 12 //console.log('Iframe Source:', iframeSrc); 13 setTimeout(function() { 14 placeholder.innerHTML = ''; 15 placeholder.appendChild(iframeElement); 16 responsive_video_scale(); 17 //setTimeout(function(){ 18 template.remove(); 19 //},5000); 20 }, 2000); 21 } else { 22 console.log('Iframe not found within the template content.'); 23 } 24 } 25}); 26 27//lazy load background-image 28document.addEventListener("DOMContentLoaded", function() { 29 const lazyBackgrounds = document.querySelectorAll(".lazy-bg"); 30 31 if ("IntersectionObserver" in window) { 32 const observer = new IntersectionObserver(function(entries, observer) { 33 entries.forEach(function(entry) { 34 if (entry.isIntersecting) { 35 const lazyBg = entry.target; 36 const imageUrl = lazyBg.getAttribute("data-background"); 37 lazyBg.style.backgroundImage = imageUrl; 38 lazyBg.classList.add("loaded"); 39 observer.unobserve(lazyBg); 40 console.log(lazyBg); 41 } 42 }); 43 }, { 44 // Optional: load images when they are 100px away from the viewport 45 rootMargin: "60px" 46 }); 47 48 lazyBackgrounds.forEach(function(lazyBg) { 49 observer.observe(lazyBg); 50 }); 51 } else { 52 // Fallback for very old browsers (e.g., load all immediately) 53 lazyBackgrounds.forEach(function(lazyBg) { 54 lazyBg.style.backgroundImage = lazyBg.getAttribute("data-background"); 55 lazyBg.classList.add("loaded"); 56 }); 57 } 58}); 59 60(function($){ 61 $(document).ready(function(){ 62 //console.log($(window).width()); 63 if($(window).width() >= '1200'){ 64 //sticky navbar 65 window.onscroll = function() {activateBlock()}; 66 //dropdown nav 67 $('.nav-item').mouseover(function(){ 68 $('.dropdown-menu',$(this)).addClass('show'); 69 }).mouseout(function(){ 70 $('.dropdown-menu',$(this)).removeClass('show'); 71 }); 72 //search 73 $('.search').mouseover(function(){ 74 $('.search-input').toggle(); 75 }).mouseout(function(){ 76 $('.search-input').toggle(); 77 }); 78 } 79 $('input#searchword').on('keypress',function(e){ 80 if(e.which == 13 || e.keyCode == 13){ 81 $('button#search-go').click(); 82 } 83 }); 84 $('button#search-go').click(function(){ 85 var searchword = $('input#searchword').val(); 86 var Itemid = 121; 87 if(searchword && searchword.length > 3){ 88 searchword = searchword.replace(/\s/g, '%20'); 89 var url = baseURL+'index.php?Itemid='+Itemid+'&q='+searchword; 90 location.href = url; 91 } 92 }); 93 $('#play-button').on('click', function(ev) { 94 var video_url = $('input#video_url').val(); 95 $('iframe#video').attr('src',video_url); 96 97 $("#video")[0].src += "?autoplay=1"; 98 ev.preventDefault(); 99 $('.content-row.video img').fadeOut('slow'); 100 $('.content-row.video .overlay').fadeOut('slow'); 101 $('.content-row.video .video-container').fadeIn('slow'); 102 }); 103 if($('.nav-content').length){ 104 var hash = window.top.location.hash.substr(1); 105 if(hash){ 106 $('.nav-content a.active').removeClass('active'); 107 $('.nav-content a.'+hash).addClass('active'); 108 } 109 $('.nav-content a[href*="#"]:not([href="#"])').click(function (event) { 110 var nav_class = $(this).attr('class'); 111 //alert(nav_class); 112 event.preventDefault(); 113 $('html, body').animate({ 114 scrollTop: $($.attr(this, 'href')).offset().top - 225 115 }, 1000); 116 117 $('.nav-content a.active').removeClass('active'); 118 $('.nav-content .'+nav_class).addClass('active'); 119 }); 120 } 121 122 //if address bar has anchor, scroll to element 123 if(window.top.location.hash){ 124 scrollToID(window.top.location.hash); 125 } 126 //if anchor link clicked, scroll to elelent 127 $('#navbarNav ul li a').click(function(){ 128 setTimeout(()=>{ 129 if(window.top.location.hash){ 130 scrollToID(window.top.location.hash); 131 } 132 },10); 133 }); 134 $('.footer ul li a').click(function(){ 135 setTimeout(()=>{ 136 if(window.top.location.hash){ 137 scrollToID(window.top.location.hash); 138 } 139 },10); 140 }); 141 142 //scroll to top button 143 $('.scroll-up a').click(function(){ 144 $('html, body').animate({ 145 scrollTop: $('body').offset().top - 0 146 }, 1000); 147 }); 148 window.addEventListener("scroll",function(){ 149 if(document.body.scrollTop > 60 || document.documentElement.scrollTop > 60) { 150 $('.scroll-up').show(); 151 } else { 152 $('.scroll-up').hide(); 153 } 154 }); 155 if($(window).width() < '1200'){ 156 $('#navigation .parent.nav-item .nav-link.dropdown-toggle').each(function(){ 157 var parent = $(this); 158 parent.append('<span></span>'); 159 var current = $('span',parent); 160 current.click(function(event){ 161 event.preventDefault(); 162 parent.next('ul').toggle(); 163 current.toggleClass('active'); 164 }); 165 }); 166 } 167 //content templates 168 $('table.collapse-container .collapse-button').click(function(){ 169 var parent_container = $(this).parents('.collapse-container'); 170 var parent_row = parent_container.parents('.tab-pane');
171 if(parent_container.hasClass('active')){ 172 parent_container.removeClass('active'); 173 } else { 174 $('table.collapse-container.active', parent_row).removeClass('active'); 175 parent_container.addClass('active'); 176 } 177 }); 178 $('table.read-more-container .read-more-button').click(function(){ 179 var parent_container = $(this).parents('.read-more-container'); 180 parent_container.addClass('active'); 181 }); 182 $('table.read-more-container .collapse-more-button').click(function(){ 183 var parent_container = $(this).parents('.read-more-container'); 184 parent_container.removeClass('active'); 185 }); 186 /*if($('#open-on-load.modal').length){ 187 $('#open-on-load.modal').modal('show'); 188 }*/ 189 190 //French version 191 if($('body.fr-fr').length){ 192 $('.navbar-nav .nav-item.search').remove(); 193 //scrollToID(id) 194 /*$('.navbar-nav a').click(function(){ 195 var hash = $(this).attr('href').hash.substr(1); 196 if(hash){ 197 scrollToID(hash); 198 } 199 });*/ 200 } 201 202 if($('iframe[src*="youtube.com"]').length){//if($('.responsive iframe[src*="youtube.com"]').length){ 203 responsive_video_scale(); 204 window.addEventListener('resize', responsive_video_scale); 205 } 206 }); 207})(jQuery); 208function activateBlock() { 209 if($("#navigation").length){ //Updated to accommodate language switcher 210 var navbar = document.getElementById("navigation"); 211 var sticky = navbar.offsetTop; 212 if (window.pageYOffset >= sticky) { 213 navbar.classList.add("navfix"); 214 } 215 if (window.pageYOffset == 0) { 216 navbar.classList.remove("navfix"); 217 } 218 } 219 /*if($("#navcontainer").length){ 220 var navbar = document.getElementById("navcontainer"); 221 var sticky = navbar.offsetTop; 222 if (window.pageYOffset >= sticky) { 223 navbar.classList.add("navfix"); 224 } 225 if (window.pageYOffset == 0) { 226 navbar.classList.remove("navfix"); 227 } 228 }*/ 229 if($("#navarea").length){ 230 var navbar = document.getElementById("navarea"); 231 var sticky = navbar.offsetTop - 90; 232 if (window.pageYOffset >= sticky) { 233 navbar.classList.add("navfix"); 234 } 235 if (window.pageYOffset == 0) { 236 navbar.classList.remove("navfix"); 237 } 238 } 239 if($('#navarea').length){//As you scroll, activate nav item 240 $('.content-row.content-block').each(function(){ 241 var row_id = $(this).attr('id'); 242 if($('#'+row_id+'.content-row.content-block').isInViewport()){ 243 $('#navarea .nav-items li a.active').removeClass('active'); 244 $('#navarea .nav-items li a.'+row_id).addClass('active'); 245 } 246 }); 247 } 248} 249$.fn.isInViewport = function() { 250 var elementTop = $(this).offset().top; 251 var elementBottom = elementTop + $(this).outerHeight(); 252 var viewportTop = $(window).scrollTop(); 253 var viewportBottom = viewportTop + $(window).height(); 254 return elementBottom > viewportTop && elementTop < viewportBottom; 255}; 256function scrollToID(id){ 257 $('html, body').animate({ 258 scrollTop: $(id).offset().top - 225 259 }, 1000); 260} 261 262function responsive_video_scale(){ 263 $('iframe[src*="youtube.com"]').each(function(){ 264 if(!$('body').hasClass('gallery')) { //not gallery page 265 $(this).css('height', $(this).width() * 315/560 +'px'); 266 } 267 }); 268}
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.