Staff
Staff
Patrick Evans
Student Services Manager
Student Services Manager
tags inside buttons */ window.addEventListener('DOMContentLoaded', (event) => { // Find all button elements on the page const buttons = document.querySelectorAll('button'); // Loop through each button buttons.forEach(button => { // Find all
elements within each button const paragraphs = button.querySelectorAll('p'); // Loop through each paragraph and remove it if it's empty paragraphs.forEach(p => { if (p.textContent.trim() === '') { p.remove(); } }); }); }); //----------------------------------------- // Content Template: page-template-no-3 - end //----------------------------------------- //----------------------------------------- // Content Template: tabs-font-awesome-css-and-javascript - start //----------------------------------------- //Font Awesome jQuery(function($){ $(document).ready(function() { var s = document.createElement("script"); s.type = "text/javascript"; s.src = "https://kit.fontawesome.com/d949d8fb59.js"; // Use any selector $("head").append(s); }); }); /* * This content is licensed according to the W3C Software License at * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document * * File: tabs-manual.js * * Desc: Tablist widget that implements ARIA Authoring Practices */ 'use strict'; class TabsManual { constructor(groupNode) { this.tablistNode = groupNode; this.tabs = []; this.tabpanels = []; this.tabs = Array.from(this.tablistNode.querySelectorAll('[role=tab]')); this.tabs.forEach((tab, i) => { let tabpanel = document.getElementById(tab.getAttribute('aria-controls')); // Make all tabs part of the natural tab order tab.tabIndex = 0; // Adjust this line tab.setAttribute('aria-selected', 'false'); this.tabpanels.push(tabpanel); tab.addEventListener('keydown', this.onKeydown.bind(this)); tab.addEventListener('click', this.onClick.bind(this)); }); if (this.tabs.length > 0) { this.firstTab = this.tabs[0]; this.lastTab = this.tabs[this.tabs.length - 1]; this.setSelectedTab(this.firstTab); } } setSelectedTab(currentTab) { this.tabs.forEach((tab, i) => { if (currentTab === tab) { tab.setAttribute('aria-selected', 'true'); this.tabpanels[i].classList.remove('is-hidden'); } else { tab.setAttribute('aria-selected', 'false'); this.tabpanels[i].classList.add('is-hidden'); } }); } /* EVENT HANDLERS */ onKeydown(event) { let tgt = event.currentTarget, flag = false; switch (event.key) { case 'ArrowLeft': this.moveFocusToPreviousTab(tgt); flag = true; break; case 'ArrowRight': this.moveFocusToNextTab(tgt); flag = true; break; case 'Home': this.moveFocusToTab(this.firstTab); flag = true; break; case 'End': this.moveFocusToTab(this.lastTab); flag = true; break; } if (flag) { event.stopPropagation(); event.preventDefault(); } } onClick(event) { this.setSelectedTab(event.currentTarget); } moveFocusToTab(currentTab) { currentTab.focus(); } moveFocusToPreviousTab(currentTab) { let index = this.tabs.indexOf(currentTab); let prevTab = index > 0 ? this.tabs[index - 1] : this.lastTab; this.moveFocusToTab(prevTab); } moveFocusToNextTab(currentTab) { let index = this.tabs.indexOf(currentTab); let nextTab = index < this.tabs.length - 1 ? this.tabs[index + 1] : this.firstTab; this.moveFocusToTab(nextTab); } } window.addEventListener('load', function () { var tablists = document.querySelectorAll('[role=tablist].manual'); for (var i = 0; i < tablists.length; i++) { new TabsManual(tablists[i]); } }); /*Remove False Venue in Events*/ jQuery(function($){ $(document).ready(function() { $('a[href*="https://womensstudies.unc.edu/2024/02/1349/"]').remove(); }); }); /*Make sure ids do not repeat themselves*/ (function($) { $(document).ready(function() { var ids = {}; // Object to keep track of ids // Iterate over all elements with an id attribute $('[id]').each(function() { var id = $(this).attr('id'); if (ids[id]) { // If the id is already in the object, it's a duplicate // Increment the counter for the id ids[id] += 1; // Set a new unique id: original id + dash + counter value var newId = id + '-' + ids[id]; $(this).attr('id', newId); } else { // If it's not a duplicate, add it to the object with a counter of 1 ids[id] = 1; } }); }); })(jQuery); function addIDtoH1IfTabs() { // Check if there is an element with the class "tabs" on the page const tabsElement = document.querySelector('.tabs'); if (tabsElement) { // Find the first h1 element on the page const h1Element = document.querySelector('h1'); if (h1Element) { // Add the ID "tablist-1" to the h1 element h1Element.id = "tablist-1"; } } } // Run the function addIDtoH1IfTabs(); //----------------------------------------- // Content Template: tabs-font-awesome-css-and-javascript - end //----------------------------------------- //----------------------------------------- // Content Template: search-menu-item - start //----------------------------------------- document.addEventListener('DOMContentLoaded', function () { // Find the main menu var menu = document.getElementById('menu-main'); // Create a container for the search bar var searchBarContainer = document.createElement('div'); searchBarContainer.id = 'searchBarContainer'; searchBarContainer.setAttribute('aria-labelledby', 'searchIconLink'); searchBarContainer.style.display = 'none'; // Initially hide the search bar container searchBarContainer.style.flex = '0 1 auto'; searchBarContainer.style.width = '96%'; searchBarContainer.style.justifyContent = 'flex-end'; searchBarContainer.innerHTML = `