From 62f3d3fc23f1f6e1eaa13f95355e46bd4178fc78 Mon Sep 17 00:00:00 2001 From: Victor Lyuboslavsky Date: Sun, 11 Aug 2024 07:16:45 +0200 Subject: [PATCH] Items to blur are now case-insensitive --- src/content.test.ts | 2 +- src/content.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/content.test.ts b/src/content.test.ts index 17f828a..d165045 100644 --- a/src/content.test.ts +++ b/src/content.test.ts @@ -13,7 +13,7 @@ describe("blur", () => { test("blur a secret", () => { document.body.innerHTML = `
- "My secret" + "My Secret"
` // Set value to blur as a message const message: Message = { diff --git a/src/content.ts b/src/content.ts index d95c33b..738ea05 100644 --- a/src/content.ts +++ b/src/content.ts @@ -46,7 +46,7 @@ function processInputElement(input: HTMLInputElement | HTMLTextAreaElement, blur // This element has already been blurred in this pass return } - const text = (input.value || input.getAttribute("value")) ?? "" + const text = ((input.value || input.getAttribute("value")) ?? "").toLowerCase() if (blurTarget.style.filter.includes(blurFilter)) { // Already blurred if (!enabled) { @@ -101,6 +101,7 @@ function processHtmlElement(parent: HTMLElement | null, text: string, blurredEle // This element has already been blurred in this pass. return } + text = text.toLowerCase() if (parent.style.filter.includes(blurFilter)) { // Already blurred if (!enabled) { @@ -353,7 +354,7 @@ function setLiterals(literals: string[]) { for (let i = 0; i < NUMBER_OF_LITERALS; i++) { const item: string = literals[i] if (item && item.trim().length > 0) { - contentToBlur.push(item.trim()) + contentToBlur.push(item.trim().toLowerCase()) } } if (enabled) {