PageSourceSearch

https://asreesfahannews.ir/wp-content/themes/yaghoutnews/assets/js/live-search.js

js asreesfahannews.ir collected 2026-10-03 01:22:45 UTC 1,775 bytes, 52 lines download raw bytes

1jQuery(document).ready(function($) {
2    var searchTimer;
3    
4    // جستجو با keyup روی اینپوت
5    $('#search-input').on('keyup', function() {
6        performSearch();
7    });
8    
9    // جستجو با تغییر دسته‌بندی
10    $('#category-filter').on('change', function() {
11        performSearch();
12    });
13    
14    function performSearch() {
15        clearTimeout(searchTimer);
16        var searchQuery = $('#search-input').val();
17        var categoryId = $('#category-filter').val();
18
19        if(searchQuery.length < 3) {
20            $('#search-results').hide().empty();
21            return;
22        }
23
24        searchTimer = setTimeout(function() {
25            $.ajax({
26                url: yaghoutnews_ajax.ajax_url,
27                type: 'POST',
28                data: {
29                    action: 'yaghoutnews_search',
30                    nonce: yaghoutnews_ajax.nonce,
31                    s: searchQuery,
32                    category: categoryId
33                },
34                beforeSend: function() {
35                    $('#search-results').html('<div class="loading">در حال جستجو...</div>').show();
36                },
37                success: function(response) {
38                    $('#search-results').html(response);
39                    if(response.trim() === '') {
40                        $('#search-results').html('<div class="no-results"><i class="icon-shield-warning"></i> نتیجه‌ای یافت نشد</div>');
41                    }
42                }
43            });
44        }, 500);
45    }
46
47    $(document).on('click', function(e) {
48        if (!$(e.target).closest('#search-container').length) {
49            $('#search-results').hide();
50        }
51    });
52});

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.