File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed
src/content-script/site-adapters/github Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -19,22 +19,17 @@ const getPatchData = async (patchUrl) => {
19
19
export default {
20
20
init : async ( hostname , userConfig , getInput , mountComponent ) => {
21
21
try {
22
- const targetNode = document . querySelector ( 'body' )
23
- const observer = new MutationObserver ( async ( records ) => {
24
- if (
25
- records . some (
26
- ( record ) =>
27
- record . type === 'childList' &&
28
- [ ...record . addedNodes ] . some ( ( node ) => node . classList . contains ( 'page-responsive' ) ) ,
29
- )
30
- ) {
22
+ let oldUrl = location . href
23
+ const checkUrlChange = async ( ) => {
24
+ if ( location . href !== oldUrl ) {
25
+ oldUrl = location . href
31
26
const patchUrl = await getPatchUrl ( )
32
27
if ( patchUrl ) {
33
28
mountComponent ( config . github , userConfig )
34
29
}
35
30
}
36
- } )
37
- observer . observe ( targetNode , { childList : true } )
31
+ }
32
+ window . setInterval ( checkUrlChange , 500 )
38
33
} catch ( e ) {
39
34
/* empty */
40
35
}
You can’t perform that action at this time.
0 commit comments