1jQuery(function($) { 2 /* filter posts by year */ 3 4 const select = document.querySelector('.select-year') 5 6 if (select) { 7 const selectList = select.querySelector('.select__list') 8 9 if (selectList) { 10 const selectActive = select.querySelector('.select__active'), 11 selectItem = selectList.querySelectorAll('.select__item') 12 13 const postType = select.dataset.post_type 14 15 selectActive.addEventListener('click', (event) => { 16 select.classList.toggle('open') 17 }) 18 19 selectItem.forEach((item) => { 20 const button = item.querySelector('.select__button') 21 22 button.addEventListener('click', (event) => { 23 if (item.classList.contains('active')) { 24 select.classList.remove('open') 25 26 return false 27 } 28 29 const slug = event.target.dataset.slug 30 31 const data = { 32 year : slug, 33 action : 'filter_' + postType 34 } 35 36 $.ajax({ 37 type : 'POST', 38 url : obj_filter.ajaxurl, 39 data : data, 40 beforeSend : function() { 41 select.classList.remove('open') 42 selectItem.forEach((item) => { 43 item.classList.remove('active') 44 }) 45 event.target.parentElement.classList.add('active') 46 selectActive.querySelector('span').textContent = event.target.textContent 47 select.nextElementSibling.innerHTML = '' 48 }, 49 success : function(data) { 50 select.nextElementSibling.innerHTML = data 51 }, 52 complete : function() { 53 54 } 55 }); 56 }) 57 }) 58 } 59 } 60});
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.