PageSourceSearch

https://southbendin.gov/wp-content/themes/understrap_child/js/js/accessibility.js?ver=1790239547

js southbendin.gov collected 2026-09-24 08:52:02 UTC 3,743 bytes, 132 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function() {
2
3
4//fix accordion
5
6
7 const accordions = document.querySelectorAll('.sb-accordion-trigger');
8
9accordions.forEach(accordion => {
10	accordion.addEventListener("click", e => {
11		console.log('accordion clicked!')
12		const accordionButton = e.currentTarget;
13		const icon = accordionButton.querySelector('svg');
14
15		icon.classList.toggle('fa-plus');
16		icon.classList.toggle('fa-minus');
17	})
18})
19
20
21
22	
23  // Remove placeholder paragraphs
24  document.querySelectorAll('.entry-content p').forEach(para => {
25    if (para.textContent.trim() === '###') {
26      para.remove();
27    }
28  });
29
30  // Add screen reader text to external links
31  document.querySelectorAll('a[target="_blank"]').forEach(link => {
32    if (!link.querySelector('.sr-only')) {
33      const srText = document.createElement('span');
34      srText.className = 'sr-only';
35      srText.textContent = ' (opens in a new window)';
36      link.appendChild(srText);
37    }
38  });
39
40const decorativeIcons = document.querySelectorAll('.decorative-icon-svg');
41
42decorativeIcons.forEach(icon => {
43	icon.setAttribute('aria-hidden', 'true');
44	icon.setAttribute('focusable', 'false');
45})
46
47
48//remove unnecessary title attribute
49
50document.querySelectorAll('.tribe-events-calendar-list__event-title-link').forEach(link => {
51link.removeAttribute('title');
52const linkObserver = new MutationObserver(mutations => {
53        mutations.forEach(mutation => {
54          if (mutation.attributeName === 'title') {
55            mutation.target.removeAttribute('title');
56            console.log('title removed from event title links');
57          }
58        });
59      });
60      linkObserver.observe(link, { attributes: true });
61    });
62 
63
64
65
66  // Remove aria-label and observe all existing subscribe buttons
67  document.querySelectorAll('.tribe-events-c-subscribe-dropdown__button-text')
68    .forEach(btn => {
69      btn.removeAttribute('aria-label');
70      const observer = new MutationObserver(mutations => {
71        mutations.forEach(mutation => {
72          if (mutation.attributeName === 'aria-label') {
73            mutation.target.removeAttribute('aria-label');
74            console.log('aria-label removed from subscribe button');
75          }
76        });
77      });
78      observer.observe(btn, { attributes: true });
79    });
80
81  // Handle datepicker button
82  const datePickerBtn = document.querySelector('.tribe-events-c-top-bar__datepicker-button');
83  if (datePickerBtn) {
84    datePickerBtn.removeAttribute('aria-label');
85    const dateObserver = new MutationObserver(mutations => {
86      mutations.forEach(mutation => {
87        if (mutation.attributeName === 'aria-label') {
88          mutation.target.removeAttribute('aria-label');
89          console.log('aria-label removed from datepicker');
90        }
91      });
92    });
93    dateObserver.observe(datePickerBtn, { attributes: true });
94  }
95
96//remove header on sense sb page to remove duplicate <h1> tags
97const doubleTitle = document.querySelector('#post-9064356 header');
98if (doubleTitle) {	
99doubleTitle.setAttribute('aria-hidden', 'true');
100}
101
102//deal with next month days
103
104// Watch for calendar updates and improve accessibility labels
105console.log('new calendar')
106const observer = new MutationObserver(() => {
107  const otherMonthButtons = document.querySelectorAll(
108    '.tribe-events-calendar-month__day--other-month button'
109  );
110
111  otherMonthButtons.forEach(btn => {
112    const label = btn.getAttribute('aria-label') || '';
113
114    // Prevent double-appending
115    if (!label.includes('next month')) {
116      btn.setAttribute('aria-label', `${label}, next month`);
117    }
118  });
119});
120
121// Watch the whole document because Tribe Events re-renders deeply
122observer.observe(document.body, {
123  childList: true,
124  subtree: true
125});
126
127
128
129});
130
131
132

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.