1
+ import type { TPowerLinkContent } from './powerlinkcontent.js'
2
+
1
3
type unsafeWindow = typeof window
2
4
// eslint-disable-next-line @typescript-eslint/naming-convention
3
5
declare const unsafeWindow : unsafeWindow
4
6
5
7
const Win = typeof unsafeWindow !== 'undefined' ? unsafeWindow : window
6
8
7
- let HideLeftover = ( ) => {
8
- setInterval ( ( ) => {
9
- Array . from ( document . querySelectorAll ( 'div[class*=" "] div[class]' ) ) . filter ( ( TargetEle : HTMLElement ) => {
10
- return ( Array . from ( TargetEle . querySelectorAll ( '*' ) ) . filter ( ( ChildEle : HTMLElement ) => {
11
- return getComputedStyle ( ChildEle ) . getPropertyValue ( 'animation' ) . includes ( 'infinite' )
12
- } ) . length >= 6 || TargetEle . innerText === '' || TargetEle . innerText . includes ( '파워링크' ) ) &&
13
- ( Number ( getComputedStyle ( TargetEle ) . getPropertyValue ( 'margin-top' ) . replace ( 'px' , '' ) ) > 10 || Number ( getComputedStyle ( TargetEle ) . getPropertyValue ( 'margin-bottom' ) . replace ( 'px' , '' ) ) > 10 ) &&
14
- Number ( getComputedStyle ( TargetEle ) . getPropertyValue ( 'height' ) . replace ( 'px' , '' ) ) < 350
15
- } ) . forEach ( ( TargetEle : HTMLElement ) => {
16
- TargetEle . setAttribute ( 'style' , 'visibility: hidden !important; width: 1px !important; height: 1px !important;' )
17
- } )
18
- } , 2500 )
19
- }
20
-
21
- let RegExPatterns : RegExp [ ] = [
22
- / ^ # x = [ A - Z a - z 0 - 9 - + ] + \/ \/ \/ .+ = ? $ / ,
23
- / ^ [ A - Z a - z 0 - 9 + \/ ] + \/ { 3 , } w = + /
24
- ]
25
-
26
9
Win . Proxy = new Proxy ( Win . Proxy , {
27
10
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
28
11
construct < T extends object > ( Target : ProxyConstructor , Args : [ T , ProxyHandler < T > ] , NewTarget : Function ) : object {
29
- if ( typeof Args [ 0 ] === 'object' && Array . isArray ( Args [ 0 ] ) && typeof Args [ 0 ] [ 0 ] === 'object' && Array . isArray ( Args [ 0 ] [ 0 ] )
30
- && typeof Args [ 0 ] [ 0 ] [ 1 ] === 'string' && RegExPatterns . some ( ( Pattern : RegExp ) => Pattern . test ( Args [ 0 ] [ 0 ] [ 1 ] ) ) ) {
31
- HideLeftover ( )
32
- return Reflect . construct ( Target , [ Args [ 0 ] , [ '파워링크' ] ] , NewTarget )
33
- }
34
- if ( typeof Args [ 0 ] === 'object' && Object . keys ( Args [ 0 ] ) . some ( ( Key : string ) => RegExPatterns . some ( ( Pattern : RegExp ) => typeof Args [ 0 ] [ Key ] === 'string' && Pattern . test ( Args [ 0 ] [ Key ] ) ) ) ) {
35
- HideLeftover ( )
36
- let ArgsObj = Args [ 0 ]
37
- Object . keys ( ArgsObj ) . map ( ( Key : string ) => {
38
- if ( typeof ArgsObj [ Key ] === 'string' ) {
39
- ArgsObj [ Key ] = '파워링크'
40
- }
41
- } )
42
- return Reflect . construct ( Target , [ Args [ 0 ] , ArgsObj ] , NewTarget )
43
- }
44
- if ( typeof Args [ 0 ] === 'object' && Object . keys ( Args [ 0 ] ) . some ( ( Key : string ) => typeof Args [ 0 ] [ Key ] === 'string' &&
45
- ( Args [ 0 ] [ Key ] . includes ( 'searchad.naver.com' ) || Args [ 0 ] [ Key ] . includes ( 'saedu.naver.com/adbiz/' ) ) ) ) {
46
- HideLeftover ( )
47
- return
48
- }
49
-
50
- // Object inner section analysis
51
- let TensorResult : Array < number > = [ 0 , 0 , 0 ] // string, number, boolean
52
- if ( typeof Args [ 0 ] === 'object' ) {
53
- Object . keys ( Args [ 0 ] ) . forEach ( ( Key : string ) => {
54
- switch ( typeof Args [ 0 ] [ Key ] ) {
55
- case 'string' :
56
- if ( Args [ 0 ] [ Key ] . length > 5 ) {
57
- TensorResult [ 0 ] ++
58
- }
59
- break
60
- case 'number' :
61
- TensorResult [ 1 ] ++
62
- break
63
- case 'boolean' :
64
- TensorResult [ 2 ] ++
65
- break
66
- }
67
- } )
68
- }
69
- if ( TensorResult . every ( ( Result ) => Result >= 3 ) && typeof Args [ 0 ] [ 'content' ] !== 'object' ) {
70
- HideLeftover ( )
71
- return Reflect . construct ( Target , [ Args [ 0 ] , [ '파워링크' ] ] , NewTarget )
72
- }
73
- //
12
+ if ( typeof Args [ 0 ] === 'object' && Object . keys ( Args [ 0 ] ) . some ( ( Key : string ) => Key . startsWith ( 'Content' ) )
13
+ && Object . keys ( Args [ 0 ] ) . filter ( ( Key : string ) => Key . startsWith ( 'Content' ) ) . some ( ( Key : string ) => {
14
+ return typeof Args [ 0 ] [ Key ] . render === 'function' && Args [ 0 ] [ Key ] . render . toString ( ) . includes ( 'powerlink' )
15
+ } ) ) {
16
+ let Contents = Object . keys ( Args [ 0 ] ) . filter ( ( Key : string ) => Key . startsWith ( 'Content' ) ) . map ( ( Key : string ) => Args [ 0 ] [ Key ] ) as TPowerLinkContent [ ]
17
+ Contents . map ( ( Content : TPowerLinkContent ) => Content . render = ( ) => { } )
18
+ return Reflect . construct ( Target , [ Contents , Args [ 1 ] ] , NewTarget )
19
+ }
74
20
return Reflect . construct ( Target , Args , NewTarget )
75
21
}
76
- } )
77
-
78
- Win . Object . prototype . toString = new Proxy ( Win . Object . prototype . toString , {
79
- apply ( Target : typeof Object . prototype . toString , ThisArg : unknown , Args : [ ] ) {
80
- let TensorResult : Array < number > = [ 0 , 0 , 0 ] // string, number, boolean
81
- if ( typeof ThisArg === 'object' ) {
82
- Object . keys ( ThisArg ) . forEach ( ( Key : string ) => {
83
- switch ( typeof ThisArg [ Key ] ) {
84
- case 'string' :
85
- if ( ThisArg [ Key ] . length > 5 ) {
86
- TensorResult [ 0 ] ++
87
- }
88
- break
89
- case 'number' :
90
- TensorResult [ 1 ] ++
91
- break
92
- case 'boolean' :
93
- TensorResult [ 2 ] ++
94
- break
95
- }
96
- } )
97
- }
98
- if ( TensorResult . every ( ( Result ) => Result >= 3 ) && typeof ThisArg [ 'content' ] !== 'object' ) {
99
- HideLeftover ( )
100
- return [ ]
101
- }
102
- return Reflect . apply ( Target , ThisArg , Args )
103
- }
104
22
} )
0 commit comments