1document.addEventListener("DOMContentLoaded", () => { 2 const listWrapperNode = document.querySelector('.filter')?.closest('[data-id]'); 3 if (listWrapperNode) { 4 const bxAjaxId = listWrapperNode.getAttribute('data-id'); 5 listWrapperNode.addEventListener('click', (event) => { 6 const filterItem = event.target.closest('.filter__item a:not(.filter__item--active)'); 7 if (filterItem) { 8 const filterUrl = new URL(filterItem.href); 9 filterUrl.searchParams.set('bx-ajax-id', bxAjaxId); 10 event.preventDefault(); 11 fetch( 12 filterUrl.href, 13 {headers: {'X-Requested-With': 'XMLHttpRequest'}}, 14 ).then((response) => { 15 if (response.ok) { 16 return response.text(); 17 } else { 18 throw Error(response.statusText); 19 } 20 }).then((data) => { 21 const responseHtml = new DOMParser().parseFromString(data, 'text/html').body, 22 newListWrapperNode = responseHtml.querySelector(`[data-id="${bxAjaxId}"]`); 23 if (newListWrapperNode.children.length > 0) { 24 listWrapperNode.replaceChildren(...newListWrapperNode.children); 25 } else { 26 listWrapperNode.replaceChildren(); 27 } 28 initFilter(); 29 window.history.pushState(null, null, filterItem.href); 30 }).catch(error => console.error(error)); 31 } 32 }); 33 } 34});
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.