Skip to content

Commit

Permalink
fix: blocking does not work incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
piquark6046 committed Dec 31, 2024
1 parent fc7b138 commit 8789884
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 53 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": "9.0.0",
"version": "10.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 9.0.0
// @version 10.0.0
// @author PiQuark6046 and contributors
//
// @match https://namu.wiki/*
Expand Down
12 changes: 12 additions & 0 deletions sources/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import type { TPowerLink } from './powerlink.js'

type unsafeWindow = typeof window
// eslint-disable-next-line @typescript-eslint/naming-convention
declare const unsafeWindow: unsafeWindow

const Win = typeof unsafeWindow !== 'undefined' ? unsafeWindow : window

Win.Object.defineProperty = new Proxy(Win.Object.defineProperty, {
apply(Target: typeof Object.defineProperty, This: null, Args: Parameters<typeof Object.defineProperty>) {
if (Args[0] && typeof (Args[0] as TPowerLink).unitPath === 'string'
&& /^\/[0-9]+\/namuwiki\/(?!sidebar-box)/.test((Args[0] as TPowerLink).unitPath)) {
return
}
return Reflect.apply(Target, This, Args)
}
})

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 &&
Expand Down
57 changes: 6 additions & 51 deletions sources/src/powerlink.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,10 @@
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
/* eslint-disable @typescript-eslint/naming-convention */
type TPowerLinkMixin = {
methods: Record<'contribution_link' | 'contribution_link_discuss' | 'doc_action_link' | 'doc_fulltitle' | 'onDynamicContentClick' | 'openQuickACLGroup' | 'to_duration' | 'url_encode' | 'user_doc' | string, Function>
}

export type TPowerLinkContent = {
emits: string[]
components: Record<string, {
components: {
FakeImg: {
computed: Record<string, Function>
props: Record<string, { type: Function }>
render: Function
__cssModules: {
'$style': {
'wiki-image': string,
'wiki-image-wrapper': string,
},
__scopeId: string
},
NaverLoginImage: string,
NaverPayImage: string,
NaverPayPlusImage: string,
NaverTalkTalkImage: string
},
mixins: TPowerLinkMixin[],
props: Record<string, Function>,
render: Function,
__cssModules: {
'$style': Record<string, string>
__scopeId: string
}
}
}>
props: Record<string, Function>,
render: Function,
__cssModules: {
'$style': Record<string, string>
},
__scopeId: string
__v_skip: boolean
}

export type TPowerLinkObj = Record<string, TPowerLinkContent | null | string[] | string | number | number[]>

export type TUnitPath = {
export type TPowerLink = {
destroyed: boolean,
id: string,
refreshTick: number,
pFlag: boolean,
size: number[],
sizeMapping: Array<number[]>
sizeMapping: Array<Array<number[]>>
slot: null,
unitPath: string
}

export type TPowerLinkMini = Record<string, number | boolean | Array<Record<string, string | boolean | string[] | number | Record<string, string>>>>
}

0 comments on commit 8789884

Please sign in to comment.