PageSourceSearch

https://codefluegel.com/wp-content/themes/codefluegel/dist/js/loadmore.blog.ajax.js?ver=7.0.7

js codefluegel.com collected 2026-10-07 15:45:44 UTC 5,283 bytes, 185 lines download raw bytes

1jQuery(function($){ // use jQuery code inside this to avoid "$ is not defined" error	
2    /*
3     * Show More Button
4     */
5    $('.blog-load-more').click(function(){
6
7		var button = $(this),
8			blog_data = {
9				'action': 'blogloadmore',
10				'query': loadmore_blog_params.posts, // that's how we get params from wp_localize_script() function
11				'page' : loadmore_blog_params.current_page
12			};
13
14		$.ajax({ // you can also use $.post here
15			url : loadmore_blog_params.ajaxurl, // AJAX handler
16			data : blog_data,
17			type : 'POST',
18			post_type : 'blog',
19			beforeSend : function ( xhr ) {
20				// change the button text, you can also add a preloader image
21				//button.text('Loading...');
22			},
23			success : function( blog_data ){
24				if( blog_data )
25				{
26					// insert new posts
27					//button.text( 'More posts' ).parent().parent().before(data);
28					//button.parent().parent().before(data);
29					button.parent().parent().parent().parent().find('.thewrap .row').after(blog_data);
30					loadmore_blog_params.current_page++;
31					button.show();
32
33					// if last page, remove the button
34					if ( loadmore_blog_params.current_page == loadmore_blog_params.max_page )
35					{
36						button.hide();
37					}
38
39					// you can also fire the "post-load" event here if you use a plugin that requires it
40					// $( document.body ).trigger( 'post-load' );
41				}
42				else
43				{
44					// if no data, remove the button as well
45					//button.hide();
46				}
47			}
48		});
49	});
50
51
52
53	/*
54     * Filter tag cloud (left)
55     */
56	$('#blog_filters input[type="radio"].blog-cat-filter').change(function(){
57		
58		//should you ever later change radio for checkbox - uncomment this
59		/*
60		if($(this).parent().hasClass('active'))
61		{
62			$(this).parent().removeClass('active');
63		}
64		else
65		{
66			$(this).parent().addClass('active');
67		}
68		*/
69
70		if($(this).hasClass('show-all'))
71		{
72			$(this).parent().parent().parent().find('label').removeClass('active');
73		}
74		else
75		{
76			$(this).parent().parent().find('label').removeClass('active');
77		}
78		$(this).parent().addClass('active');
79
80		$.ajax({
81			url : loadmore_blog_params.ajaxurl,
82			data : $('#blog_filters').serialize(), // form data
83			dataType : 'json', // this data type allows us to receive objects from the server
84			type : 'POST',
85			post_type : 'blog',
86			beforeSend : function(xhr)
87			{
88				//$('#blog_filters').find('button').text('Filtering...');
89			},
90			success : function( data ){
91
92				// when filter applied:
93				// set the current page to 1
94				loadmore_blog_params.current_page = 1;
95
96				// set the new query parameters
97				loadmore_blog_params.posts = data.posts;
98
99				// set the new max page parameter
100				loadmore_blog_params.max_page = data.max_page;
101
102				// change the button label back
103				//$('#blog_filters').find('button').text('Apply filter');
104
105				// insert the posts to the container
106				//$('#misha_posts_wrap').html(data.content);
107				$('#blog_filters').parent().find('.thewrap').empty().html(data.content);
108
109				// hide load more button, if there are not enough posts for the second page
110				if ( data.max_page < 2 )
111				{
112					$('#blog_filters').parent().find('.blog-load-more').hide();
113				}
114				else
115				{
116					$('#blog_filters').parent().find('.blog-load-more').show();
117				}
118			}
119		});
120
121		// do not submit the form
122		return false;
123
124	});
125
126    /*
127     * Filter time (right) - class control
128     */
129    $('#blog_filters .sort-block input[type="radio"]').change(function(){
130
131    });
132
133    /*
134     * Filter time (right) - submit on click
135     */
136    $('#blog_filters .submit').click(function(){
137
138		$(this).parent().parent().find('label').removeClass('active');
139		$(this).parent().addClass('active');
140        $.ajax({
141            url : loadmore_blog_params.ajaxurl,
142            data : $('#blog_filters').serialize(), // form data
143            dataType : 'json', // this data type allows us to receive objects from the server
144            type : 'POST',
145            post_type : 'blog',
146            beforeSend : function(xhr)
147            {
148                //$('#blog_filters').find('button').text('Filtering...');
149            },
150            success : function( data ){
151
152                // when filter applied:
153                // set the current page to 1
154                loadmore_blog_params.current_page = 1;
155
156                // set the new query parameters
157                loadmore_blog_params.posts = data.posts;
158
159                // set the new max page parameter
160                loadmore_blog_params.max_page = data.max_page;
161
162                // change the button label back
163                //$('#blog_filters').find('button').text('Apply filter');
164
165                // insert the posts to the container
166                //$('#misha_posts_wrap').html(data.content);
167                $('#blog_filters').parent().find('.thewrap').empty().html(data.content);
168
169                // hide load more button, if there are not enough posts for the second page
170                if ( data.max_page < 2 )
171                {
172                    $('#blog_filters').parent().find('.blog-load-more').hide();
173                }
174                else
175                {
176                    $('#blog_filters').parent().find('.blog-load-more').show();
177                }
178            }
179        });
180
181        // do not submit the form
182        return false;
183    });
184});
185

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.