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) => {
1919export default {
2020 init : async ( hostname , userConfig , getInput , mountComponent ) => {
2121 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
3126 const patchUrl = await getPatchUrl ( )
3227 if ( patchUrl ) {
3328 mountComponent ( config . github , userConfig )
3429 }
3530 }
36- } )
37- observer . observe ( targetNode , { childList : true } )
31+ }
32+ window . setInterval ( checkUrlChange , 500 )
3833 } catch ( e ) {
3934 /* empty */
4035 }
You can’t perform that action at this time.
0 commit comments