Files
Bubberstation/html/admin/search.js
Jeremiah a5a4b83a25 Sets prettier to run on the repo (#91379)
Prettier (an auto formatter) is set to only run within the tgui folder
currently. This removes that limitation, allowing it to automatically
format all supported files in the repo (.js, .html, .yml
[etc](https://prettier.io/docs/))

I made a few exceptions for bundled and generated files
I'm of the opinion that code should look uniform and am lazy enough to
want CTRL-S to format files without having to think beyond that
2025-06-05 19:13:02 -04:00

35 lines
1.0 KiB
JavaScript

function selectTextField() {
var filter_text = document.getElementById("filter");
filter_text.focus();
filter_text.select();
}
function updateSearch() {
var input_form = document.getElementById("filter");
var filter = input_form.value.toLowerCase();
input_form.value = filter;
var table = document.getElementById("searchable");
var alt_style = "norm";
for (var i = 0; i < table.rows.length; i++) {
try {
var row = table.rows[i];
if (row.className == "title") continue;
var found = 0;
for (var j = 0; j < row.cells.length; j++) {
var cell = row.cells[j];
if (cell.innerText.toLowerCase().indexOf(filter) != -1) {
found = 1;
break;
}
}
if (found == 0) row.style.display = "none";
else {
row.style.display =
"table-row"; /* DON'T make tables with block property */
row.className = alt_style;
if (alt_style == "alt") alt_style = "norm";
else alt_style = "alt";
}
} catch (err) {}
}
}