File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ const Win = typeof unsafeWindow !== 'undefined' ? unsafeWindow : window
1919export function RunNamuLinkUserscript ( BrowserWindow : typeof window , UserscriptName : string = 'NamuLink' ) : void {
2020 const ProtectedFunctionPrototypeToString = BrowserWindow . Function . prototype . toString
2121
22- window . addEventListener ( 'DOMContentLoaded' , ( ) => {
22+ if ( document . readyState === 'loading' ) {
23+ window . addEventListener ( 'DOMContentLoaded' , ( ) => {
2324 SPA . InstallSpaNavigationBridge ( {
2425 Root : ( ) => document . getElementById ( '#app' ) ,
2526 StableForMs : 900 ,
@@ -30,6 +31,20 @@ export function RunNamuLinkUserscript(BrowserWindow: typeof window, UserscriptNa
3031 WatchHashChange : true
3132 } )
3233 } )
34+ } else {
35+ // 이미 DOMContentLoaded 이후
36+ window . addEventListener ( 'DOMContentLoaded' , ( ) => {
37+ SPA . InstallSpaNavigationBridge ( {
38+ Root : ( ) => document . getElementById ( '#app' ) ,
39+ StableForMs : 900 ,
40+ SampleWindowMs : 900 ,
41+ Threshold : 3 ,
42+ TimeoutMs : 12000 ,
43+ IgnoreMutation : SPA . DefaultIgnoreMutation ,
44+ WatchHashChange : true
45+ } )
46+ } )
47+ }
3348
3449 window . addEventListener ( 'SpaRendered' , async ( ) => {
3550 let HTMLEle = Sort . CollectDataVAttributes ( document )
You can’t perform that action at this time.
0 commit comments