Skip to content

Commit c75b840

Browse files
committed
support searching formats by file extension
1 parent d25266b commit c75b840

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ const ui = {
3333
const filterButtonList = (list: HTMLDivElement, string: string) => {
3434
for (const button of Array.from(list.children)) {
3535
if (!(button instanceof HTMLButtonElement)) continue;
36-
if (!button.textContent.toLowerCase().includes(string)) {
36+
const formatIndex = button.getAttribute("format-index");
37+
let hasExtension = false;
38+
if (formatIndex) {
39+
const format = allOptions[parseInt(formatIndex)];
40+
hasExtension = format?.format.extension.toLowerCase().includes(string);
41+
}
42+
const hasText = button.textContent.toLowerCase().includes(string);
43+
if (!hasExtension && !hasText) {
3744
button.style.display = "none";
3845
} else {
3946
button.style.display = "";

0 commit comments

Comments
 (0)