Skip to content

Commit ba1badc

Browse files
committed
fix: incorrectly a person's profile hidden due to OCR error
1 parent 3d19a8a commit ba1badc

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

userscript/source/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,20 @@ export async function RunNamuLinkUserscript(BrowserWindow: typeof window, Usersc
127127
Children = Children.filter(Child => parseFloat(getComputedStyle(Child).getPropertyValue('margin-left')) >= 2.5)
128128
return Children.length === 0
129129
})
130+
Targeted = Targeted.filter(Ele => {
131+
if (Ele.getBoundingClientRect().width < 500) return false
132+
let Children = [...Ele.querySelectorAll('*[style]')].filter(Child => Child instanceof HTMLElement && Child.style.length > 0)
133+
return Children.filter(Child => {
134+
if (!(Child instanceof HTMLElement)) return false
135+
const ComputedStyle = getComputedStyle(Child)
136+
const MissingCount = [...Child.style].filter(Property => {
137+
const InlineValue = Child.style.getPropertyValue(Property).trim()
138+
const ComputedValue = ComputedStyle.getPropertyValue(Property).trim()
139+
return InlineValue !== ComputedValue
140+
}).length
141+
return MissingCount <= 1
142+
}).length < 5
143+
})
130144
Targeted = await ExecuteOCR(Targeted)
131145
Targeted.forEach(Ele => Targeted.push(...new Set([...Ele.querySelectorAll('*')].filter(Child => Child instanceof HTMLElement))))
132146
Targeted = [...new Set(Targeted)]

0 commit comments

Comments
 (0)