PageSourceSearch

https://www.cicnews.com/wp-content/themes/cic/js/post_filter.js?ver=6.9.4

js cicnews.com collected 2026-10-02 02:33:38 UTC 4,455 bytes, 150 lines download raw bytes

1jQuery(function($){
2	$('#post_loadmore').click(function(){
3		$.ajax({
4			url : post_loadmore_params.ajaxurl,
5			data : {
6				'action': 'postloadmore',
7				'query': post_loadmore_params.posts,
8				'page' : post_loadmore_params.current_page
9			},
10			type : 'POST',
11			beforeSend : function ( xhr ) {
12				$('#post_loadmore').text('Loading...');
13			},
14			success : function( posts ){
15				if( posts ) {
16					$('#post_loadmore').text($('#post_loadmore').attr('data-label'));
17					$('#post_wrapper').append( posts );
18					filterCounter();
19					post_loadmore_params.current_page++;
20					if ( post_loadmore_params.current_page == post_loadmore_params.max_page ) 
21						$('#post_loadmore').hide();
22 
23				} else {
24					$('#post_loadmore').hide();
25				}
26			}
27		});
28		return false;
29	});
30	$('#post_filters input:not(.filter-search-input)').change(function(){
31		filterPost();
32		return false;
33	});
34	$('.filter-control__btn button').click(function(){
35		$('body,html').animate({scrollTop: $('.filter__container').offset().top - 60}, 200);
36		$('.filter__content').removeClass('show');
37		return false;
38	});
39	$('body').on('click','.filter-control__tag i', function(){
40		var id = $(this).parent().attr('data-id');
41		$('.filter-item li input[value='+id+']').prop('checked',false);
42		$(this).closest('li').remove();
43		filterPost();
44	});
45	$('body').on('click','.filter-control__clear span,.filter-notfound__text span', function(e){
46		$('.filter-item li input').each(function(){
47			$(this).prop('checked', false);
48		});
49		filterPost();
50		e.preventDefault();
51	});
52	$('body').on('click','.filter-item_sort .filter-item__popup span', function(){
53		$('.filter input[name="filter_sort"]').val($(this).attr('data-sort-value'));
54		$('.filter-label-sort').text($(this).text());
55		$('.filter-item_sort').removeClass('opened');
56		filterPost();
57	});
58	filterPost();
59});
60function filterPost(){
61	$.ajax({
62		url : post_loadmore_params.ajaxurl,
63		data : $('#post_filters').serialize(),
64		dataType : 'json',
65		type : 'POST',
66		beforeSend : function(xhr){
67			$('.filter-loader').show();
68		},
69		success : function( data ){
70			post_loadmore_params.current_page = 1;
71			post_loadmore_params.posts = data.posts;
72			post_loadmore_params.max_page = data.max_page;
73			$('#post_wrapper').html(data.content);
74			$('.filter-loader').hide();
75			if ( data.max_page < 2 ){
76				$('#post_loadmore').hide();
77			} else {
78				$('#post_loadmore').show();
79			}
80			$('.post-catalog').addClass('show');
81			if(data.content.includes('post-catalog__col')){
82				$('.post-catalog__total').show();
83			}else{
84				$('.post-catalog__total').hide();
85			}
86			filterTags();
87			filterActives();
88			filterCounter();
89			$('.catalog-posts').addClass('initialized');
90			$('.filter__result').show();
91			catMoreInit();
92			$('.filter__content').removeClass('show');
93		},
94		error : function(request){
95			console.log(request);
96		}
97	});
98}
99function filterTags(){
100	$('.filter-control li').remove();
101	var i = 0;
102	$('.filter-item li input').each(function(){
103		if($(this).is(':checked')){
104			i++;
105			var text = $(this).siblings('span').text();
106			var id = $(this).val();
107			var tag = '<li class="filter-control__tag"><span data-id='+id+'>'+text+'<i><svg width="10" height="9" viewBox="0 0 10 9"><use xlink:href="#icon-close"></use></svg></i></span></li>';
108			$('.filter-control ul').append(tag);
109		}
110	});
111	if(i > 0) $('.filter-control ul').append('<li class="filter-control__clear"><span>Clear all</span></li>');
112}
113function filterActives(){
114	let tt = 0;
115	$('.filter-item').each(function(){
116		let t = $(this).find('input:checked').length;
117		tt += t;
118		let n = $(this).find('.filter-label-num');
119		if(t > 0){
120			n.show();
121		}else{
122			n.hide();
123		}
124		n.text(t);
125	});
126	$('.filter__headline i').text(tt);
127	if(tt > 0){
128		$('.filter__headline i').css('display','flex');
129		$('.filter').addClass('checked');
130	}else{
131		$('.filter__headline i').hide();
132		$('.filter').removeClass('checked');
133	}
134}
135function filterCounter(){
136	let v = $('#post_wrapper .post-item').length;
137	let t = $('input[name=filter_total]').val();
138	$('.catalog-nav__viewed .num-loaded').text(v);
139	$('.catalog-nav__viewed .num-total,.filter__result span,.filter-control__btn span').text(t);
140	let p = v/t*100;
141	$('.catalog-nav__line span').css('width',p+'%');
142	if(t > 0){
143		$('.catalog-nav').show();
144	}else{
145		$('.catalog-nav').hide();
146	}
147}
148
149
150

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.