Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions www/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,7 @@ table td.esoteric::after { content: '\2002\1f984\fe0f'; }
text-shadow: 0px 0px 3px var(--main-fg);
}
}

.filtered-out {
display: none;
}
1 change: 1 addition & 0 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ <h3>
<span class="invisible">[<a id="stderr-link" target="_blank" href="" title="Systrack analysis log">analysis&nbsp;log</a>]</span>
<span>[<a target="_blank" href="https://github.com/mebeim/linux-syscalls" title="Source code for this website on GitHub">website&nbsp;source</a>]</span>
</h3>
<input id="filter-name" placeholder="Filter name..." autocomplete="off">
<table>
<tr>
<th class="pad" colspan="6"></th>
Expand Down
29 changes: 29 additions & 0 deletions www/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const systrackVersEl = document.getElementById('systrack-version')
const configLinkEl = document.getElementById('config-link')
const stderrLinkEl = document.getElementById('stderr-link')
const jsonLinkEl = document.getElementById('json-link')
const filterNameEl = document.getElementById("filter-name")

let db = null
let currentSyscallTable = null
Expand Down Expand Up @@ -148,6 +149,7 @@ function afterUpdate() {
archSelectEl.disabled = false
tagSelectEl.disabled = false
updateInProgress = false
filterTable(filterNameEl.value)
}

function clearOptions(selectEl) {
Expand Down Expand Up @@ -303,6 +305,31 @@ function sortTable(e) {
header.classList.add(desc ? 'descending' : 'ascending')
}

function filterTable(text) {
if (updateInProgress)
return

const rows = Array.from(tableEl.querySelectorAll('tr')).slice(2)
let filteredIn = 0

for (const el of rows) {
const value = el.children[2].textContent

if (value.includes(text)) {
el.classList.remove('filtered-out')
filteredIn += 1
} else {
el.classList.add('filtered-out')
}
}

sumamryEl.textContent = `${filteredIn} syscalls`
}

function handleFilterTableEvent(e) {
filterTable(e.target.value)
}

function toggleCollapseColumn(e) {
if (updateInProgress)
return
Expand Down Expand Up @@ -516,6 +543,7 @@ function toggleCompactSignature() {
localStorage.setItem('compactSignature', compactSignature)
// Could be optimized... but I could also not care less for now
fillTable(currentSyscallTable, realTag(arch, bits, abi, tag))
filterTable(filterNameEl.value)
}

async function update(pushHistoryState) {
Expand Down Expand Up @@ -677,6 +705,7 @@ async function setup() {
compactSigToggleEl.addEventListener('click', toggleCompactSignature)
tableEl.querySelectorAll('th.sortable').forEach(el => el.addEventListener('click', sortTable))
tableEl.querySelectorAll('th > .collapse-toggle').forEach(el => el.addEventListener('click', toggleCollapseColumn))
filterNameEl.addEventListener('input', handleFilterTableEvent)
window.addEventListener('popstate', historyPopStateHandler)
}

Expand Down