fix: update event handling for PowerLink skeleton removal and enhance regex patterns#221
Merged
piquark6046 merged 2 commits intomainfrom Mar 18, 2026
Merged
Conversation
PL2MajorFuncCallPatternsThere was a problem hiding this comment.
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
PL2MajorFuncCallPatternsto 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
PL2AdvertContainerand 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(() => { | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.