PageSourceSearch

https://naukas.com/fx/plugins/authors-list/backend/assets/js/front.js?ver=2.0.6.2

js naukas.com collected 2026-09-24 08:58:35 UTC 3,877 bytes, 99 lines download raw bytes

1jQuery( window ).on( 'load', function() {
2	/* global authorsListAjaxSearch */
3	if ( typeof authorsListAjaxSearch !== 'undefined' ) {
4		const buttonClick = jQuery( '.authors-list-search-filter-submit' );
5		const numberRange = buttonClick.closest( '.authors-list-ajax-filter' ).find( '.authors-list-number-range' );
6
7		jQuery.each( numberRange, function( index, value ) {
8			const numberRangeHolder = jQuery( value ).find( '.authors-list-number-range-holder' );
9			const minRange = jQuery( numberRangeHolder ).data( 'min' );
10			const maxRange = jQuery( numberRangeHolder ).data( 'max' );
11			const numberSelectedElem = jQuery( value ).find( 'input[type="hidden"]' );
12			const rangeRender = jQuery( this ).find( '.authors-list-ranges' );
13			const rangeMinRender = rangeRender.find( '.authors-list-min-range' );
14			const rangeMaxRender = rangeRender.find( '.authors-list-max-range' );
15
16			// For the number slider range.
17			numberRangeHolder.slider( {
18				range: true,
19				min: minRange,
20				max: maxRange,
21				values: [ minRange, maxRange ],
22				slide: function( event, ui ) {
23					// Update the HTMl to display the number ranges on slide change.
24					jQuery( rangeMinRender ).html( ui.values[ 0 ] );
25					jQuery( rangeMaxRender ).html( ui.values[ 1 ] );
26					// Pass the value to the hidden type input for processing in Ajax request.
27					numberSelectedElem.val( ui.values );
28				},
29			} );
30		} );
31
32		buttonClick.on( 'click', function( event ) {
33			event.preventDefault();
34			const parentElem = jQuery( this ).closest( '.authors-list-ajax-filter' );
35			const loopElem = parentElem.next( '.authors-list-items' );
36			const ajaxSelectFilters = parentElem.find( '[class*="metadata"]' );
37			let className = '';
38			let inputType = '';
39			const checkboxexValues = [];
40			const ajaxFiltersData = {};
41
42			// Add `authors-list-ajax-loading` class for button click event on main div.
43			loopElem.addClass( 'authors-list-ajax-loading' );
44
45			jQuery.each( ajaxSelectFilters, function( index, value ) {
46				className = jQuery( value ).attr( 'class' );
47				className = className.replace( 'authors-list-search-', '' ).replace( '-metadata', '' );
48				inputType = jQuery( value ).attr( 'type' );
49				if ( 'checkbox' === inputType ) {
50					const checked = jQuery( value ).is( ':checked' );
51					if ( true === checked ) {
52						checkboxexValues.push( jQuery( value ).val() );
53						checkboxexValues.join();
54						// Assign the output data to an object.
55						ajaxFiltersData[ className ] = Object.assign( {}, checkboxexValues );
56					}
57				} else if ( 'radio' === inputType ) {
58					const checked = jQuery( value ).is( ':checked' );
59					if ( true === checked ) {
60						// Assign the output data to an object.
61						ajaxFiltersData[ className ] = jQuery( value ).val();
62					}
63				} else {
64					// Assign the output data to an object.
65					ajaxFiltersData[ className ] = jQuery( value ).val();
66				}
67			} );
68
69			jQuery.ajax( {
70				type: 'post',
71				dataType: 'json',
72				url: authorsListAjaxSearch.ajaxurl,
73				data: {
74					action: 'update_authors_list_ajax',
75					authorsListNonce: authorsListAjaxSearch.nonce,
76					shortcode: parentElem.find( '.authors-list-search-shortcode' ).val(),
77					searchParam: parentElem.find( '.authors-list-search-input' ).val(),
78					searchColumn: parentElem.find( '.authors-list-search-column' ).val(),
79					ajaxFiltersData,
80				},
81				beforeSend: function() {
82					loopElem.find( '.spinner' ).show();
83				},
84				success: function( response ) {
85					if ( true === response.success ) {
86						loopElem.html( response.data );
87					}
88				},
89				complete: function( jqXHR, textStatus ) {
90					if ( 'success' === textStatus ) {
91						// Remove `authors-list-ajax-loading` class when the Ajax loading is successfully done from main div.
92						loopElem.removeClass( 'authors-list-ajax-loading' );
93						loopElem.find( '.spinner' ).hide();
94					}
95				},
96			} );
97		} );
98	}
99} );

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.