PageSourceSearch

https://www.cjsa.org/_static/??-eJytjrEWgjAMRX/IGnBRBo/fUkuEQJvmNE…/otXdtz11zaU9N20xvmPbIH

js cjsa.org collected 2026-10-07 15:45:06 UTC 10,256 bytes, 213 lines download raw bytes

1const facetedDropdown = () => {
2	let INITIAL_LOAD = false;
3
4	// Define selectors.
5	const DROPDOWN_PARENT = ".search-filters-dropdown";
6	const DROPDOWN_OPTIONS = ".sec-catalog-facet-dropdown a";
7	const DROPDOWN = ".facetwp-facet.facetwp-type-dropdown";
8	const DROPDOWN_LABEL = "a.sec-catalog-facet-dropdown-value";
9
10	document.addEventListener("facetwp-loaded", function () {
11		const dropdowns = document.querySelectorAll(DROPDOWN_PARENT);
12
13		dropdowns.forEach((dropdown) => {
14			const selectWrapper = dropdown.querySelector(".facetwp-type-dropdown");
15			const select = dropdown.querySelector("select.facetwp-dropdown");
16			const name = selectWrapper.getAttribute("data-name");
17			dropdown.setAttribute("for", name);
18			select.setAttribute("id", name);
19			select.setAttribute("name", name);
20		});
21	});
22};
23
24facetedDropdown();
25;
26const facetedSort = () => {
27	let INITIAL_LOAD = true;
28	let FOCUSED_SORT_TOGGLE = null;
29
30	// Define selectors.
31	const SORT_FACET = "sort_facet";
32	const COLUMN_SORT_PARENT = ".se-catalog-result-table-column-sort";
33	const COLUMN_SORTERS = ".se-catalog-result-table-column-sort .sorter";
34	const COLUMN_SORT_TOGGLE = ".se-catalog-result-table-column-sort-toggle";
35	const DEFAULT_SORT =
36		".se-catalog-result-table-column-sort-toggle .sorter.default-sort";
37	const ACTIVE_CLASS = "active";
38	const ACTIVE_CLASS_FA = "fa-solid";
39	const INACTIVE_CLASS_FA = "fa-regular";
40
41	const initialLoad = () => {
42		const handleSorterClick = (columnSorterToggle) => {
43			let sortingButton = null;
44			// Depending on if the main button or a child was pushed, we want to set sortingButton to the actual button.
45			if (
46				columnSorterToggle.target.classList.contains(
47					"se-catalog-result-table-column-sort-toggle"
48				)
49			) {
50				sortingButton = columnSorterToggle.target;
51			} else {
52				sortingButton = columnSorterToggle.target.closest(COLUMN_SORT_TOGGLE);
53			}
54
55			if (!sortingButton) {
56				console.error("Sorting Button not found.");
57				return;
58			}
59
60			const columnSorter = sortingButton.querySelector(COLUMN_SORT_PARENT);
61
62			if (!columnSorter) {
63				console.error("Sorting arrows container not found.");
64				return;
65			}
66
67			if (document.activeElement === sortingButton) {
68				FOCUSED_SORT_TOGGLE = sortingButton;
69			} else {
70				FOCUSED_SORT_TOGGLE = null;
71			}
72
73			const currentSortState = columnSorter.getAttribute("sort");
74			let newSort = "descending";
75			// This works for initial loading and for subsequent togglings. The new sort will only be descending if the currentSortState is ascending, which won't be on initial load.
76			if ("descending" === currentSortState) {
77				newSort = "ascending";
78			}
79
80			const sorter = columnSorter.querySelector(
81				'[data-sort="' + newSort + '"]'
82			);
83
84			const facet_value = sorter.getAttribute("data-value");
85			FWP.facets[SORT_FACET] = [facet_value];
86			FWP.toggleOverlay("on");
87			FWP.fetchData();
88			FWP.setHash();
89			return false;
90		};
91
92		// Get all of the column sorting parents.
93		const sorters = document.querySelectorAll(COLUMN_SORT_TOGGLE);
94		// Handle each of the dropdown's options clicks.
95		sorters.forEach((option) => {
96			option.addEventListener("click", handleSorterClick, false);
97		});
98
99		// If this is the first load.
100		if (INITIAL_LOAD) {
101			// See if there is a default sort set on any of the columns.
102			const defaultSort = document.querySelector(DEFAULT_SORT);
103			if (
104				defaultSort && // If there is a default sort.
105				null === FWP.active_facet && // And no other facets are active.
106				0 === FWP.facets.sort_facet.length // And the sort_facet is empty.
107			) {
108				// Activate the default sort.
109				defaultSort.click();
110			}
111		}
112
113		INITIAL_LOAD = false;
114	};
115	// Wait for FacetWP to load...
116	document.addEventListener("facetwp-loaded", function () {
117		// Initial Load.
118		initialLoad();
119		// Remove the .active class from all the sort arrows.
120		const sorters = document.querySelectorAll(COLUMN_SORTERS);
121		sorters.forEach((option) => {
122			option.classList.remove(ACTIVE_CLASS);
123			option.parentNode.setAttribute("sort", "");
124			option.closest("th").setAttribute("aria-sort", "none");
125		});
126		// If there is a current active sorting, add the .active class to the appropriate arrow.
127		if ("undefined" !== typeof FWP.facets[SORT_FACET]) {
128			const activeSortArrow = document.querySelector(
129				'[data-value="' + FWP.facets[SORT_FACET] + '"]'
130			);
131			if (activeSortArrow) {
132				activeSortArrow.classList.add(ACTIVE_CLASS);
133				const currentSort = activeSortArrow.getAttribute("data-sort");
134				activeSortArrow.parentNode.setAttribute("sort", currentSort);
135				activeSortArrow.closest("th").setAttribute("aria-sort", currentSort);
136
137				if (FOCUSED_SORT_TOGGLE) {
138					activeSortArrow.closest(COLUMN_SORT_TOGGLE).focus();
139					FOCUSED_SORT_TOGGLE = null;
140				}
141			}
142		}
143	});
144
145	document.addEventListener("facetwp-refresh", function () {});
146};
147
148facetedSort();
149;
150const facetedPagination = () => {
151	// Wait for FacetWP to load...
152	document.addEventListener("facetwp-loaded", function () {
153		const catalogResultsMeta = document.querySelector(
154			".se-catalog-results-meta"
155		);
156
157		if (catalogResultsMeta && FWP) {
158			const totalRows = FWP.settings.pager.total_rows;
159			const currentPage = FWP.settings.pager.page;
160			const totalPages = FWP.settings.pager.total_pages;
161
162			const totalRowsElement =
163				catalogResultsMeta.querySelector("span.total-rows");
164			const currentPageElement =
165				catalogResultsMeta.querySelector("span.current-page");
166			const totalPagesElement =
167				catalogResultsMeta.querySelector("span.total-pages");
168
169			if (totalRowsElement && totalRows) {
170				totalRowsElement.innerText = totalRows;
171			}
172			if (currentPageElement && currentPage) {
173				currentPageElement.innerText = currentPage;
174			}
175			if (totalPagesElement && totalPages) {
176				currentPageElement.innerText = currentPage;
177			}
178		}
179	});
180
181	document.addEventListener("facetwp-refresh", function () {});
182};
183
184facetedPagination();
185;
186const facetedSearch = () => {
187	const FORM = ".se-catalog-search-form form";
188	const forms = document.querySelectorAll(FORM);
189	if (!forms) {
190		return;
191	}
192	forms.forEach((form) => {
193		form.addEventListener("submit", function (e) {
194			e.preventDefault();
195			FWP.refresh();
196		});
197	});
198};
199
200facetedSearch();
201;
202function ga_skiplinks(){"use strict";var fragmentID=location.hash.substring(1);if(fragmentID){var element=document.getElementById(fragmentID);element&&(!1===/^(?:a|select|input|button|textarea)$/i.test(element.tagName)&&(element.tabIndex=-1),element.focus())}}window.addEventListener?window.addEventListener("hashchange",ga_skiplinks,!1):window.attachEvent("onhashchange",ga_skiplinks);;
203/*
204 GPL-2.0+
205*/
206(function(p,b,y){function q(){var a=b('button[id^\x3d"genesis-mobile-"]').attr("id");if("undefined"!==typeof a){"none"===l(a)&&(b(".menu-toggle, .genesis-responsive-menu .sub-menu-toggle").removeClass("activated").attr("aria-expanded",!1).attr("aria-pressed",!1),b(".genesis-responsive-menu, .genesis-responsive-menu .sub-menu").attr("style",""));var c=b(".genesis-responsive-menu .js-superfish"),d="destroy";"function"===typeof c.superfish&&("none"===l(a)&&(d={delay:100,animation:{opacity:"show",height:"show"},
207dropShadows:!1,speed:"fast"}),c.superfish(d));r(a);t(a)}}function u(){var a=b(this),c=a.next("nav");a.attr("id","genesis-mobile-"+b(c).attr("class").match(/nav-\w*\b/))}function t(a){if(null!=f){var c=f[0],d=b(f).filter(function(a){if(0<a)return a});"none"!==l(a)?(b.each(d,function(a,d){b(d).find(".menu \x3e li").addClass("moved-item-"+d.replace(".","")).appendTo(c+" ul.genesis-nav-menu")}),b(k(d)).hide()):(b(k(d)).show(),b.each(d,function(a,d){b(".moved-item-"+d.replace(".","")).appendTo(d+" ul.genesis-nav-menu").removeClass("moved-item-"+
208d.replace(".",""))}))}}function v(){var a=b(this);m(a,"aria-pressed");m(a,"aria-expanded");a.toggleClass("activated");a.next("nav").slideToggle("fast")}function w(){var a=b(this),c=a.closest(".menu-item").siblings();m(a,"aria-pressed");m(a,"aria-expanded");a.toggleClass("activated");a.next(".sub-menu").slideToggle("fast");c.find(".sub-menu-toggle").removeClass("activated").attr("aria-pressed","false");c.find(".sub-menu").slideUp("fast")}function r(a){var c=n();0< !b(c).length||b.each(c,function(d,
209c){var e=c.replace(".","");d="genesis-"+e;var h="genesis-mobile-"+e;"none"==l(a)&&(d="genesis-mobile-"+e,h="genesis-"+e);e=b('.genesis-skip-link a[href\x3d"#'+d+'"]');null!==f&&c!==f[0]&&e.toggleClass("skip-link-hidden");0<e.length&&(c=e.attr("href"),c=c.replace(d,h),e.attr("href",c))})}function l(a){a=p.getElementById(a);return window.getComputedStyle(a).getPropertyValue("display")}function m(a,b){a.attr(b,function(a,b){return"false"===b})}function k(a){return b.map(a,function(a,b){return a}).join(",")}
210function n(){var a=[];null!==f&&b.each(f,function(b,d){a.push(d.valueOf())});b.each(e.others,function(b,d){a.push(d.valueOf())});return 0<a.length?a:null}var g="undefined"===typeof genesis_responsive_menu?"":genesis_responsive_menu,e={},f=[];b.each(g.menuClasses,function(a){e[a]=[];b.each(this,function(c,d){c=b(d);1<c.length?b.each(c,function(c,g){c=d+"-"+c;b(this).addClass(c.replace(".",""));e[a].push(c);"combine"===a&&f.push(c)}
210):1==c.length&&(e[a].push(d),"combine"===a&&f.push(d))})});"undefined"==
211typeof e.others&&(e.others=[]);1==f.length&&(e.others.push(f[0]),f=e.combine=null);var x={init:function(){if(0!=b(n()).length){var a="undefined"!==typeof g.menuIconClass?g.menuIconClass:"dashicons-before dashicons-menu",c="undefined"!==typeof g.subMenuIconClass?g.subMenuIconClass:"dashicons-before dashicons-arrow-down-alt2",d=b("\x3cbutton /\x3e",{"class":"menu-toggle","aria-expanded":!1,"aria-pressed":!1}).append(g.mainMenu),h=b("\x3cbutton /\x3e",{"class":"sub-menu-toggle","aria-expanded":!1,"aria-pressed":!1}).append(b("\x3cspan /\x3e",
212{"class":"screen-reader-text",text:g.subMenu}));b(k(e)).addClass("genesis-responsive-menu");b(k(e)).find(".sub-menu").before(h);null!==f?(h=e.others.concat(f[0]),b(k(h)).before(d)):b(k(e.others)).before(d);b(".menu-toggle").addClass(a);b(".sub-menu-toggle").addClass(c);b(".menu-toggle").on("click.genesisMenu-mainbutton",v).each(u);b(".sub-menu-toggle").on("click.genesisMenu-subbutton",w);b(window).on("resize.genesisMenu",q).triggerHandler("resize.genesisMenu")}}};b(p).ready(function(){null!==n()&&
213x.init()})})(document,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.