PageSourceSearch

https://www.pvamu.edu/wp-content/plugins/ellucian-microsoft-graph-employee-list/js/load-more.js?ver=2.0.0

js pvamu.edu collected 2026-10-01 10:18:11 UTC 2,328 bytes, 70 lines download raw bytes

1/**
2 * Accessible "Load more" for the faculty/staff directory.
3 * - Announces loading/loaded/error state to AT via aria-live.
4 * - Keeps focus on the triggering button; when all results load and the button
5 *   is removed, focus moves to the status region so it is not lost.
6 */
7(function ($) {
8	'use strict';
9
10	const i18n = (window.faculty_staff_directory && window.faculty_staff_directory.i18n) || {};
11	const txt = function (key, fallback) {
12		return Object.prototype.hasOwnProperty.call(i18n, key) ? i18n[key] : fallback;
13	};
14
15	$(function () {
16		const $button = $('#faculty-staff-directory-load-more');
17		if (!$button.length) {
18			return;
19		}
20		const $list   = $('#faculty-staff-directory');
21		const $status = $('#faculty-staff-directory-load-more-status');
22		let nextParam = $button.data('next');
23
24		$button.on('click', function (e) {
25			e.preventDefault();
26			if (!nextParam) {
27				return;
28			}
29			const $self = $(this);
30			$self.addClass('is-loading').prop('disabled', true).attr('aria-busy', 'true');
31			$status.text(txt('loading', 'Loading more results…'));
32
33			$.ajax({
34				type: 'POST',
35				url: window.faculty_staff_directory.ajax_url,
36				dataType: 'json',
37				data: {
38					action: window.faculty_staff_directory.action,
39					next: nextParam,
40					nonce: window.faculty_staff_directory.nonce
41				}
42			}).done(function (response) {
43				if (!response || !response.success || !response.data) {
44					$status.text(txt('error', 'Could not load more results. Please try again.'));
45					$self.removeClass('is-loading').prop('disabled', false).removeAttr('aria-busy');
46					return;
47				}
48
49				const data = response.data;
50				if (data.content) {
51					$list.append(data.content);
52				}
53
54				if (data.next) {
55					nextParam = data.next;
56					$self.data('next', nextParam).attr('data-next', nextParam);
57					$self.removeClass('is-loading').prop('disabled', false).removeAttr('aria-busy');
58					$status.text(txt('loaded', 'Additional results loaded.'));
59				} else {
60					$status.text(txt('no_more', 'All results loaded.'));
61					$status.attr('tabindex', '-1').trigger('focus');
62					$self.remove();
63				}
64			}).fail(function () {
65				$status.text(txt('error', 'Could not load more results. Please try again.'));
66				$self.removeClass('is-loading').prop('disabled', false).removeAttr('aria-busy');
67			});
68		});
69	});
70})(jQuery);

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.