PageSourceSearch

https://valleyal.org/resources/v1315/scripts/layouts/minimalist/standard.js

js valleyal.org collected 2026-10-02 00:23:46 UTC 18,497 bytes, 497 lines download raw bytes

1
2
3//Navbar toggler/mobile view navbar
4$(document).ready(function () {
5    $('.first-button').on('click', function () {
6        $('.animated-icon1').toggleClass('open');
7    });
8});
9
10
11//Collapsed Navbar background color changes when opened
12$(".navbar-toggler").click(function () {
13    $("nav.navbar").toggleClass('navbar-white');
14})
15
16// Open sub-menues on click on mobile view
17$(document).ready(function () {
18    $('.dropdown-submenu a.sub-click').on("click", function (e) {
19        if ($(window).width() > 992) {
20            $(this).next('ul').toggle();
21            e.stopPropagation();
22            e.preventDefault();
23        }
24    });
25});
26
27
28
29// Dropdown Cut Off from the bottom
30
31//$(".dropdown-submenu a").mouseover(function (event) {
32//    var $hoveredElement = $(this);
33//    var elementOffset = $hoveredElement.offset(); // Offset (top, left) of each level 1 dropdown
34//    var elementTopOffset = elementOffset.top;
35
36//    console.log(elementTopOffset);
37
38//    // if element's height is bigger than X, then 
39
40//    if (elementTopOffset > 500) {
41//        $("ul.dropdown-menu").css("top", "100");
42//    }
43//});
44
45//$(".nav-links li.levelTwo").mouseout(function () {
46//    $("ul.subMenu2Alignment").css("top", "0");
47//    $("ul.subMenu3Alignment").css({
48//        "top": "0",
49//        "bottom": "auto"
50//    });
51//});
52
53
54
55//Slick Plugin
56$(document).ready(function () {
57    $('.autoplay').slick({
58        slidesToShow: 5,
59        slidesToScroll: 1,
60        autoplay: true,
61        autoplaySpeed: 3000,
62        speed: 1000,
63        pauseOnFocus: false,
64
65        prevArrow: "<button type='button' aria-label='View the previous sponsor image' class='slick-prev pull-left'><div class='triangleSponsorsRotatorArrow'></div></button>",
66        nextArrow: "<button type='button' aria-label='View the next sponsor image' class='slick-next pull-right'><div class='triangleSponsorsRotatorArrowNext'></div></button>",
67
68        responsive: [
69            {
70                breakpoint: 1200,
71                settings: {
72                    slidesToShow: 5,
73                    slidesToScroll: 1,
74                }
75            },
76            {
77                breakpoint: 992,
78                settings: {
79                    slidesToShow: 4,
80                    slidesToScroll: 1
81                }
82            },
83            {
84                breakpoint: 768,
85                settings: {
86                    slidesToShow: 3,
87                    slidesToScroll: 1
88                }
89            },
90
91            {
92                breakpoint: 600,
93                settings: {
94                    slidesToShow: 2,
95                    slidesToScroll: 1
96                }
97            },
98
99            {
100                breakpoint: 415,
101                settings: {
102                    slidesToShow: 1,
103                    slidesToScroll: 1
104                }
105            }
106        ]
107
108    });
109
110});
111
112
113
114/********************************************************************************************************* 
115                                           WCAG / ADA Solutions
116**********************************************************************************************************/
117
118$(document).ready(function () {
119
120    /* Error: "Layout table - A <table> element is present that does not contain any header (<th>) cells." - every ComboBox, RadDatePicker has this issue  */
121    ['.RadComboBox table', '.RadCalendar', '.RadScheduler', '.rtWrapper', '.rsContentScrollArea table', '.rsAllDayTable', 'table.rsAgendaTable', '.rsAptContent table', '.rsContent table'].forEach(function (selector) {
122        var tables = document.querySelectorAll(selector);
123        tables.forEach(function (table) {
124            var th = document.createElement('th');
125            th.textContent = 'Header Cell #1';
126            th.style.color = 'black';
127            th.style.backgroundColor = 'white';
128            th.classList.add('hiddenText', 'sr-only'); // Combined class additions
129            var firstRow = table.querySelector('tr');
130            if (firstRow) {
131                firstRow.appendChild(th);
132            }
133        });
134    });
135
136    $(".tooltipSubscribe span").css("font-size", "14px !important");
137
138    // Error: 'Empty link' - There were <a> buttons for game scroller that had no purpose, but they were causing accessibility issues
139    $(".gameScrollerContainer .rrButton").remove();
140    $(".gameScrollerContainer2 .rrButton").remove();
141    $(".gameScrollerContainer3 .rrButton").remove();
142
143    // Score Scroller issues   
144    $(".leagueScoresScrollerContainer .rrButton").remove();
145
146    // Error: 'Empty link' - There were <a> buttons for Scrolling Location condition that had no purpose, but they were causing accessibility issues
147    $(".RadRotatorLocations .rrButton").remove();
148
149    // Error: 'Redundant title text' - Homepage > Schedules Sidebar - the title matches the link text, so remove the title
150    document.querySelectorAll('.schedulesSidebar span').forEach(function (element) {
151        element.removeAttribute('title');
152    });
153
154    // Error: 'Redundant title text' - 'Contact Us' page
155    $(".rcRefreshImage").removeAttr("title");
156    $(".rcCaptchaAudioLink").removeAttr("title");
157
158    // Custom fields remove title - Error: 'Unlabeled form control with title'
159    $(".customFieldsRepeater input").attr("aria-label", "custom field");
160    $(".customFieldsRepeater textarea").attr("aria-label", "custom field");
161
162    /** <PagerStyle> causes ADA errors **/
163    $(".riSingle input").removeAttr("title");
164    $(".riSingle input").attr("aria-label", "Page Size");
165
166    // Who's Coming page - Error: ' Redundant title text'
167    $(".rcInputCell span").removeAttr("title");
168    $(".rcInputCell span").attr("aria-label", "Input Box");
169    $(".rgFilterBox").attr("aria-label", "Input Box");
170
171    // Remove redundant titles
172    // 1) ".rcCalPopup" -> For all RadDatePicker remove the title - Error is "Redundant title text"
173    // 2) ".rtCloseButton" -> This error is for all <telerik:RadToolTip>
174    // 3) ".t-button" -> for all the arrows within the RadDatePicker
175    // 4) ".RadPicker input" -> 'Unlabeled form control with title - A form control does not have a label, but has a title.'  -  The issue rises from all RadDatePicker calendars
176    $(".rcCalPopup, .rtCloseButton, .t-button, .RadPicker input, .rcTimePopup").removeAttr("title");
177
178    // Error: 'Broken same-page link' for Team/Calendar.aspx - Week view & Month view
179    function assignIds(selector) {
180        $(selector).each(function () {
181            var href = $(this).attr('href');
182            var id = href.startsWith('#') ? href.slice(1) : href;  // Remove the leading "#" from href value (if present)
183            $(this).attr('id', id); // Set the ID to the modified href value
184        });
185    }
186    assignIds('.rsHorizontalHeaderTable a, .rsContentTable a');
187
188    // 'SubscribeListDialog' on Standing Results page - schedules > division > Subscribe [button] (a window message will pop up) - Error: 'Missing form label'
189    $('.rwStatusBar input').attr('aria-label', 'Your label text here');
190
191    // Brackets for schedules > division - Error: 'Layout table'
192    // QR code at the bottom of schedules > division - Error: 'Layout table'
193    ['.standingResultsBracketsT', '.standingRevisionQR'].forEach(function (selector) {
194        var tables = document.querySelectorAll(selector);
195        tables.forEach(function (table) {
196            var rows = table.querySelectorAll('tr');
197            rows.forEach(function (row) {
198                var th = document.createElement('th');
199                th.textContent = 'Header Cell #2';
200                th.style.color = 'black';
201                th.style.backgroundColor = 'white';
202                th.style.fontSize = "12px";
203                th.classList.add('hiddenText');
204                row.appendChild(th);
205            });
206        });
207    });
208
209    // Facility.ascx page - The javascript was causing errors - 'OnClick' had to be replaced
210    function facilityOpenModal() {
211        console.log("Opening facility modal");  // Your logic for opening the facility modal
212    }
213
214    function facilityCloseModal() {
215        console.log("Closing facility modal"); // Your logic for closing the facility modal
216    }
217
218    $(document).ready(function () {
219        function addEventListenersToSelector(selector, event, handler) {
220            document.querySelectorAll(selector).forEach(function (element) {
221                element.addEventListener(event, handler);
222            });
223        }
224
225        if (facilityOpenModal) {
226            addEventListenersToSelector(".facilityShowSmallImg", "click", facilityOpenModal);
227        }
228        if (facilityCloseModal) {
229            addEventListenersToSelector(".facilityClose", "click", facilityCloseModal);
230        }
231    });
232
233});
234
235
236// Boundry Check public pages - ctl00_MessageWindow_status - Error: 'Missing form label'
237function setAriaLabel() {
238    $('.rwStatusBar input').attr('aria-label', 'Your label text here');
239}
240document.addEventListener("DOMContentLoaded", function () {
241    setAriaLabel();
242});
243
244const observer1 = new MutationObserver(function (mutationsList, observer1) {
245    for (let mutation of mutationsList) {
246        if (mutation.type === 'childList') {
247            setAriaLabel();
248        }
249    }
250});
251observer1.observe(document.body, {
252    childList: true,
253    subtree: true
254});
255window.addEventListener('load', function () {
256    setAriaLabel();
257});
258
259
260
261// Select the existing <th> element within the table header - Add the text 'header cell #5' to the <th> element - Survey.ascx
262document.addEventListener('DOMContentLoaded', function () {
263    var thElement = document.querySelector('.surveyGrid .rgHeader');
264    if (thElement) {
265        thElement.textContent = 'header cell #5';
266    }
267});
268
269
270
271// 3 ADA errors: 'Empty table header (hidden)' & 'Possible table caption (hidden)' & 'Layout table' on Team Ranking page
272document.addEventListener('DOMContentLoaded', function () {
273    function updateTableHeadersAndCaptions() {
274        var th = document.querySelector('.rgDataDiv table thead th');
275        if (th) {
276            th.classList.add('sr-only');
277            th.textContent = 'Hidden Header Text for Accessibility';
278        }
279
280        ['.teamRankingGrid .rgDataDiv table'].forEach(function (selector) {
281            var tables = document.querySelectorAll(selector);
282            tables.forEach(function (table) {
283                var headerRows = table.querySelectorAll('tr th');
284                headerRows.forEach(function (th) {
285                    th.textContent = 'Header Cell #3';
286                    th.style.color = 'black';
287                    th.style.backgroundColor = 'white';
288                    th.style.fontSize = '12px';
289                    th.classList.add('hiddenText');
290                });
291            });
292        });
293
294        var comboBoxDivs = document.querySelectorAll('.teamRankingofferingComboBox');
295        comboBoxDivs.forEach(function (div) {
296            var table = div.querySelector('table');
297            if (table) {
298                var th = document.createElement('th');
299                th.textContent = 'Header Cell #4';
300                th.style.color = 'black';
301                th.style.backgroundColor = 'white';
302                th.classList.add('hiddenText');
303
304                var firstRow = table.querySelector('tr');
305                if (firstRow) {
306                    firstRow.appendChild(th);
307                }
308            }
309        });
310
311        var tables = document.querySelectorAll('.teamRankingGrid table');
312        tables.forEach(function (table) {
313            var caption = document.createElement('caption');
314            caption.className = 'sr-only';
315            caption.textContent = 'This is an accessible caption for the table';
316            table.insertBefore(caption, table.firstChild);
317        });
318    }
319
320    updateTableHeadersAndCaptions();
321
322    var observer2 = new MutationObserver(function (mutations) {
323        mutations.forEach(function (mutation) {
324            if (mutation.addedNodes.length > 0) {
325                mutation.addedNodes.forEach(function (node) {
326                    if (node.nodeType === 1 && (node.matches('.rgDataDiv') || node.matches('.teamRankingofferingComboBox') || node.matches('.teamRankingGrid'))) {
327                        updateTableHeadersAndCaptions();
328                    }
329                });
330            }
331        });
332    });
333
334    observer2.observe(document.body, { childList: true, subtree: true });
335});
336
337
338
339
340/*****  Error: 'Redundant title text' - Homepage > Schedules Sidebar - the title matches the link text, so remove the title  *****/
341const mutationObserver2 = new MutationObserver(function (mutations) {
342    mutations.forEach(function (mutation) {
343        if (mutation.addedNodes.length > 0) {
344            mutation.addedNodes.forEach(function (node) {
345                // Check if node is an Element before proceeding
346                if (node.nodeType === 1) { // Node.ELEMENT_NODE
347                    if (node.classList.contains('rtIn')) {
348                        node.removeAttribute('title');
349                    }
350                    // Use node.querySelectorAll only if node is an Element
351                    node.querySelectorAll('.rtIn').forEach(function (element) {
352                        element.removeAttribute('title');
353                    });
354                }
355            });
356        }
357    });
358});
359
360mutationObserver2.observe(document.body, {
361    childList: true,
362    subtree: true
363});
364
365// Initially remove titles from already present elements
366document.querySelectorAll('.rtIn').forEach(function (element) {
367    element.removeAttribute('title');
368});
369
370
371
372// Calendar List view on public site missing caption for months titles (June, July, ...)
373document.addEventListener("DOMContentLoaded", function () {
374    var table = document.querySelector(".calendarListView .rgMasterTable");
375    if (table) {
376        var caption = document.createElement("caption");
377        caption.classList.add("sr-only");
378        caption.innerText = "Calendar of Events";
379        table.prepend(caption);
380    }
381});
382
383
384
385//Weeks
386document.addEventListener("DOMContentLoaded", function () {
387    var table = document.querySelector(".standingResultsSchedulesTable .rgMasterTable");
388    if (table) {
389        var caption = document.createElement("caption");
390        caption.classList.add("sr-only");
391        caption.innerText = "Weeks";
392        table.prepend(caption);
393    }
394});
395
396
397/*****  Error: 'Possible table caption - Text appears to be a table caption, but is not a caption element.' 
398        Master Schedule page
399        The exact error was apearing for 2 scenarios: A) on page load B) again once the UPDATE button was clicked and the table was loaded
400        For error B, MutationObserver had to be used.
401 */
402
403// Constants for reuse
404var VISUALLY_HIDDEN_STYLES = 'position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;';
405var TABLE_SELECTOR = '.RadGrid_Bootstrap .rgMasterTable';
406
407// Helper function to add caption
408function addTableCaption(table) {
409    if (!table.querySelector('caption')) {
410        var caption = document.createElement('caption');
411        caption.textContent = 'Schedule Grid';
412        caption.style.cssText = VISUALLY_HIDDEN_STYLES;
413        table.insertBefore(caption, table.firstChild);
414    }
415}
416
417// Helper function to handle no records message
418function updateNoRecordsMessage() {
419    var noRecordsRow = document.querySelector('.rgNoRecords td div');
420    if (noRecordsRow) {
421        noRecordsRow.setAttribute('role', 'status');
422        noRecordsRow.textContent = 'No records found';
423    }
424}
425
426// Helper function to handle group headers
427function updateGroupHeaders() {
428    var groupHeaders = document.querySelectorAll('.rgGroupHeader td');
429    Array.prototype.forEach.call(groupHeaders, function (header) {
430        var pTag = header.querySelector('p');
431        var dateText = pTag ? (pTag.textContent || '').trim() : '';
432        header.setAttribute('role', 'rowheader');
433        header.setAttribute('aria-label', 'Games for ' + dateText);
434        if (pTag) {
435            pTag.setAttribute('role', 'heading');
436            pTag.setAttribute('aria-level', '2');
437        }
438    });
439}
440
441// Main function to make table accessible
442function makeTableAccessible() {
443    var table = document.querySelector(TABLE_SELECTOR);
444    if (table) {
445        addTableCaption(table);
446        updateNoRecordsMessage();
447        updateGroupHeaders();
448    }
449}
450
451// Set up mutation observer
452var observer = new MutationObserver(function (mutations) {
453    mutations.forEach(function (mutation) {
454        if (mutation.addedNodes.length) {
455            Array.prototype.forEach.call(mutation.addedNodes, function (node) {
456                if (node.nodeType === 1 && // Element node
457                    (node.classList && node.classList.contains('RadGrid_Bootstrap') ||
458                        node.querySelector && node.querySelector('.RadGrid_Bootstrap'))) {
459                    makeTableAccessible();
460                }
461            });
462        }
463    });
464});
465
466// Listen for Telerik Ajax requests
467function listenForAjaxEvents() {
468    if (typeof Sys !== 'undefined' && Sys.WebForms && Sys.WebForms.PageRequestManager) {
469        var prm = Sys.WebForms.PageRequestManager.getInstance();
470        prm.add_endRequest(function () {
471            // After any AJAX request completes
472            makeTableAccessible();
473        });
474    }
475}
476
477// Initialize
478function initialize() {
479    makeTableAccessible();
480    observer.observe(document.body, {
481        childList: true,
482        subtree: true
483    });
484    listenForAjaxEvents();
485
486    // Add event listener for the Update button
487    var updateButton = document.querySelector('input[value="Update"]');
488    if (updateButton) {
489        updateButton.addEventListener('click', function () {
490            // Give the table time to refresh
491            setTimeout(makeTableAccessible, 500);
492        });
493    }
494}
495
496// Start when DOM is loaded
497document.addEventListener('DOMContentLoaded', initialize);

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.