Skip to content

Commit

Permalink
Items to blur are now case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
getvictor committed Aug 11, 2024
1 parent 8ea1424 commit 62f3d3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/content.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("blur", () => {
test("blur a secret", () => {
document.body.innerHTML = `
<div id="testDiv">
"My secret"
"My Secret"
</div>`
// Set value to blur as a message
const message: Message = {
Expand Down
5 changes: 3 additions & 2 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 62f3d3f

Please sign in to comment.