Compare commits

...

4 Commits

Author SHA1 Message Date
697978420e Merge pull request 'fix #9' (#15) from NightFox/HLRTest:master into master
Reviewed-on: #15
2024-02-16 01:30:17 +01:00
2f4cf5c3be title for filter 2024-02-16 02:40:39 +03:00
3da9283b42 bonus ALT+F for focus at filter input 2024-02-16 02:38:37 +03:00
a25dee6640 fix #9 2024-02-16 02:27:50 +03:00

View File

@ -212,19 +212,24 @@ function buildData(table, images, data, sort, filter, exact_match) {
data = filterData(data); data = filterData(data);
} }
if (filter) { if (filter) {
if (exact_match) { let test = "", channel = "";
data = data.filter((d) => { const args = filter.split(" ");
const test = d.test === filter; if (args.length > 1) {
const channel = d.channel === filter; test = args[0];
return test || channel; channel = args[1]
});
} else { } else {
data = data.filter((d) => { test = filter;
const test = d.test.includes(filter); channel = filter;
const channel = d.channel.includes(filter);
return test || channel;
});
} }
data = data.filter((d) => {
const test_result = exact_match ? d.test === test : d.test.includes(test);
const channel_result = exact_match ? d.channel === channel : d.channel.includes(channel);
if (args.length > 1) {
return test_result && channel_result;
} else {
return test_result || channel_result;
}
});
} }
table.replaceChildren(...buildTestResultsTable(data)); table.replaceChildren(...buildTestResultsTable(data));
@ -560,7 +565,7 @@ window.onload = () => {
Tag("div", {"class": "panel", "id": "table"}, null, [ Tag("div", {"class": "panel", "id": "table"}, null, [
Tag("h2", null, "List of things that are not perfect"), Tag("h2", null, "List of things that are not perfect"),
Tag("label", {"class": "filter sticky"}, "Filter", [ Tag("label", {"class": "filter sticky"}, "Filter", [
filter = Tag("input", {"type": "input", "name": "filter", "value": filter_value}, null, null, "input", (e) => { filter = Tag("input", {"type": "input", "title": "Hotkey: ALT+F", "name": "filter", "value": filter_value}, null, null, "input", (e) => {
saveToLocalStorage("rendertest_filter", e.target.value); saveToLocalStorage("rendertest_filter", e.target.value);
buildDataSlowMode(table, images, data, tableSort, e.target.value, exactmatch_input.checked); buildDataSlowMode(table, images, data, tableSort, e.target.value, exactmatch_input.checked);
}), }),
@ -666,6 +671,16 @@ window.onload = () => {
} }
} }
}); });
document.addEventListener("keydown", function(event) {
if (event.altKey) {
if (event.key === 'f') {
event.preventDefault();
filter.focus();
}
}
});
} }