PageSourceSearch

https://www.bbkult.net/wp-content/plugins/tf-post-filter/public/js/tf-post-filter-public.js?ver=1.0.3

js bbkult.net collected 2026-10-02 10:24:32 UTC 10,751 bytes, 282 lines download raw bytes

1(function( $ )
2{
3	'use strict';
4
5    // DOM ready
6    $(function()
7    {
8        if ($('#postfilter').length > 0)
9        {
10            var currentRequestPostFilter = null;
11            var posts_per_page = 12;
12            var page = 1;
13
14
15
16            // Default Selections - Search Taxonomy
17            if (postFilterData.defaultSelectionTaxonomy)
18            {
19                // Taxonomy: category
20                if ($('input[name="search_category"][value="' + postFilterData.defaultSelectionTaxonomy.term_id + '"]').length > 0)
21                {
22                    // Show Taxonomy Filter
23                    $('#search_category_collapse').collapse('show');
24        
25                    // Set Taxonomy Filter
26                    $('input[name="search_category"][value="' + postFilterData.defaultSelectionTaxonomy.term_id + '"]').prop('checked', true);
27                }
28
29                // Taxonomy: project
30                if ($('input[name="search_project"][value="' + postFilterData.defaultSelectionTaxonomy.term_id + '"]').length > 0)
31                {
32                    // Show Taxonomy Filter
33                    $('#search_project_collapse').collapse('show');
34
35                    // Set Taxonomy Filter
36                    $('input[name="search_project"][value="' + postFilterData.defaultSelectionTaxonomy.term_id + '"]').prop('checked', true);
37                }
38
39                // Reload Results
40                currentRequestPostFilter = searchPostAjax(currentRequestPostFilter, false, false, true);
41            }
42
43
44            
45            // Form Reset
46            $('#postfilter .postfilterreset').on('click', function()
47            {
48                $('#postfilter').trigger('reset');
49
50                currentRequestPostFilter = searchPostAjax(currentRequestPostFilter, false, false, true);
51            });
52
53
54
55            // Text Input
56            var delayTimer;
57
58            function doSearch(text)
59            {
60                clearTimeout(delayTimer);
61
62                delayTimer = setTimeout(function()
63                {
64                    currentRequestPostFilter = searchPostAjax(currentRequestPostFilter, false, false, true);
65                }, 1000);
66            }
67
68            $('#postfilter input[type="text"]').on('input',function(e)
69            {
70                doSearch($(this).val());
71            });
72
73            $('#postfilter .fa.fa-search').on('click', function()
74            {
75                doSearch($(this).parent().prev('input').val());
76            });
77            
78            
79
80            // Radio Field
81            $(document).on('change', '#postfilter input[type=radio]', function()
82            {
83                currentRequestPostFilter = searchPostAjax(currentRequestPostFilter, false, false, true);
84            });
85
86
87
88            // Load More        
89            $(document).on('click', '#more_posts_post', function(e)
90            {
91                e.preventDefault();
92
93                $('#more_posts_post').attr('disabled', true);
94
95                var single_date = $(this).attr('data-singledate');
96
97                if (typeof single_date === 'undefined')
98                {
99                    currentRequestPostFilter = searchPostAjax(currentRequestPostFilter, true, false, true);
100                }
101                else
102                {
103                    currentRequestPostFilter = searchPostAjax(currentRequestPostFilter, true, single_date, true);
104                }
105            });
106
107
108
109            // Load More: Infinite Scroll
110            // $(window).on('scroll', function()
111            // {
112            //     // console.log($(window).scrollTop() + $(window).height(), $(document).height() - 100);
113
114            //     if ($(window).scrollTop() + $(window).height() >= $(document).height() - 100)
115            //     {
116            //         $('#more_posts_post').attr('disabled', true);
117
118            //         currentRequestPostFilter = searchPostAjax(currentRequestPostFilter, true, false, true);
119            //     }
120            // });
121
122
123
124            /**
125             * Function: searchPostAjax
126             */
127            function searchPostAjax(currentRequestPostFilter, loadMore, singleDate = false, resetURL = true)
128            {
129                var filter = $('#postfilter');
130                
131                if (loadMore)
132                {
133                    page++;
134                }
135                else
136                {
137                    page = 1;
138                }
139
140                console.log('page load:', page);
141
142                var urlPathPrefix = '';
143                var urlPathName = '';
144                var urlPathArray = window.location.pathname.split('/');
145                
146                if (urlPathArray[1] == 'cz')
147                {
148                    urlPathPrefix = '/cz';
149                    urlPathName = '/prispevky/';
150                }
151                else
152                {
153                    urlPathName = '/beitraege/';
154                }
155
156                if (window.location.pathname != urlPathPrefix + urlPathName && resetURL)
157                {
158                    // Reset Breadcrumb
159                    $('#breadcrumb li.active').remove();
160    
161                    // Reset URL to Default URL
162                    if (window.history.pushState)
163                    {
164                        window.history.pushState('', '', urlPathPrefix + urlPathName);
165                    }
166                }
167
168                currentRequestPostFilter = $.ajax(
169                {
170                    url: postFilterData.ajaxurl,
171                    data: filter.serialize() + '&page=' + page + '&posts_per_page=' + posts_per_page + '&search_date=' + (singleDate ? singleDate : ''),
172                    type: filter.attr('method'),
173                    beforeSend: function(xhr)
174                    {
175                        // Abort previous request
176                        if (currentRequestPostFilter != null && currentRequestPostFilter.readyState < 4)
177                        {
178                            currentRequestPostFilter.abort();
179                        }
180
181                        // Remove Page Title
182                        if (!$('body').hasClass('blog'))
183                        {
184                            $('.main-content-wrap > header.page-title').remove();
185                        }
186
187                        // Remove Ajax Post Calendar State
188                        $('.ajax-calendar a.has-post').parent('td').removeClass('active');
189
190                        // Remove Post Navigation
191                        $('.main-content-wrap > .post-nav').remove();
192
193                        // Remove Load more Button
194                        $('.main-content-wrap > #more_posts_post_wrapper').remove();
195
196                        // Show Loading Spinner
197                        if (loadMore)
198                        {
199                            $('#postresponse').append('<div id="posts_loading" class="col-12" style="padding: 30px; text-align: center;"><i class="fa fa-circle-o-notch fa-spin fa-2x"></i></div>');
200                            $('#more_posts_post').attr('disabled', false);
201                        }
202                        else
203                        {
204                            $('#postresponse').html('<div id="posts_loading" class="col-12" style="padding: 30px; text-align: center;"><i class="fa fa-circle-o-notch fa-spin fa-2x"></i></div>');
205                        }
206                    },
207                    success: function(data)
208                    {
209                        // No Data
210                        if (data == 'no_posts_found')
211                        {
212                            // Load More
213                            if (loadMore)
214                            {
215                                $('#more_posts_post_wrapper').remove();
216                                $('#posts_loading').remove();
217
218                                $('#postresponse').append('<div id="no_posts" class="col-12" style="padding: 30px; text-align: center;">' + postFilterData.str_noposts_more + '</div>');
219                            }
220                            // Initital Load
221                            else
222                            {
223                                $('#postresponse').html('<div id="no_posts" class="col-12" style="padding: 30px; text-align: center;">' + postFilterData.str_noposts + '</div>');
224                            }
225                        }
226                        // Insert Data
227                        else
228                        {
229                            // Load More
230                            if (loadMore)
231                            {
232                                $('#more_posts_post_wrapper').remove();
233                                $('#posts_loading').remove();
234
235                                $('#postresponse').append(data);
236
237                                // Add Load more Button
238                                $('.main-content-wrap').append('<div id="more_posts_post_wrapper" class="col-12" style="padding: 30px; text-align: center;"><a id="more_posts_post" ' + (singleDate ? 'data-singledate="' + singleDate + '"' : '') + ' class="btn btn-primary" href="#">' + postFilterData.str_loadmore + '</a></div>');
239                                
240                                $('#more_posts_post').attr('disabled', false);
241                            }
242                            // Initital Load
243                            else
244                            {
245                                $('#posts_loading').remove();
246                                $('#postresponse').html(data);
247                            
248                                // Add Load more Button
249                                $('.main-content-wrap').append('<div id="more_posts_post_wrapper" class="col-12" style="padding: 30px; text-align: center;"><a id="more_posts_post" ' + (singleDate ? 'data-singledate="' + singleDate + '"' : '') + ' class="btn btn-primary" href="#">
249' + postFilterData.str_loadmore + '</a></div>');
250                            }
251                        }
252                    },
253                    complete: function()
254                    {console.log('TEST');
255                        // SameHeight
256                        $('.article-img img').waitForImages(true).done(function()
257                        {
258                            if (typeof makeSameHeight !== 'undefined' && typeof makeSameHeight === 'function')
259                            {
260                                makeSameHeight();
261                            }
262                        });
263                    }
264                });
265
266                return currentRequestPostFilter;
267            }
268        }
269    });
270
271
272
273    // Window loaded
274    $(window).load(function()
275    {
276
277    });
278
279
280
281
282})( jQuery );

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.