@@ -22,14 +22,17 @@ function iframeLoad() {
22
22
const website = iframe . contentWindow ?. location . href . replace ( window . location . origin , '' ) . replace ( '/a/' , '' )
23
23
document . getElementById ( 'is' ) . value = decodeXor ( website )
24
24
localStorage . setItem ( 'decoded' , decodeXor ( website ) ) ;
25
+ window . parent . postMessage ( { decodedSet : true } , '*' ) ;
25
26
} else if ( website . includes ( '/a/q/' ) ) {
26
27
const website = iframe . contentWindow ?. location . href . replace ( window . location . origin , '' ) . replace ( '/a/q/' , '' )
27
28
document . getElementById ( 'is' ) . value = decodeXor ( website )
28
29
localStorage . setItem ( 'decoded' , decodeXor ( website ) ) ;
30
+ window . parent . postMessage ( { decodedSet : true } , '*' ) ;
29
31
}
30
32
}
31
33
}
32
34
35
+
33
36
// Reload
34
37
function reload ( ) {
35
38
if ( iframe ) {
@@ -141,43 +144,58 @@ document.addEventListener('fullscreenchange', function () {
141
144
// Now
142
145
const key = [ 'nowgg' , 'now.gg' ] ;
143
146
const decoded = localStorage . getItem ( 'decoded' ) ;
147
+ let decodedSet = false ;
148
+
149
+ window . addEventListener ( 'message' , function ( event ) {
150
+ if ( event . data && event . data . decodedSet === true ) {
151
+ decodedSet = true ;
152
+ console . log ( 'Starting process.' ) ;
153
+ now ( ) ;
154
+ }
155
+ } ) ;
144
156
145
- if ( decoded ) {
157
+ function now ( ) {
158
+ if ( decoded ) {
146
159
let found = false ;
147
160
for ( const keyword of key ) {
148
- if ( decoded . includes ( keyword ) ) {
149
- console . log ( `${ keyword } found` ) ;
150
- found = true ;
151
- break ;
152
- }
161
+ if ( decoded . includes ( keyword ) ) {
162
+ console . log ( `${ keyword } found` ) ;
163
+ found = true ;
164
+ break ;
165
+ }
153
166
}
154
167
if ( found ) {
155
- let count = 0 ;
156
- let notfound = 0 ;
157
- const limit = 10 ;
158
- const max = 35 ;
159
- const reloadInterval = setInterval ( ( ) => {
160
- if ( count < limit && iframe ) {
161
- const iframeDocument = iframe . contentDocument || iframe . contentWindow . document ;
162
- const element = iframeDocument . querySelector ( '.sc-hGPBjI.gGkQpt' ) ;
163
- if ( element ) {
164
- console . log ( "Unsafe proxy or VPN detected. Reloading..." ) ;
165
- iframe . contentWindow . location . reload ( ) ;
166
- count ++ ;
167
- notfound = 0 ;
168
- } else {
169
- console . log ( "Class not found inside the iframe." ) ;
170
- notfound ++ ;
171
- if ( notfound >= max ) {
172
- console . log ( `Class not found for ${ max } consecutive checks. Stopping.` ) ;
173
- clearInterval ( reloadInterval ) ;
174
- }
175
- }
176
- } else {
177
- clearInterval ( reloadInterval ) ;
168
+ let count = 0 ;
169
+ let notfound = 0 ;
170
+ const limit = 10 ;
171
+ const max = 35 ;
172
+ const reloadInterval = setInterval ( ( ) => {
173
+ if ( count < limit && iframe ) {
174
+ const iframeDocument = iframe . contentDocument || iframe . contentWindow . document ;
175
+ const element = iframeDocument . querySelector ( '.sc-hGPBjI.gGkQpt' ) ;
176
+ if ( element ) {
177
+ console . log ( "Unsafe proxy or VPN detected. Reloading..." ) ;
178
+ iframe . contentWindow . location . reload ( ) ;
179
+ count += 1 ;
180
+ notfound = 0 ;
181
+ } else {
182
+ console . log ( "Class not found inside the iframe." ) ;
183
+ notfound += 1 ;
184
+ if ( notfound >= max ) {
185
+ console . log ( `Class not found for ${ max } consecutive checks. Stopping.` ) ;
186
+ clearInterval ( reloadInterval ) ;
178
187
}
179
- } , 500 ) ;
188
+ }
189
+ } else {
190
+ clearInterval ( reloadInterval ) ;
191
+ }
192
+ } , 500 ) ;
180
193
}
181
- } else {
194
+ } else {
182
195
console . log ( 'Decoded not found in localStorage.' ) ;
196
+ }
197
+ }
198
+
199
+ if ( decodedSet ) {
200
+ now ( ) ;
183
201
}
0 commit comments