/** * @file */ (function ($, Drupal) { Drupal.behaviors.cardbanner = { attach: function (context, settings) { $(document).ready(function () { // Step through each FF on the page. $('.card.banner').each(function () { // Get the number of items for the carousel, if any. var num_of_items = 1; // Add the carousel to the FF using the id. $('.owl-carousel').owlCarousel({ margin: 10, nav: true, navContainerClass: 'uw-owl-nav', navText:[ '‹ prev', 'next ›' ], responsiveClass: true, responsive: { 0: { items: 1 }, 600: { items: num_of_items <= 2 ? (num_of_items - 1 > 0) ? num_of_items - 1 : 1 : 2 }, 1000: { items: num_of_items } } }); }); }); } }; })(jQuery, Drupal); /** * @file */ /** * @file */ (function ($, Drupal) { Drupal.behaviors.expandcollapse = { attach: function (context, settings) { $(document).ready(function () { $('.uw-expand-collapse').each(function () { // Get the id of the expand collapse. var id = '#uw-expand-collapse-' + $(this).data('id'); // When the expand all button is clicked, expand all the items. $(id + ' [data-type="expand-all"]').click(function () { // Find each of the buttons, which are the titles and change // aria-expanded and add class to show expanded. $(id + ' .uw-expand-collapse__items button').each(function () { $(this).attr('aria-expanded', true); $(this).addClass('uw-expanded'); }); // Find each of the text and add css to display them. $(id + ' .uw-expand-collapse__items .uw-expand-collapse__text').each(function () { $(this).css('display', 'block'); }); }); // When the collapse all button is clicked, collapse all the items. $(id + ' [data-type="collapse-all"]').click(function () { // Find each of the buttons, which are the titles and change // aria-expanded and remove class to show collapsed. $(id + ' .uw-expand-collapse__items button').each(function () { $(this).attr('aria-expanded', true); $(this).removeClass('uw-expanded'); }); // Find each of the text and add css to display them. $(id + ' .uw-expand-collapse__items .uw-expand-collapse__text').each(function () { $(this).css('display', 'none'); }); }); // Step through each of the titles and add a click function. $(id + ' .uw-expand-collapse__items button').click(function () { // If this has an expanded class, remove it and change aria expanded to false. // Otherwise add the expanded class and set aria-expanded to true. if ($(this).hasClass('uw-expanded')) { $(this).attr('aria-expanded', false); $(this).removeClass('uw-expanded'); } else { $(this).attr('aria-expanded', true); $(this).addClass('uw-expanded'); } // Toggle the text to show/hide. $(this).parent().parent().find('.uw-expand-collapse__text').toggle(); }) }); }); } }; })(jQuery, Drupal); /** * @file */ (function ($, Drupal) { Drupal.behaviors.factfigure = { attach: function (context, settings) { $(document).ready(function () { // Step through each FF on the page. $('.uw-ff').each(function () { var result = $(this).find('.uw-ff__has-carousel-settings').length; // Get the id to reference the individual FF. // Need this to ensure that if more than one FF on the page, // that all FFs get the carousel added. var id = '#uw-ff-' + $(this).data('id'); // Get the number of items for the carousel, if any. var num_of_items = $(id).data('num-per-carousel') !== '' ? $(this).data('num-per-carousel') : 3; // Add the carousel to the FF using the id. $(id + ' .owl-carousel').owlCarousel({ margin: 10, nav: true, navContainerClass: 'uw-owl-nav', navText:[ '‹ prev', 'next ›' ], responsiveClass: true, responsive: { 0: { items: 1 }, 600: { items: num_of_items <= 2 ? (num_of_items - 1 > 0) ? num_of_items - 1 : 1 : 2 }, 1000: { items: num_of_items } } }); }); }); } }; })(jQuery, Drupal); /** * @file */ (function ($, Drupal) { Drupal.behaviors.imagegallery = { attach: function (context, settings) { $(document).ready(function () { // Step through each FF on the page. $('.uw-ig').each(function () { // Get the id to reference the individual FF. // Need this to ensure that if more than one FF on the page, // that all FFs get the carousel added. var id = '#uw-ig-' + $(this).data('id'); // Add the carousel to the FF using the id. $(id + ' .owl-carousel').owlCarousel({ loop: true, nav: true, margin: 10, responsiveClass: true, responsive: { 0: { items: 1, nav: true, loop: true }, 600: { items: 1, nav: true, loop: true }, 1000: { items: 1, nav: true, loop: true } } }); }); }); } }; })(jQuery, Drupal); /** * @file */ (function ($, Drupal) { Drupal.behaviors.multitypelist = { attach: function (context, settings) { window.addEventListener("DOMContentLoaded", () => { const tabs = document.querySelectorAll('[role="tab"]'); const tabList = document.querySelector('[role="tablist"]'); if (tabs.length == 0) { return; } // Add a click event handler to each tab. tabs.forEach(tab => { tab.addEventListener("click", changeTabs); }); // Enable arrow navigation between tabs in the tab list. let tabFocus = 0; tabList.addEventListener("keydown", e => { // Move right. if (e.keyCode === 39 || e.keyCode === 37) { tabs[tabFocus].setAttribute("tabindex", -1); if (e.keyCode === 39) { tabFocus++; // If we're at the end, go to the start. if (tabFocus >= tabs.length) { tabFocus = 0; } // Move left. } else if (e.keyCode === 37) { tabFocus--; // If we're at the start, move to the end. if (tabFocus < 0) { tabFocus = tabs.length - 1; } } tabs[tabFocus].setAttribute("tabindex", 0); tabs[tabFocus].focus(); } }); }); function changeTabs(e) { const target = e.target; const parent = target.parentNode; const grandparent = parent.parentNode; // Remove all current selected tabs. parent .querySelectorAll('[aria-selected="true"]') .forEach(t => t.setAttribute("aria-selected", false)); // Set this tab as selected. target.setAttribute("aria-selected", true); // Hide all tab panels. grandparent .querySelectorAll('[role="tabpanel"]') .forEach(p => p.setAttribute("hidden", true)); // Show the selected panel. grandparent.parentNode .querySelector(`#${target.getAttribute("aria-controls")}`) .removeAttribute("hidden"); } } }; })(jQuery, Drupal); /** * @file */ (function ($) { Drupal.behaviors.responsive_menu_combined = { attach: function (context, settings) { 'use strict'; // Close "other users" by default. $('.uw_other h3 span:first-child').html('▸'); $('.uw_other ul').hide(); // Since we're making the headers visible, wrap them in a button. $('.uw-whos-online-block h3').wrapInner('<button></button>'); // Add appropriate ARIA attributes for default states. $('.uw_privileged button').attr('aria-expanded', 'true'); $('.uw_other button').attr('aria-expanded', 'false'); // Handle show/hide. $('.uw-whos-online-block button').on('click', function () { let $list = $(this).closest('div').find('ul'); if ($list.is(":visible")) { $list.hide(); $('span:first-child',this).html('▸'); $(this).attr('aria-expanded', 'false'); } else { $list.show(); $('span:first-child',this).html('▾'); $(this).attr('aria-expanded', 'true'); } }); } }; })(jQuery); /** * @file * Ckeditor Modal. */ (function ($, Drupal) { if ($.ui && $.ui.dialog) { orig_allowInteraction = $.ui.dialog.prototype._allowInteraction; $.ui.dialog.prototype._allowInteraction = function (event) { if ($(event.target).closest('.cke_dialog').length) { return true; } return orig_allowInteraction.apply(this, arguments); }; } })(jQuery, Drupal); /** * @file */ (function ($, Drupal) { Drupal.behaviors.menuhorizontal = { attach: function (context, settings) { // uw-horizontal-nav. $(document).ready(function () { // Have to add the run this code only once, so that multiple // loads of the menu are not shown when logged in. $(document, context).once('menuhorizontal').each(function () { const toggle = document.querySelector(".uw-navigation-button"); const navHeader = document.querySelector(".uw-header__navigation"); const menus = document.querySelectorAll(".menu--horizontal"); const items = document.querySelectorAll(".menu--item"); /* Toggle mobile menu */ function toggleMenu() { if (this.classList.contains('active')) { this.classList.remove('active'); this.setAttribute('aria-expanded', 'false'); navHeader.classList.remove('open'); navHeader.classList.add('close'); $('html').removeClass('no-scroll'); } else { this.classList.add('active'); this.setAttribute('aria-expanded', 'true'); navHeader.classList.remove('close'); navHeader.classList.add('open'); $('html').addClass('no-scroll'); } }; for (let menu of menus) { /* Activate Submenu */ function toggleItem() { var parent = this.parentNode.parentNode.parentNode.parentNode; var screenWidth = $(window).width(); if (this.classList.contains('submenu-active')) { this.classList.remove('submenu-active'); if (this.hasAttribute('aria-expanded', 'true')) { this.setAttribute('aria-expanded', 'false'); } // If hamburger. if (screenWidth <= 767) { // Look at parents and reset the menus. if (parent.classList.contains('uw-horizontal-nav--secondary')) { $('.uw-horizontal-nav--main').css('display', 'block'); } } } else if ($('.submenu-active')) { // Get elements with .submnenu-active than close them,. $('.submenu-active').removeClass('submenu-active').attr('aria-expanded', 'false'); // And open this one. this.classList.add("submenu-active"); this.setAttribute('aria-expanded', 'true'); // If hamburger. if (screenWidth <= 767) { // Look at parents and hide other menus if not secondary and open. if (parent.classList.contains('uw-horizontal-nav--secondary')) { $('.uw-horizontal-nav--main').css('display', 'none'); $('.uw-horizontal-nav--secondary').css('display', 'block'); } } } else { this.classList.add('submenu-active'); this.setAttribute('aria-expanded', 'true'); } } /* Close Submenu From Anywhere */ function closeSubmenu(e) { let isClickInside = menu.contains(e.target); if (!isClickInside && menu.querySelector(".submenu-active")) { menu.querySelector(".submenu-active").classList.remove("submenu-active"); } } } for (let item of items) { if (item.querySelector(".menu--subnav")) { item.addEventListener("click", toggleItem, false); } // Add event listeners to keyup event of enter and escape keys for the menu--items . item.addEventListener('keyup', function (e) { if (e.key === "Enter") { this.click(); } if (e.key === "Escape") { this.click(); } // Space bar keypress to open close menu // keyCode to be deprecated find way to use key. }); item.addEventListener('keypress', function (e) { if (e.keyCode == 32) { this.click(); e.preventDefault(); } }); } document.addEventListener("click", closeSubmenu, false); // If Toggle on page Add event listeners on the menu toggle button. if (toggle) { toggle.addEventListener("click", toggleMenu, false); } // Apply timeout to the to event firing // so it fires at end of event. function debouncer(func) { var timeoutID, timeout = 0; return function () { var scope = this, args = arguments; clearTimeout(timeoutID); timeoutID = setTimeout(function () { func.apply(scope, Array.prototype.slice.call(args)); }, timeout); }; } // Check the width of the screen and // force the button click if wider that 767px. function menuCheckWidth() { // Set screenWidth var. var screenWidth = $(window).width(); navHeader.classList.add('close'); if (screenWidth > 767) { if ($('html').hasClass('no-scroll')) { toggle.click(); $('.uw-horizontal-nav').css('display', 'block'); } else { $('.uw-header__navigation').addClass('open'); } } else { if ($('.uw-header__navigation').hasClass('open')) { $('.uw-header__navigation').removeClass('open'); $('.uw-header__navigation').addClass('close'); } } } // Listen to event resize and apply the debouncer // to the menuCheckWidth function. $(window).resize( debouncer(function () { menuCheckWidth(); } ) ); menuCheckWidth(); }); }); } }; })(jQuery, Drupal); /** * @file */ (function ($, document, Drupal) { Drupal.behaviors.wcmsheadersearchbar = { attach: function (context, settings) { } } })(jQuery, document, Drupal); /** * @file */ (function ($, document, Drupal) { Drupal.behaviors.wcmsheadersearch = { attach: function (context, settings) { $(document).ready(function () { $('.uw-search--checkboxlabel').on("click", function () { $(this).toggleClass('close'); $('.uw-header__masthead').toggleClass('open'); }); function debouncer(func) { var timeoutID, timeout = 0; return function () { var scope = this, args = arguments; clearTimeout(timeoutID); timeoutID = setTimeout(function () { func.apply(scope, Array.prototype.slice.call(args)); }, timeout); }; } // Check the width of the screen and. function checkWidth() { // Set screenWidth var. var screenWidth = $(window).width(); if ($('.uw-header__masthead').hasClass('open')) { $('.uw-search--checkboxlabel').click(); } } // Listen to event resize and apply the debouncer // to the menuCheckWidth function. $(window).resize( debouncer(function () { checkWidth(); } ) ); // checkWidth(); }); } } })(jQuery, document, Drupal);