diff --git a/background/navigation-manager.js b/background/navigation-manager.js index 78417f15..c9df95e5 100644 --- a/background/navigation-manager.js +++ b/background/navigation-manager.js @@ -78,7 +78,7 @@ bgReady.all.then(() => { }); }, { url: [ - {hostEquals: 'userstyles.world', urlMatches: '/style/\\d+[^/]*/[a-z-0-9]+$'}, + {hostEquals: 'userstyles.world'}, ], }); /* diff --git a/content/install-hook-userstylesworld.js b/content/install-hook-userstylesworld.js index aaa98364..23f7c0d8 100644 --- a/content/install-hook-userstylesworld.js +++ b/content/install-hook-userstylesworld.js @@ -3,12 +3,18 @@ (() => { const allowedOrigin = 'https://userstyles.world'; + const sendPostMessage = message => { + if (allowedOrigin === location.origin) { + window.postMessage(message, location.origin); + } + }; + const onPageLoaded = event => { if (event.data - && event.data.type === 'usw-remove-stylus-button' + && event.data.type === 'usw-ready' && allowedOrigin === event.origin ) { - document.querySelector('a#stylus').remove(); + sendPostMessage({type: 'usw-remove-stylus-button'}); } };