Skip to content

Commit 8ba59cb

Browse files
committed
fix: refine filtering logic for HTML elements based on size constraints
1 parent 60850ef commit 8ba59cb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

userscript/source/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ export async function RunNamuLinkUserscript(BrowserWindow: typeof window, Usersc
6161
.filter(Child =>
6262
Child instanceof HTMLImageElement ||
6363
getComputedStyle(Child).backgroundImage !== 'none'
64-
)
64+
).filter(Child => parseFloat(getComputedStyle(Child).getPropertyValue('width')) >= 5 && parseFloat(getComputedStyle(Child).getPropertyValue('height')) >= 5)
65+
.filter(Child => parseFloat(getComputedStyle(Child).getPropertyValue('width')) <= 50 && parseFloat(getComputedStyle(Child).getPropertyValue('height')) <= 50)
6566
let MatchedCount = 0
6667
for (const Child of CandidateChildren) {
6768
const Result = await OCRInstance.DetectFromElement(Child, {

0 commit comments

Comments
 (0)