1document.addEventListener('DOMContentLoaded',function(){initFilterableTables()});if(document.readyState==='interactive'||document.readyState==='complete'){initFilterableTables()} 2function initFilterableTables(){if(window.filterableTableInitialized)return;window.filterableTableInitialized=!0;const tables=document.querySelectorAll('.has-filterable-table, .wp-block-table, table');tables.forEach(tableContainer=>{const isTable=tableContainer.tagName==='TABLE';const table=isTable?tableContainer:tableContainer.querySelector('table');if(!table){return} 3const hasFilterClass=tableContainer.classList.contains('has-filterable-table')||table.classList.contains('has-filterable-table');const hasFilterData=tableContainer.getAttribute('data-enable-filtering')==='true'||table.getAttribute('data-enable-filtering')==='true';if(!hasFilterClass&&!hasFilterData){return} 4const disabledFilters=JSON.parse(tableContainer.getAttribute('data-disabled-filters')||table.getAttribute('data-disabled-filters')||'[]');const filterTypes=JSON.parse(tableContainer.getAttribute('data-filter-types')||table.getAttribute('data-filter-types')||'{}');const rows=Array.from(table.querySelectorAll('tbody tr'));const headers=Array.from(table.querySelectorAll('thead th, thead td'));const columnCount=headers.length||(rows.length>0?rows[0].cells.length:0);if(columnCount===0)return;const filterContainer=document.createElement('div');filterContainer.className='table-filters';filterContainer.style.display='flex';filterContainer.style.gap='10px';filterContainer.style.marginBottom='15px';filterContainer.style.flexWrap='wrap';const selects=[];for(let i=0;i<columnCount;i++){if(disabledFilters.includes(i)){selects.push(null);continue} 5const filterType=filterTypes[i]||'select';if(filterType==='select'){const uniqueValues=new Set();rows.forEach(row=>{if(row.cells[i]){uniqueValues.add(row.cells[i].textContent.trim())}});if(uniqueValues.size<=1){selects.push(null);continue} 6const select=document.createElement('select');select.className='table-filter-select';const label=headers[i]?headers[i].textContent.trim():`Kolumna ${i + 1}`;const defaultOption=document.createElement('option');defaultOption.value='';defaultOption.textContent=`${label}`;select.appendChild(defaultOption);Array.from(uniqueValues).sort().forEach(value=>{const option=document.createElement('option');option.value=value;option.textContent=value;select.appendChild(option)});select.addEventListener('change',()=>applyFilters(rows,selects));filterContainer.appendChild(select);selects.push(select)}else{const input=document.createElement('input');input.type='text';input.className='table-filter-input';input.placeholder=headers[i]?`${headers[i].textContent.trim()}`:`Szukaj w kolumnie ${i + 1}`;input.style.padding='5px 10px';input.style.border='1px solid #ccc';input.style.borderRadius='4px';input.addEventListener('input',()=>applyFilters(rows,selects));filterContainer.appendChild(input);selects.push(input)}} 7if(filterContainer.children.length>0){const resetBtn=document.createElement('button');resetBtn.textContent='WyczyÅÄ filtry';resetBtn.className='table-filter-reset';resetBtn.style.display='none';resetBtn.addEventListener('click',()=>{selects.forEach(control=>{if(control)control.value=''});applyFilters(rows,selects,resetBtn)});filterContainer.appendChild(resetBtn);tableContainer.insertBefore(filterContainer,table);selects.forEach(control=>{if(control){const eventType=control.tagName==='SELECT'?'change':'input';control.addEventListener(eventType,()=>applyFilters(rows,selects,resetBtn))}})}})} 8function applyFilters(rows,selects,resetBtn){let anyFilterActive=!1;rows.forEach(row=>{let visible=!0;selects.forEach((control,index)=>{if(control&&control.value){anyFilterActive=!0;const cellValue=row.cells[index]?row.cells[index].textContent.trim().toLowerCase():'';const filterValue=control.value.toLowerCase();if(control.tagName==='SELECT'){if(cellValue!==filterValue){visible=!1}}else{if(cellValue.indexOf(filterValue)===-1){visible=!1}}}});row.style.display=visible?'':'none'});if(resetBtn){resetBtn.style.display=anyFilterActive?'inline-block':'none'}}
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.