Skip to content

fix: update event handling for PowerLink skeleton removal and enhance regex patterns#221

Merged
piquark6046 merged 2 commits intomainfrom
fix/namuwiki-script-visitor-regression
Mar 18, 2026
Merged

fix: update event handling for PowerLink skeleton removal and enhance regex patterns#221
piquark6046 merged 2 commits intomainfrom
fix/namuwiki-script-visitor-regression

Conversation

@piquark6046
Copy link
Member

No description provided.

@piquark6046 piquark6046 changed the title fix: enhance regex patterns for identifying PL2MajorFuncCallPatterns fix: update event handling for PowerLink skeleton removal and enhance regex patterns Mar 18, 2026
@piquark6046 piquark6046 marked this pull request as ready for review March 18, 2026 05:24
Copilot AI review requested due to automatic review settings March 18, 2026 05:24
@piquark6046 piquark6046 merged commit 1af64dd into main Mar 18, 2026
8 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the userscript’s PowerLink (PL2) skeleton detection/removal flow by expanding the function-call signature patterns and attempting to target a specific captured container element (plus separate handling for mobile vs desktop).

Changes:

  • Added additional PL2MajorFuncCallPatterns to match more obfuscated variants.
  • Captured a vnode element (CommentContainer) from the hooked call arguments for more targeted removal.
  • Reworked the event-driven removal logic, introducing PL2AdvertContainer and splitting desktop/mobile placeholder handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +63 to +65
if (typeof Args[6] === 'object' && typeof Args[6]['_'] === 'object' && typeof Args[6]['_']['vnode'] === 'object' &&
Args[6]['_']['vnode'] !== null && typeof Args[6]['_']['vnode']['el'] === 'object' && Args[6]['_']['vnode']['el'] instanceof HTMLElement) {
CommentContainer = Args[6]['_']['vnode']['el'] as HTMLElement
})

BrowserWindow.document.addEventListener('PL2PlaceHolder', () => {
BrowserWindow.document.addEventListener('PL2AdvertContainer', () => {
return Number(getComputedStyle(Container).getPropertyValue('padding-top').replaceAll(/px$/g, '')) > 10 ||
Number(getComputedStyle(Container).getPropertyValue('margin-top').replaceAll(/px$/g, '')) > 10
}))
let ContainerElements = new Set([CommentContainer])
Comment on lines 119 to +141
@@ -120,11 +131,33 @@ export function RunNamuLinkUserscript(BrowserWindow: typeof window, UserscriptNa
Number(getComputedStyle(Child).getPropertyValue('padding-left').replaceAll(/px/g, '')) >= 5 &&
Number(getComputedStyle(Child).getPropertyValue('padding-right').replaceAll(/px/g, '')) >= 5)
)))
console.debug(`[${UserscriptName}]: Removing PowerLink Skeleton Containers:`, ContainerElements)
console.debug(`[${UserscriptName}]: Removing PowerLink Skeleton Containers (PL2PlaceHolderMobile):`, ContainerElements)
ContainerElements.forEach(Container => {
Container.setAttribute('style', 'display: none !important;')
})
}, 2500)

BrowserWindow.document.addEventListener('PL2PlaceHolder', () => {
setTimeout(() => {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants