1function ajax_request(data, wrap) { 2 $.ajax({ 3 url: params.ajaxurl, 4 data: data, 5 type: 'POST', 6 beforeSend: function () { 7 wrap.addClass('loading'); 8 }, 9 success: function (response) { 10 wrap.removeClass('loading'); 11 $('.posts-list').html(response.content); 12 $('.pagination').html(response.pagination); 13 let offsetScroll = $('#blog-categories').offset().top - $(".header").innerHeight(); 14 $("html, body").animate({scrollTop: offsetScroll}, 1000); 15 } 16 }); 17} 18 19$(document).ready(function () { 20 var wrap = $('.posts-wrap'); 21 var url_params = new URLSearchParams(location.search); 22 var wrap_paginate = $('.page-numbers'); 23 var data; 24 var wrap_works = $('.latest-work-listing'); 25 var wrap_posts = $('.latest-post-listing'); 26 if (wrap_works.length) { 27 var wrap_types = $('#project-types'); 28 var wrap_industries = $('#project-industries'); 29 data = { 30 'action': 'get_new_works', 31 'query': params.posts, 32 'security': params.security, 33 'type': '', 34 'industry': '', 35 'page': '1' 36 }; 37 if (wrap_paginate.length) { 38 $(document).on('click', '.page-numbers a', function (e) { 39 e.preventDefault(); 40 data.page = $(this).attr('data-num'); 41 data.type = url_params.get('type'); 42 data.industry = url_params.get('industry'); 43 window.history.replaceState({}, '', `${$(this).attr('href')}`); 44 ajax_request(data, wrap); 45 }); 46 } 47 if (wrap_types.length) { 48 wrap_types.on('click', 'li', function (e) { 49 e.preventDefault(); 50 wrap_types.find('li').removeClass('active'); 51 $(this).addClass('active'); 52 data.type = $(this).find('a').attr('data-type'); 53 if (!data.type.length) { 54 url_params.delete('type'); 55 } else { 56 url_params.set('type', data.type); 57 } 58 if (wrap_industries.length) { 59 if (wrap_industries.find('select').val()) { 60 data.industry = wrap_industries.find('select').val(); 61 if (!data.industry.length) { 62 url_params.delete('industry'); 63 } else { 64 url_params.set('industry', data.industry); 65 } 66 } 67 } 68 if (url_params.get('type') || url_params.get('industry')) { 69 window.history.replaceState({}, '', `${params.base_url}?${url_params}`); 70 } else { 71 window.history.replaceState({}, '', `${params.base_url}`); 72 } 73 data.page = '1'; 74 ajax_request(data, wrap); 75 }); 76 } 77 if (wrap_industries.length) { 78 wrap_industries.on('change', 'select', function (e) { 79 e.preventDefault(); 80 data.industry = $(this).val(); 81 if (!data.industry.length) { 82 url_params.delete('industry'); 83 } else { 84 url_params.set('industry', data.industry); 85 } 86 if (wrap_types.length) { 87 data.type = wrap_types.find('li.active a').attr('data-type'); 88 if (!data.type.length) { 89 url_params.delete('type'); 90 } else { 91 url_params.set('type', data.type); 92 } 93 } 94 if (url_params.get('type') || url_params.get('industry')) { 95 window.history.replaceState({}, '', `${params.base_url}?${url_params}`); 96 } else { 97 window.history.replaceState({}, '', `${params.base_url}`); 98 } 99 data.page = '1'; 100 ajax_request(data, wrap); 101 }); 102 } 103 } 104 if (wrap_posts.length) { 105 var wrap_categories = $('#blog-categories'); 106 data = { 107 'action': 'get_new_posts', 108 'query': params.posts, 109 'security': params.security, 110 'blog_category': '', 111 'page': '1' 112 }; 113 114 $(document).on('click', '.page-numbers a, .posts-controls a', function (e) { 115 e.preventDefault(); 116 data.page = $(this).attr('data-num'); 117 data.blog_category = url_params.get('blog_category'); 118 window.history.replaceState({}, '', `${$(this).attr('href')}`); 119 ajax_request(data, wrap); 120 }); 121 122 if (wrap_categories.length) { 123 wrap_categories.on('click', 'a', function (e) { 124 e.preventDefault(); 125 wrap_categories.find('li').removeClass('active'); 126 $(this).closest('li').addClass('active'); 127 data.blog_category = $(this).attr('data-category'); 128 if (!data.blog_category.length) { 129 url_params.delete('blog_category'); 130 } else { 131 url_params.set('blog_category', data.blog_category); 132 } 133 if (url_params.get('blog_category')) { 134 window.history.replaceState({}, '', `${params.base_url}?${url_params}`); 135 } else { 136 window.history.replaceState({}, '', `${params.base_url}`); 137 } 138 data.page = '1'; 139 ajax_request(data, wrap); 140 }); 141 } 142 } 143});
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.