1jQuery(document).ready(function ($) { 2 3 var debounce = null; 4 5 $(document).on('submit change', '.post-grid .post-grid-search.ajax form', function (e) { 6 7 e.preventDefault(); 8 9 10 11 //var keyword = $(this).val(); 12 var grid_id = $(this).attr('grid_id'); 13 //var key = e.which; 14 $('#post-grid-' + grid_id + ' .search-loading').addClass('active'); 15 16 formData = $(this).serialize(); 17 18 var postGridWrap = document.querySelector('#post-grid-' + grid_id); 19 20 var postgridargs = postGridWrap.getAttribute("data-options"); 21 22 postgridAttsObj = JSON.parse(postgridargs); 23 24 var view_type = postgridAttsObj.view_type; 25 26 27 28 29 var is_reset = 'no'; 30 //if(keyword.length>3){ 31 //$('#post-grid-'+grid_id+' .search-icon').html('<i class="fas fa-spin fa-spinner"></i>'); 32 33 //$('.pagination').fadeOut(); 34 35 $.ajax({ 36 type: 'POST', 37 context: this, 38 url: post_grid_ajax.post_grid_ajaxurl, 39 data: { "action": "post_grid_ajax_search_free", "_wpnonce": post_grid_ajax._wpnonce, "grid_id": grid_id, "is_reset": is_reset, "formData": formData, }, 40 success: function (response) { 41 42 var datas = JSON.parse(response); 43 pagination = datas['pagination']; 44 html = datas['html']; 45 46 47 48 $('#post-grid-' + grid_id + ' .grid-items').html(html); 49 //$('#post-grid-'+grid_id+' .search-icon').html('<i class="fas fa-search"></i>'); 50 $('#post-grid-' + grid_id + ' .pagination').html(pagination); 51 $('#post-grid-' + grid_id + ' .search-loading').removeClass('active'); 52 53 if (view_type == "masonry") { 54 55 56 57 var $container = $('#post-grid-' + grid_id + ' .grid-items'); 58 59 60 61 $container.masonry({ 62 itemSelector: '.item', 63 columnWidth: '.item', //as you wish , you can use numeric 64 isAnimated: true, 65 isFitWidth: true, 66 horizontalOrder: true, 67 gutter: 20, 68 percentPosition: true, 69 }); 70 $container.imagesLoaded().done(function () { 71 $container.masonry('layout'); 72 }); 73 74 75 76 } 77 78 } 79 }); 80 //} 81 82 }) 83 84 85 86 87 88 $(document).on('click', '.post-grid .paginate-ajax a.page-numbers', function (event) { 89 event.preventDefault(); 90 91 $('.post-grid .paginate-ajax .page-numbers').removeClass('current'); 92 formData = $('.post-grid-search form').serialize(); 93 94 95 96 $(this).addClass('current'); 97 98 var current_page = parseInt($(this).text()); 99 var paged = parseInt($(this).attr('paged')); 100 var grid_id = parseInt($(this).parent().attr('grid-id')); 101 102 103 104 105 106 post_grid_masonry_enable = 'no'; 107 $.ajax( 108 { 109 type: 'POST', 110 context: this, 111 url: post_grid_ajax.post_grid_ajaxurl, 112 data: { "action": "post_grid_paginate_ajax_free", "_wpnonce": post_grid_ajax._wpnonce, "grid_id": grid_id, "current_page": current_page, "formData": formData, }, 113 success: function (data) { 114 115 var response = JSON.parse(data) 116 var data = response['html']; 117 var pagination = response['pagination']; 118 119 if (post_grid_masonry_enable == 'yes') { 120 121 var $grid = $('#post-grid-' + grid_id + ' .grid-items').masonry({}); 122 $grid.masonry('destroy'); 123 $grid.html(data).masonry(); 124 125 $grid.masonry('reloadItems'); 126 $grid.masonry('layout'); 127 128 $('#post-grid-' + grid_id + ' .grid-items').masonry({ "isFitWidth": true }); 129 $('#paginate-ajax-' + grid_id).html(pagination); 130 131 } 132 else { 133 $('#post-grid-' + grid_id + ' .grid-items').html(data); 134 $('#paginate-ajax-' + grid_id).html(pagination); 135 136 } 137 138 139 $("#post-grid-" + grid_id).ScrollTo({ 140 duration: 1000, 141 easing: 'linear' 142 }); 143 144 145 146 147 148 } 149 }); 150 151 }) 152 153 154 155 156}); 157 158 159 160 161 162
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.