Skip to content

Commit 3f60fe2

Browse files
committed
fix: some wiki content elements are placed in a wrong loc
https://gall.dcinside.com/mgallery/board/view/?id=adguard&no=67&page=1
1 parent 4d02d8c commit 3f60fe2

File tree

5 files changed

+37
-40
lines changed

5 files changed

+37
-40
lines changed

eslint.config.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import tsPlugin from "@typescript-eslint/eslint-plugin"
2+
import tsParser from "@typescript-eslint/parser"
3+
4+
const config = [
5+
{
6+
files: ["**/*.ts", "**/*.tsx"], // Target TypeScript files
7+
languageOptions: {
8+
parser: tsParser,
9+
sourceType: "module",
10+
},
11+
plugins: {
12+
"@typescript-eslint": tsPlugin,
13+
},
14+
rules: {
15+
...tsPlugin.configs.recommended.rules,
16+
"semi": ["error", "never"],
17+
"quotes": ["error", "single"],
18+
"@typescript-eslint/no-unused-vars": "warn",
19+
'@typescript-eslint/naming-convention': ['error', {
20+
selector: ['variableLike', 'parameterProperty', 'classProperty', 'typeProperty'],
21+
format: ['PascalCase']
22+
}]
23+
}
24+
}
25+
]
26+
27+
export default config

package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@list-kr/namulink",
3-
"version": "4.0.14",
3+
"version": "4.1.0",
44
"description": "",
55
"type": "module",
66
"scripts": {
@@ -38,18 +38,16 @@
3838
],
3939
"license": "MIT",
4040
"dependencies": {
41-
"@types/node": "^20.14.10",
41+
"@types/node": "^20.17.1",
4242
"is-valid-domain": "^0.1.6",
4343
"multithread-array": "^2.0.0",
4444
"p-limit": "^6.1.0"
4545
},
4646
"devDependencies": {
47-
"@typescript-eslint/eslint-plugin": "^7.1.1",
48-
"@typescript-eslint/parser": "^7.1.1",
49-
"esbuild": "^0.21.5",
50-
"eslint": "^8.57.0",
51-
"pnpm": "^9.5.0",
52-
"typescript": "^5.5.3",
53-
"typescript-eslint": "^7.16.0"
47+
"esbuild": "^0.24.0",
48+
"eslint": "^9.13.0",
49+
"pnpm": "^9.12.3",
50+
"typescript": "^5.6.3",
51+
"typescript-eslint": "^8.11.0"
5452
}
5553
}

sources/.eslintrc.cjs

Lines changed: 0 additions & 25 deletions
This file was deleted.

sources/banner.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// @downloadURL https://cdn.jsdelivr.net/npm/@list-kr/namulink@latest/dist/NamuLink.user.js
99
// @license MIT
1010
//
11-
// @version 4.0.14
11+
// @version 4.1.0
1212
// @author PiQuark6046 and contributors
1313
//
1414
// @match https://namu.wiki/*

sources/src/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ import PLimit from 'p-limit'
33
import {SplitElementsIntoSubArrayLength} from 'multithread-array'
44

55
type unsafeWindow = typeof window
6-
// eslint-disable-next-line @typescript-eslint/no-redeclare, @typescript-eslint/naming-convention
6+
// eslint-disable-next-line @typescript-eslint/naming-convention
77
declare const unsafeWindow: unsafeWindow
88

9-
// eslint-disable-next-line no-negated-condition
109
const Win = typeof unsafeWindow !== 'undefined' ? unsafeWindow : window
1110

1211
const RemoveElements = (TargetElements: HTMLElement[]) => {
1312
TargetElements.forEach(TargetElement => {
14-
TargetElement.remove()
13+
TargetElement.setAttribute('style', 'visibility: hidden !important; width: 1px !important; height: 1px !important;')
1514
})
1615
}
1716

@@ -29,7 +28,6 @@ const RemovePowerLinkAdWorker = (SearchedElements: HTMLElement[]): HTMLElement[]
2928
TargetedElements = TargetedElements.filter(SearchedElement => {
3029
return Array.from(SearchedElement.querySelectorAll('a,span,div')).filter(HTMLInElement => {
3130
return HTMLInElement instanceof HTMLElement
32-
// eslint-disable-next-line no-irregular-whitespace
3331
&& IsValidDomain((HTMLInElement.innerText.replaceAll(/ /g, '').match(/^[^/]+(?=\/)?/g) ?? [''])[0], { allowUnicode: true, subdomain: true }) // Zero width space and space should be removed.
3432
}).length >= 2
3533
|| Array.from(SearchedElement.querySelectorAll('*')).filter(HTMLInElement => {
@@ -44,7 +42,6 @@ const RemovePowerLinkAdWorker = (SearchedElements: HTMLElement[]): HTMLElement[]
4442
})
4543
TargetedElements = TargetedElements.filter(SearchedElement => {
4644
return Array.from(SearchedElement.querySelectorAll('*[href^="#fn-"]')).filter(HTMLInElement => {
47-
// eslint-disable-next-line no-irregular-whitespace
4845
return HTMLInElement instanceof HTMLElement && /\[[0-9]+\]/.test(HTMLInElement.innerText.replaceAll(/ /g, '')) // Zero width space and space should be removed.
4946
}).length === 0
5047
})

0 commit comments

Comments
 (0)