diff --git a/package.json b/package.json index c7bf6c1..a9fde3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@list-kr/namulink", - "version": "6.0.0", + "version": "7.0.0", "description": "", "type": "module", "scripts": { diff --git a/sources/banner.txt b/sources/banner.txt index 2fabe39..0527ef2 100644 --- a/sources/banner.txt +++ b/sources/banner.txt @@ -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/* diff --git a/sources/src/index.ts b/sources/src/index.ts index a379ee3..04848ba 100644 --- a/sources/src/index.ts +++ b/sources/src/index.ts @@ -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) } -}) \ No newline at end of file +}) + +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) \ No newline at end of file