Skip to content

Commit

Permalink
feat: mock more namuwiki interval functions
Browse files Browse the repository at this point in the history
  • Loading branch information
piquark6046 committed Dec 30, 2024
1 parent 145f8f8 commit 48db18a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@list-kr/namulink",
"version": "6.0.0",
"version": "7.0.0",
"description": "",
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion sources/banner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// @downloadURL https://cdn.jsdelivr.net/npm/@list-kr/namulink@latest/dist/NamuLink.user.js
// @license MIT
//
// @version 6.0.0
// @version 7.0.0
// @author PiQuark6046 and contributors
//
// @match https://namu.wiki/*
Expand Down
27 changes: 26 additions & 1 deletion sources/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,31 @@ Win.Proxy = new Proxy(Win.Proxy, {
Contents.map((Content: TPowerLinkContent) => Content.render = () => {})
return Reflect.construct(Target, [Contents, Args[1]], NewTarget)
}

let IsPowerLinkVariant2nd = false
for (let [Key, Value] of Object.entries(Args[0])) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
if (typeof Value === 'object' && Value !== null && typeof Value.render === 'function' && (Value.render as Function).toString().includes('content--stretch')) {
IsPowerLinkVariant2nd = true
break
}
}
if (IsPowerLinkVariant2nd) {
for (let [Key, Value] of Object.entries(Args[0])) {
if (typeof Value === 'object' && Value !== null && typeof Value.render === 'function') {
Value.render = () => {}
}
}
}

return Reflect.construct(Target, Args, NewTarget)
}
})
})

setInterval(() => {
Array.from(document.querySelectorAll('div[class*=" "] div[class]')).filter(Filtered => Filtered instanceof HTMLElement &&
(Filtered.innerText.includes('파워링크') || Filtered.innerText === '') && Number(getComputedStyle(Filtered).getPropertyValue('padding-top').replaceAll('px', '')) > 8 &&
Number(getComputedStyle(Filtered).getPropertyValue('min-height').replaceAll('px', '')) > 100 &&
Number(getComputedStyle(Filtered).getPropertyValue('height').replaceAll('px', '')) < 250
).forEach(Target => Target.setAttribute('style', 'display: none !important;'))
}, 2500)

0 comments on commit 48db18a

Please sign in to comment.