Files
Bubberstation/html/admin/search.js
Jeremiah 9db2f6916b Sets prettier to run on the repo (#91379)
## About The Pull Request
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
## Why It's Good For The Game
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
## Changelog
2025-05-29 21:23:59 -07: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) {}
}
}