1// console.log(ajax_object); 2 3let filterLinks = document.querySelectorAll('.posts-filter a'); 4 5for (let i = 0; i < filterLinks.length; i++) { 6 filterLinks[i].onclick = function() { 7 var c = 0; 8 while (c < filterLinks.length) { 9 filterLinks[c++].className = ''; 10 } 11 filterLinks[i].className = 'active'; 12 }; 13} 14 15filterLinks.forEach((link) => { 16 link.addEventListener('click', (e) => { 17 e.preventDefault() 18 19 document.querySelector('.wrap-items').classList.add('loading') 20 const postsType = document.querySelector('.wrap-items').getAttribute('data-posts-type') 21 const taxonomyName = document.querySelector('.wrap-items').getAttribute('data-taxonomy') 22 23 let termID = link.dataset.term 24 25 sendAjax2(termID, postsType, taxonomyName) 26 27 return false 28 }) 29}) 30 31function sendAjax2(term, postsType, taxonomyName) { 32 let formData = new FormData(); 33 34 formData.append('termID', term) 35 formData.append('postsType', postsType) 36 formData.append('taxonomyName', taxonomyName) 37 formData.append('action', 'load_filter_posts') 38 formData.append('nonce', ajax_object.nonce) 39 formData.append('pageID', ajax_object.pageID) 40 41 let options = { 42 method : "POST", 43 credentials : "same-origin", 44 body: formData, 45 } 46 47 fetch(ajax_object.ajaxurl, options).then((response) => response.json()).then((data) => { 48 document.querySelector('body').classList.add('posts-filtered'); 49 50 document.querySelector('.wrap-items').classList.remove('loading') 51 52 document.querySelector('.wrap-items').innerHTML = data.data.result_html 53 54 console.log(data.data.taxonomy, data.data.posttype) 55 }) 56}
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.