1(function ($) { 2 function showLoader(elm) { 3 if (elm) { 4 elm.html(`<p class="mt-5 text-center">Loading...</p>`); 5 } 6 } 7 let action; 8 if($('body').hasClass('page-template-our-work')){ 9 action = 'work_filter'; 10 }else{ 11 action = 'post_filter'; 12 } 13 console.log(action); 14 function loadworks(page = 1) { 15 const clContainer = $(".all_posts"); 16 17 $(document).on( 18 "change", 19 "#s_filter select", 20 function () { 21 showLoader(clContainer); 22 23 let author = $('#author').find(":selected").val(); 24 let type = $('#type').find(":selected").val(); 25 let program = $('#program').find(":selected").val(); 26 let issue = $('#issue').find(":selected").val(); 27 // console.log(type); 28 var page = page; 29 30 // Send AJAX request 31 $.post( 32 mlObj.ajax_url, 33 { 34 action: action, 35 type: type, 36 author: author, 37 program: program, 38 issue: issue, 39 page: page, 40 nonce: mlObj.nonce, 41 }, 42 function (response) { 43 clContainer.html(response); 44 // $("html, body").animate({ scrollTop: $('.all_posts').offset().top -100 }); 45 } 46 ); 47 } 48 ); 49 function delay(callback, ms) { 50 var timer = 0; 51 return function() { 52 var context = this, args = arguments; 53 clearTimeout(timer); 54 timer = setTimeout(function () { 55 callback.apply(context, args); 56 }, ms || 0); 57 }; 58 }; 59 let searchInput = $('#keyword'); 60 searchInput.keyup(delay(function (e) { 61 var value = $(this).val(); 62 var page = page; 63 $.post( 64 mlObj.ajax_url, 65 { 66 action: action, 67 search: value, 68 page: page, 69 nonce: mlObj.nonce, 70 }, 71 function (response) { 72 clContainer.html(response); 73 } 74 ); 75 76 }, 500)); 77 } 78 79 const eventContainer = $(".events"); 80 function eventsLoad(page = 1){ 81 82 $('.event_tab li').on('click', function(){ 83 let page = 1; 84 $this = $(this).attr('id'); 85 $('.event_tab li').removeClass('active'); 86 $(this).addClass('active'); 87 $('#menu-1-0261f38 li').removeClass('current-menu-item'); 88 $('#menu-1-0261f38 li.' + $this).addClass('current-menu-item'); 89 $.post( 90 mlObj.ajax_url, 91 { 92 action: 'event_ajax', 93 when: $this, 94 page: page, 95 nonce: mlObj.nonce, 96 }, 97 function (response) { 98 eventContainer.html(response); 99 100 } 101 ); 102 }); 103 } 104 105 function handlePagination() { 106 107 const clContainer = $(".all_posts"); 108 109 $(document).on("click", ".filter_temp .pagination a", function (event) { 110 event.preventDefault(); 111 var page = $(this).attr("href").split("/").pop(); 112 $("#current-page").val(page); 113 114 showLoader(clContainer); 115 116 let author = $('#author').find(":selected").val(); 117 let type = $('#type').find(":selected").val(); 118 let program = $('#program').find(":selected").val(); 119 let issue = $('#issue').find(":selected").val(); 120 121 // Send AJAX request 122 $.post( 123 mlObj.ajax_url, 124 { 125 action: action, 126 type: type, 127 author: author, 128 program: program, 129 issue: issue, 130 page: page, 131 nonce: mlObj.nonce, 132 }, 133 function (response) { 134 clContainer.html(response); 135 136 } 137 ); 138 window.scrollTo({top: 300, behavior: 'smooth'}); 139 }); 140 } 141 function eventPagination(){ 142 $(document).on("click", ".events .pagination a", function (event) { 143 event.preventDefault(); 144 145 var pg = $(this).attr("href").split("/").pop(); 146 $("#current-page").val(pg); 147 let current = $('.event_tab li.active').attr('id'); 148 $.post( 149 mlObj.ajax_url, 150 { 151 action: 'event_ajax', 152 page: pg, 153 when: current, 154 nonce: mlObj.nonce, 155 }, 156 function (response) { 157 eventContainer.html(response); 158 159 } 160 ); 161 window.scrollTo({top: 300, behavior: 'smooth'}); 162 }); 163 } 164 165 loadworks(); 166 handlePagination(); 167 eventsLoad(); 168 eventPagination(); 169 170 171 172 173})(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.