1(function($){ 2 3"use strict"; 4 5 // Initiates Owl Carousel plugin 6 // https://owlcarousel2.github.io/OwlCarousel2/ 7 if ($(".js-slider-block").length) { 8 $( ".js-slider-block" ).each(function() { 9 var $slider = $(this).find(".js-slider"); 10 var $nav = $(this).find(".slider-nav"); 11 12 $slider.owlCarousel({ 13 loop: false, 14 lazyLoad: true, 15 dots: false, 16 nav: true, 17 navText: ["<i class='fa-sharp fa-regular fa-angle-left'></i><span class='visually-hidden'>Previous</span>","<i class='fa-sharp fa-regular fa-angle-right'></i><span class='visually-hidden'>Next</span>"], 18 navContainer: $nav, 19 responsive : { 20 // breakpoint from 0 up 21 0 : { 22 margin: 10, 23 items: 2 24 }, 25 // breakpoint from 720 up 26 720 : { 27 margin: 20, 28 items: 3 29 } 30 } 31 }); 32 }); 33 } 34 35 if ($(".js-slider-block-sm").length) { 36 $( ".js-slider-block-sm" ).each(function() { 37 var $slider = $(this).find(".js-slider"); 38 var $nav = $(this).find(".slider-nav"); 39 40 $slider.owlCarousel({ 41 loop: false, 42 lazyLoad: true, 43 dots: false, 44 nav: true, 45 navText: ["<i class='fa-sharp fa-regular fa-angle-left'></i><span class='visually-hidden'>Previous</span>","<i class='fa-sharp fa-regular fa-angle-right'></i><span class='visually-hidden'>Next</span>"], 46 navContainer: $nav, 47 responsive : { 48 // breakpoint from 0 up 49 0 : { 50 margin: 10, 51 items: 2 52 }, 53 // breakpoint from 720 up 54 720 : { 55 margin: 10, 56 items: 3 57 }, 58 // breakpoint from 1024 up 59 1024 : { 60 margin: 20, 61 items: 4 62 } 63 } 64 }); 65 }); 66 } 67 68 if ($(".section-carousel").length) { 69 $( ".section-carousel" ).each(function() { 70 var $slider = $(this).find(".js-content-carousel"); 71 var $nav = $(this).find(".slider-nav"); 72 73 $slider.owlCarousel({ 74 loop: true, 75 lazyLoad: true, 76 dots: true, 77 nav: true, 78 navText: ["<i class='fa-sharp fa-regular fa-angle-left'></i><span class='visually-hidden'>Previous</span>","<i class='fa-sharp fa-regular fa-angle-right'></i><span class='visually-hidden'>Next</span>"], 79 navContainer: $nav, 80 autoplay:true, 81 autoplayTimeout:8000, 82 autoplayHoverPause:true, 83 responsive : { 84 // breakpoint from 0 up 85 0 : { 86 margin: 0, 87 items: 1 88 } 89 } 90 }); 91 }); 92 } 93 94 /* Alert Banner 95---------------- 96 * Allow user to close banner and set cookie to keep banner closed for 1 day */ 97var setCookie = function(cname, cvalue, exdays) { 98 var d = new Date(); 99 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 100 var expires = "expires=" + d.toUTCString(); 101 document.cookie = cname + "=" + cvalue + "; " + expires; 102} 103 104var getCookie = function(cname) { 105 var name = cname + "="; 106 var ca = document.cookie.split(';'); 107 for (var i = 0; i < ca.length; i++) { 108 var c = ca[i]; 109 while (c.charAt(0) == ' ') c = c.substring(1); 110 if (c.indexOf(name) == 0) return c.substring(name.length, c.length); 111 } 112 return ""; 113} 114 115$(document).ready(function($) { 116 console.log(getCookie("alert")); 117 if (getCookie("alert") == "closed") { 118 $("#alert").hide(); 119 } else { 120 $("#alert").show(); 121 } 122 123 $("#alert .close").click(function() { 124 $("#alert").remove();
125 setCookie("alert", "closed", 1) 126 }); 127}); 128 129// Disable link click for menu headers 130$('.sub-menu').click(function() { 131 $(this).addClass("is-open"); 132}); 133 134$('.sub-menu > a').click(function(e) { 135 e.preventDefault(); 136}); 137 138// Toggle Search Bar 139if ($(".js-toggle-search").length > 0) { 140 $(".js-toggle-search").click(function(){ 141 $(".js-searchbar").addClass("is-open"); 142 $(".js-nav").addClass("has-search-open"); 143 $( ".js-close-search" ).focus(); 144 }); 145} 146 147if ($(".js-close-search").length > 0) { 148 $(".js-close-search").click(function(){ 149 $(".js-searchbar").removeClass("is-open"); 150 $(".js-nav").removeClass("has-search-open"); 151 $( ".js-toggle-search" ).focus(); 152 }); 153} 154 155// Toggle Mobile Menu 156if ($(".js-mobile-toggler").length > 0) { 157 $(".js-mobile-toggler").click(function(){ 158 $("body").toggleClass("has-mobile-menu-open"); 159 }); 160} 161 162// Links opening in new window 163$(document).ready(function(){ 164 var links = document.querySelectorAll('a'); 165 if(links.length) { 166 links.forEach(function(item){ 167 if( item.getAttribute('target') == '_blank') { 168 item.setAttribute('rel','noopener noreferrer'); 169 } 170 }) 171 } 172}); 173 174// Adding disclaimer when links open in new window 175var links = $("a").toArray(); 176links.forEach(function(item,i){ 177 if($(item).attr("target")=="_blank") { 178 item.className = item.className + " external"; 179 item.innerHTML = item.innerHTML + "<span class='visually-hidden'> - Opens in new window</span>"; 180 } 181}) 182 183// Submitting form on filter change 184if ($(".js-filter-control").length > 0) { 185 $(".js-filter-control").change(function(){ 186 $(".js-searchbox").submit(); 187 }); 188} 189 190// Searhc Events form 191$("input[data-datepicker]").on("change",function(){ 192 setDateValues($(this)); 193}); 194 195function setDateValues(inputField) { 196 let dateVal = ''; 197 if(inputField.val().indexOf("/") != -1) { 198 dateVal = inputField.val().split("/"); 199 } else if(inputField.val().indexOf(".") != -1) { 200 dateVal = inputField.val().split("."); 201 } else if(inputField.val().indexOf("-") != -1) { 202 dateVal = inputField.val().split("-"); 203 } 204 if(dateVal.length == 3) { 205 inputField.siblings("[data-date-part='month']").val(parseInt(dateVal[1])); 206 inputField.siblings("[data-date-part='day']").val(parseInt(dateVal[2])); 207 inputField.siblings("[data-date-part='year']").val(parseInt(dateVal[0])); 208 } else { 209 inputField.siblings("[data-date-part='month']").val(""); 210 inputField.siblings("[data-date-part='day']").val(""); 211 inputField.siblings("[data-date-part='year']").val(""); 212 } 213} 214 215// Set Table Styles 216/* if ($("table").length > 0) { 217 $( "table" ).each(function() { 218 if ($(this).attr("border", "0") ) { 219 $(this).addClass("table table-borderless"); 220 } else { 221 $(this).addClass("table"); 222 } 223 }) 224} */ 225 226// Fluid YouTube embeds 227$(document).ready(function () { 228 var videos = $(".cBuilder").find("iframe[src*='youtu']").toArray(); 229 if(videos.length) { 230 videos.forEach(function(video){ 231 $(video).wrap("<div class='ratio ratio-16x9'></div>"); 232 setPlayerResponsive($(video).parent(".ratio.ratio-16x9")); 233 }) 234 } 235}); 236 237$(document).ready(function() { 238 //searchbar botton class toggle 239 var searchbar_button = $('form#site-search-form button.searchbar-button') 240 searchbar_button.click(function(event){ 241 if(!$(this).prev("input[type=text]").val()) { 242 event.preventDefault() 243 $(this).parent('form#site-search-form').toggleClass('active') 244 $('#site-header').toggleClass('search-opened') 245 } 246 }) 247 248 $('#site-menu-primary .menu-item.sub-menu'); 249 250 $("#emailAlertsForm").on("submit",function(){ 251 submitForm(); 252 return false; 253 }) 254 255 // Alerts Form 256 function submitForm(){ 257 $.ajax({ 258 method: "post", 259 data: $("#emailAlertsForm").serialize(), 260 url: $("#emailAlertsForm").attr("action"), 261 complete: function(response){ 262 if(response.responseText.indexOf("errors")==-1) { 263 $(".errors","#emailForm_wrapper").hide(); 264 $("#emailAlertsForm").addClass("sent"); 265 } else { 266 $(response.responseText).find(".errors").html().appendTo("#emailForm_wrapper"); 267 } 268 } 269 }) 270 } 271}); 272 273// MENUS 274 //--------------------------------------- 275 276 // Menu Events
277 // Set .sub-menu-toggled class for click and hover events 278 $(".menu-vertical .sub-menu > a").click(function() { 279 $(this).parent('.menu-item').toggleClass("sub-menu-toggled"); 280 return false; 281 }); 282 283 // For vertical menus only, keep active section open 284 $(document).ready(function() { 285 $('.menu-vertical .active').addClass("sub-menu-toggled").attr("aria-expanded", "true"); 286 }); 287 288 // Mobile Menu 289 // Set click event for mobile menu 290 $(".menu-toggle").click(function() { 291 var menuTarget = $(this).attr("data-target"); 292 293 $("#"+menuTarget).toggleClass("menu-primary-toggled"); 294 $(this).toggleClass("toggled"); 295 296 if ($("#"+menuTarget).hasClass('menu-primary-toggled')) { 297 $("#"+menuTarget).attr("aria-expanded", "true"); 298 $(this).attr("aria-expanded", "true"); 299 } else { 300 $("#"+menuTarget).attr("aria-expanded", "false"); 301 $(this).attr("aria-expanded", "false"); 302 } 303 }); 304 305 // Menu Animations 306 // Set class .menu-expanding when transitioning between collapsed and expanded states 307 // var transitionEnd = webkitAnimationEnd mozAnimationEnd oAnimationEnd oanimationend animationend; 308 309 // Menu Accessibility 310 // Set aria attributes to submenu and parent items for screen reader optimization 311 $(document).ready(function() { 312 313 var menuParent = $(".has-submenu"); 314 var menuSubmenu = $(".has-submenu > .submenu"); 315 var menuParentID = $(menuSubmenu).parent().attr("id"); 316 var menuSubmenuID = $(menuParent).children('.submenu').attr("id"); 317 318 // Adding aria attributes for accessibility 319 $(menuSubmenu).attr("aria-labelledby", menuParentID); 320 $(menuParent).attr("aria-controls", menuSubmenuID); 321 $(menuParent).attr("aria-expanded", "false"); 322 323 }); 324 325 $('.has-submenu > a').click(function(){ 326 if ($(this).parent('.menu-item').hasClass('menu-expanded')) { 327 $(this).parent('.menu-item').attr( "aria-expanded", "true" ); 328 $(this).siblings('.submenu').attr( "aria-expanded", "true" ); 329 } else { 330 $(this).parent('.menu-item').attr( "aria-expanded", "false" ); 331 $(this).siblings('.submenu').removeAttr( "aria-expanded", "true" ); 332 } 333 }); 334 335 336})(jQuery); 337 338function setPlayerResponsive(container) { 339 var fl = container.children("iframe"); 340 if(fl.attr("data-responsive")) { 341 return; 342 } 343 var w = fl.width(), 344 h = fl.height(); 345 container 346 .css("height", '0') 347 .css("padding-bottom",h/w*100+"%") 348 .css("position","relative"); 349 fl 350 .attr("data-responsive","1") 351 .css("position","absolute") 352 .css("left","0") 353 .css("top","0") 354 .css("bottom","0") 355 .css("height","100%") 356 .css("width","100%"); 357}
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.