PageSourceSearch

https://www.oudalbarari.com/wp-content/themes/xtra/assets/js/search.js?ver=6.9.9

js oudalbarari.com collected 2026-09-24 14:50:31 UTC 5,032 bytes, 181 lines download raw bytes

1jQuery( function( $ ) {
2
3	var body = $( document.body ),
4		caty = $( '.codevz-search-category' );
5
6	// Header search custom category selection list.
7	body.on( 'click', '.codevz-search-category > strong', function() {
8
9		caty.find( '> div' ).slideToggle( 'fast' );
10
11	}).on( 'click', '.codevz-search-category li', function() {
12
13		var $this = $( this );
14
15		$this.addClass( 'codevz-active' ).siblings().removeClass( 'codevz-active' );
16
17		caty.find( '> div' ).slideUp( 'fast' );
18
19		caty.find( '> strong span' ).html( $this.text() );
20
21		caty.find( '> input' ).val( $this.attr( 'data-cat' ) ).trigger( 'change' );
22
23	});
24
25	// Header search forms.
26	if ( $( '.outer_search' ).length ) {
27
28		// non-required hidden fields for submit form.
29		var hidden = $( '.outer_search input[type="hidden"]' ).not( 'input[name="post_type"],input[name="prcat"],input[name="lang"]' );
30
31		// Add disabled attr to hidden inputs.
32		hidden.attr( 'disabled', 'disabled' );
33
34		// Input changes.
35		body.on( 'keyup', '.cz_ajax_search [name="s"]', function( e, time ) {
36
37			clearTimeout( time );
38
39			var form    = $( this ).parent(),
40				results = form.next( '.ajax_search_results' ),
41				icon 	= $( 'button i', form ),
42				org 	= 'fa ' + icon.data( 'xtra-icon' ),
43				iLoader = 'fa fa-superpowers fa-pulse';
44
45			// Check input length.
46			if ( $( this ).val().length < 3 ) {
47				$( '.ajax_search_results' ).slideUp( 'fast' );
48				icon.removeClass( iLoader ).addClass( org );
49				return;
50			} else {
51				icon.removeClass( org ).addClass( iLoader );
52			}
53
54			// Temporary enable for AJAX.
55			hidden.removeAttr( 'disabled' );
56
57			// Send request
58			time = setTimeout(
59				function() {
60					$.ajax({
61						type: "GET",
62						url: body.data( 'ajax' ) || ajaxurl,
63						dataType: 'html',
64						data: "action=codevz_ajax_search&" + form.serialize(),
65						success: function( data ) {
66							results.html( data ).slideDown( 'fast' );
67							icon.removeClass( iLoader ).addClass( org );
68							hidden.attr( 'disabled', 'disabled' );
69						},
70						error: function( xhr, status, error ) {
71							results.html( '<b class="ajax_search_error">' + error + '</b>' ).slideDown( 'fast' );
72							icon.removeClass( iLoader ).addClass( org );
73							hidden.attr( 'disabled', 'disabled' );
74							console.log( xhr, status, error );
75						}
76					});
77
78					// Plugins compatibility.
79					var searchUrl = window.location.href.split('?')[0] + '?s=' + encodeURIComponent( form.find( '[name="s"]' ).val() );
80					$.ajax({
81						type: "GET",
82						url: searchUrl,
83						success: function( data ) {}
84					});
85				},
86				1000
87			);
88
89		// Search icon
90		}).on( 'click', '.search_with_icon', function( e ) {
91
92			e.stopPropagation();
93
94		}).on( 'click', '.search_with_icon [name="s"]', function() {
95
96			if ( $( this ).val() ) {
97				$( '.ajax_search_results' ).slideDown( 'fast' );
98			}
99
100		// Search dropdown.
101		}).on( 'click', '.search_style_icon_dropdown .xtra-search-icon', function() {
102
103			var x 		= $( this ),
104				outer 	= x.parent().find('.outer_search'),
105				row_h 	= x.closest('.row').height(),
106				clr 	= x.closest('.clr');
107
108			if ( outer.is( ':visible' ) ) {
109				outer.fadeOut( 'fast' );
110			} else {
111				outer.fadeIn( 'fast' ).find('input').trigger( 'focus' );
112			}
113
114		// Auto x-position search in header.
115		}).on( 'mouseenter', '.search_style_icon_dropdown', function() {
116
117			var x 			= $( this ),
118				iconX 		= x.find( '.xtra-search-icon' ),
119				iconWidth 	= iconX.outerWidth(),
120				dropdown  	= x.find( '.outer_search' );
121
122			if ( ( $( window ).width() / 2 ) > ( x.offset().left + 100 ) ) {
123
124				x.addClass( 'inview_right' );
125
126				var iconMl = parseFloat( iconX.css( 'marginLeft' ) );
127
128				if ( body.hasClass( 'rtl' ) ) {
129					dropdown.css( 'left', ( ( iconWidth / 2 ) - 38 + iconMl ) );
130				} else {
131					dropdown.css( 'left', -( ( iconWidth / 2 ) - 36 + iconMl ) );
132				}
133
134			} else {
135
136				dropdown.css( 'right', ( ( iconWidth / 2 ) - 36 + parseFloat( iconX.css( 'marginRight' ) ) ) );
137
138			}
139
140		// Search fullscreen.
141		}).on( 'click', '.search_style_icon_full .xtra-search-icon', function( e ) {
142
143			var x = $( this );
144
145			x.parent().find( '.outer_search' ).fadeIn( 'fast' ).find( 'input' ).trigger( 'focus' );
146
147			$( window ).on( 'resize.search', function() {
148
149				var t = $( this ),
150					w = t.width(),
151					h = t.height(),
152					s = t.find('.outer_search .search');
153
154				s.css({
155					'top': h / 4 - s.height() / 2,
156					'left': w / 2 - s.width() / 2
157				});
158
159			});
160
161			x.parent().find( '.xtra-close-icon' ).toggleClass( 'hide' ).off().on( 'click', function( e ) {
162				$( this ).addClass( 'hide' ).parent().find('.outer_search').fadeOut( 'fast' );
163			});
164
165		}).on( 'click', function( e ) {
166
167			if ( $( e.target ).closest( '.outer_search .search' ).length ) {
168				return;
169			}
170
171			body.find( '.ajax_search_results' ).fadeOut( 'fast' );
172			body.find( '.search_style_icon_dropdown, .search_style_icon_full' ).find( '.outer_search' ).fadeOut( 'fast' );
173			body.find( '.search_style_icon_full .xtra-close-icon' ).addClass( 'hide' );
174
175			caty.find( '>
175 div' ).slideUp( 'fast' );
176
177		});
178
179	}
180
181});

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.