PageSourceSearch

https://mutasport.nl/wp-content/themes/mutasport/vendor/bstcm-loadmore/js/bstcm-loadmore.js?ver=7.1.3

js mutasport.nl collected 2026-10-08 23:41:28 UTC 5,336 bytes, 134 lines download raw bytes

1// Ajax load more posts
2
3var $content = jQuery('.ajax_posts');
4var $loader = jQuery('#more_posts');
5
6//var bstcm_loadajax_offset = jQuery('.ajax_posts').find('.ajaxpost').length;
7
8$loader.on( 'click', bstcm_load_ajax_posts );
9
10function bstcm_load_ajax_posts() {
11
12    if ( undefined == bstcm_ajax_load_more.bstcm_loadjax_offset ) {
13        //console.log('Huh? Geen offset, ik gebruik die van de button... jank');
14        bstcm_ajax_load_more.bstcm_loadjax_offset = $loader.data('offset');
15    }
16
17    console.log( 'fetching data' );
18
19    var bstcm_loadajax_offset = bstcm_ajax_load_more.bstcm_loadjax_offset;
20    var bstcm_loadajax_total = $loader.data('total');
21    var bstcm_loadajax_post_type = $loader.data('posttype');
22    var bstcm_loadajax_postnotin = $loader.data('postnotin');
23    var bstcm_loadajax_taxonomy = $loader.data('tax');
24    var bstcm_loadajax_term = $loader.data('term');
25    var bstcm_loadajax_ppp = $loader.data('ppp');
26    var bstcm_loadajax_querytype = $loader.data('querytype');
27    var bstcm_loadajax_orderby = $loader.data('orderby');
28    var bstcm_loadajax_metakey = $loader.data('metakey');
29    var bstcm_loadajax_metaquery_key = $loader.data('metaquery_key');
30    var bstcm_loadajax_metaquery_value = $loader.data('metaquery_value');
31    var bstcm_loadajax_metaquery_compare = $loader.data('metaquery_compare');
32    var bstcm_loadajax_metaquery_type = $loader.data('metaquery_type');
33    var bstcm_loadajax_order = $loader.data('order');
34    var bstcm_loadajax_orderby = $loader.data('orderby');
35
36    if ( !($loader.hasClass('post_loading_loader') || $loader.hasClass('post_no_more_posts')) ) {
37
38		console.log('post_type: '+bstcm_loadajax_post_type);
39		console.log('taxonomy: '+bstcm_loadajax_taxonomy);
40		console.log('term: '+bstcm_ajax_load_more.bstcm_loadajax_term);
41		console.log('offset: '+bstcm_ajax_load_more.bstcm_loadjax_offset);
42		console.log('total: '+bstcm_ajax_load_more.bstcm_loadajax_total);
43        console.log('post__not_in: '+bstcm_loadajax_postnotin);
44        console.log('querytype: '+bstcm_loadajax_querytype);
45		console.log('meta_key: '+bstcm_loadajax_metakey);
46		console.log('meta_query_key: '+bstcm_loadajax_metaquery_key);
47		console.log('meta_query_value: '+bstcm_loadajax_metaquery_value);
48		console.log('meta_query_compare: '+bstcm_loadajax_metaquery_compare);
49		console.log('meta_query_type: '+bstcm_loadajax_metaquery_type);
50		console.log('posts_per_page: '+bstcm_loadajax_ppp);
51        console.log('order by: '+bstcm_loadajax_orderby);
52
53	    filterData = {
54		    'post_type' : bstcm_loadajax_post_type,
55            'ppp': bstcm_loadajax_ppp,
56			'total': bstcm_loadajax_total,
57            'offset': bstcm_ajax_load_more.bstcm_loadjax_offset,
58            'orderby':bstcm_loadajax_orderby,
59            'postnotin':bstcm_loadajax_postnotin,
60            'querytype':bstcm_loadajax_querytype,
61            'order':bstcm_loadajax_order,
62            'action': 'bstcm_ajax_load_more'
63	    };
64
65	    if ( bstcm_loadajax_taxonomy && bstcm_ajax_load_more.bstcm_loadajax_term ) {
66		    jQuery.extend(filterData,
67		    	{
68			    	'post_term': bstcm_ajax_load_more.bstcm_loadajax_term,//bstcm_loadajax_term,
69			  		'post_tax' : bstcm_loadajax_taxonomy,
70		    	}
71		    );
72	    }
73
74	    if ( bstcm_loadajax_metaquery_key && bstcm_loadajax_metaquery_value && bstcm_loadajax_metaquery_compare ) {
75		    jQuery.extend(filterData,
76		    	{
77			    	'metaquery_key': bstcm_loadajax_metaquery_key,
78			  		'metaquery_value' : bstcm_loadajax_metaquery_value,
79			  		'metaquery_compare' : bstcm_loadajax_metaquery_compare,
80			  		'metaquery_type' : bstcm_loadajax_metaquery_type,
81		    	}
82		    );
83	    }
84
85	    if ( bstcm_loadajax_metakey ) {
86		    jQuery.extend(filterData,
87		    	{
88			    	'metakey': bstcm_loadajax_metakey,
89		    	}
90		    );
91	    }
92
93	    console.log("Calling loadmore AJAX function with arguments:");
94	    console.log(filterData);
95
96	    var originalText = $loader.html();
97
98        jQuery.ajax({
99            type: 'POST',
100            dataType: 'json',
101            url: bstcm_ajax_load_more.ajaxurl,
102            data: filterData,
103            beforeSend : function () {
104                //$loader.addClass('post_loading_loader').html('Bezig met laden');
105                $loader.addClass('post_loading_loader');
106            },
107            success: function (data) {
108				console.log(data);
109                var $data = jQuery(data.content);
110                if ($data.length) {
111                    var $newElements = $data.css({ opacity: 0 });
112                    $content.append($newElements);
113                    $newElements.animate({ opacity: 1 });
114                    $loader.removeClass('post_loading_loader').html(originalText);
115
116					if ( false == data.hasmore ) {
117						$loader.removeClass('post_loading_loader').addClass('post_no_more_posts');
118					}
119
120                } else {
121                    $loader.removeClass('post_loading_loader').addClass('post_no_more_posts');
122                }
123            },
124            error : function (jqXHR, textStatus, errorThrown) {
125                $loader.html($.parseJSON(jqXHR.responseText) + ' :: ' + textStatus + ' :: ' + errorThrown);
126                console.log(jqXHR);
127            },
128        });
129    }
130    bstcm_loadajax_offset += bstcm_loadajax_ppp;
131    bstcm_ajax_load_more.bstcm_loadjax_offset += bstcm_loadajax_ppp;
132
133    return false;
134}

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.