PageSourceSearch

https://affisemmp.com/wp-content/themes/affise.com/search/filter.js?ver=1.0

js affisemmp.com collected 2026-10-04 09:24:41 UTC 2,052 bytes, 59 lines download raw bytes

1jQuery(document).ready(function ($) {
2    
3    var searchTimeout;
4
5    $('#ajax-filter-form').on('change', 'input', function() {
6        sendCombinedAjax(1);
7    });
8
9    $('#ajax-search-form').on('input', 'input[name="search_keyword"]', function() {
10        clearTimeout(searchTimeout);
11        searchTimeout = setTimeout(function() {
12            sendCombinedAjax(1);
13        }, 400);
14    });
15    
16    $(document).on('click', '.pagination .ajax-link', function(e) {
17        e.preventDefault();
18        
19        var page = $(this).data('page');
20        if (page) {
21            sendCombinedAjax(page);
22        }
23    });
24
25    $('#ajax-filter-form, #ajax-search-form').on('submit', function(e) {
26        e.preventDefault();
27    });
28
29    function sendCombinedAjax(page) {
30        var currentPage = page || 1;
31        // Объединяем массивы данных из обеих форм
32        var filterData = $('#ajax-filter-form').serializeArray();
33        var searchData = $('#ajax-search-form').serializeArray();
34        var combinedData = filterData.concat(searchData);
35
36        // Превращаем в строку запроса и добавляем экшен для WordPress
37        var formData = $.param(combinedData) + '&action=filter_posts&paged=' + currentPage;
38
39        $.ajax({
40            url: my_ajax_data.ajax_url,
41            type: 'POST',
42            data: formData,
43            beforeSend: function() {
44                $('#ajax-search-results').css('opacity', 0.5);
45            },
46            success: function (data) {
47                var response = JSON.parse(data);
48                $('.pagination').html(response.pagination);
49                $('.cards').html(response.posts);
50                $('#ajax-search-results').css('opacity', 1);
51            },
52            error: function(xhr, status, error) {
53                console.error('Ошибка AJAX:', error);
54                $('#ajax-search-results').css('opacity', 1);
55            }
56        });
57    }
58
59});

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.