File tree Expand file tree Collapse file tree 3 files changed +19
-7
lines changed
Expand file tree Collapse file tree 3 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " Surfingkeys" ,
3- "version" : " 1.17.4 " ,
3+ "version" : " 1.17.5 " ,
44 "description" : " Map your keys for web surfing, expand your browser with javascript and keyboard." ,
55 "main" : " background.js" ,
66 "directories" : {
Original file line number Diff line number Diff line change @@ -188,6 +188,9 @@ window.getFrameId = function () {
188188 && window . frameElement . offsetWidth > 16 && window . frameElement . offsetWidth > 16 ) )
189189 ) {
190190 _initContent ( _initModules ( ) ) ;
191+
192+ // Only used to load user script for iframes in MV3
193+ dispatchSKEvent ( 'user' , [ "runUserScript" ] ) ;
191194 }
192195 return window . frameId ;
193196} ;
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ const functionsToListSuggestions = {};
6868let inlineQuery ;
6969let hintsFunction ;
7070let onClipboardReadFn ;
71+ let userScriptTask = ( ) => { } ;
7172initSKFunctionListener ( "user" , {
7273 callUserFunction : ( keys , para ) => {
7374 if ( userDefinedFunctions . hasOwnProperty ( keys ) ) {
@@ -93,6 +94,9 @@ initSKFunctionListener("user", {
9394 }
9495 } ) ;
9596 } ,
97+ runUserScript : ( ) => {
98+ userScriptTask ( ) ;
99+ } ,
96100 onClipboardRead : ( resp ) => {
97101 onClipboardReadFn ( resp ) ;
98102 } ,
@@ -227,11 +231,16 @@ const api = {
227231export default ( extensionRootUrl , uf ) => {
228232 EXTENSION_ROOT_URL = extensionRootUrl ;
229233 if ( isInUIFrame ( ) ) return ;
230- var settings = { } , error = "" ;
231- try {
232- uf ( api , settings ) ;
233- } catch ( e ) {
234- error = e . toString ( ) ;
234+ userScriptTask = ( ) => {
235+ var settings = { } , error = "" ;
236+ try {
237+ uf ( api , settings ) ;
238+ } catch ( e ) {
239+ error = e . toString ( ) ;
240+ }
241+ applyUserSettings ( { settings, error} ) ;
242+ } ;
243+ if ( window === top ) {
244+ userScriptTask ( ) ;
235245 }
236- applyUserSettings ( { settings, error} ) ;
237246} ;
You can’t perform that action at this time.
0 commit comments