File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 11
11
// @license MIT
12
12
// @match *://*/*
13
13
// @run -at document-start
14
- // @grant GM_setValue
15
- // @grant GM_getValue
14
+ // @grant GM.setValue
15
+ // @grant GM.getValue
16
16
// ==/UserScript==
17
17
18
- ( ( document ) => {
18
+ ( async ( document ) => {
19
19
'use strict' ;
20
20
let fastNode ;
21
21
let failed ;
36
36
const TEST_PATH = '/gh/PipecraftNet/jsdelivr-auto-fallback@main/empty.css?' ;
37
37
const shouldReplace = ( text ) => text && text . includes ( PREFIX + SOURCE ) ;
38
38
const replace = ( text ) => text . replace ( PREFIX + SOURCE , PREFIX + fastNode ) ;
39
- const setTimeout = window . setTimeout ;
40
39
const $ = document . querySelectorAll . bind ( document ) ;
41
40
42
41
const replaceElementSrc = ( ) => {
124
123
document . head . insertAdjacentElement ( 'afterbegin' , newNode ) ;
125
124
} ;
126
125
127
- const cached = ( ( ) => {
126
+ const cached = await ( async ( ) => {
128
127
try {
129
- // eslint-disable-next-line new-cap
130
- return Object . assign ( { } , GM_getValue ( STORE_KEY ) ) ;
128
+ return Object . assign ( { } , await GM . getValue ( STORE_KEY ) ) ;
131
129
} catch {
132
130
return { } ;
133
131
}
165
163
tryReplace ( ) ;
166
164
}
167
165
168
- // eslint-disable-next-line new-cap
169
- GM_setValue ( STORE_KEY , cached ) ;
166
+ GM . setValue ( STORE_KEY , cached ) ;
170
167
} , TIMEOUT + 100 ) ;
171
168
} ;
172
169
You can’t perform that action at this time.
0 commit comments