33 convertBlobToBase64 ,
44 runScriptInTab ,
55 getAllActiveScriptIds ,
6+ trackingUseScript ,
67} from "../helpers/utils.js" ;
78
89const { ISOLATED , MAIN } = chrome . scripting . ExecutionWorld ;
@@ -22,7 +23,7 @@ function runScripts(tabId, event, world) {
2223 runScriptInTab ( {
2324 tabId : tabId ,
2425 func : ( scriptIds , event , path ) => {
25- window . ufs_runScritps ?. ( scriptIds , event , path ) ;
26+ window . runScripts ?. ( scriptIds , event , path ) ;
2627 } ,
2728 args : [ CACHED . activeScriptIds , event , CACHED . path ] ,
2829 world,
@@ -31,6 +32,7 @@ function runScripts(tabId, event, world) {
3132
3233const global = {
3334 log : console . log ,
35+ trackingUseScript,
3436 async fetch ( url , options ) {
3537 const res = await fetch ( url , options ) ;
3638 let body ;
@@ -65,25 +67,6 @@ const global = {
6567 console . log ( "Response from background script:" , data ) ;
6668 return data ;
6769 } ,
68- async updateScriptClickCount ( scriptId ) {
69- console . log ( "updateScriptClickCount" , scriptId ) ;
70- // return;
71- try {
72- let res = await fetch (
73- "https://useful-script-statistic.glitch.me/count" ,
74- // "https://useful-script-statistic.onrender.com/count",
75- {
76- method : "POST" ,
77- headers : { "Content-Type" : "application/json" } ,
78- body : JSON . stringify ( { script : scriptId } ) ,
79- }
80- ) ;
81- return await res . text ( ) ;
82- } catch ( e ) {
83- console . log ( "ERROR update script click count: " , e ) ;
84- return null ;
85- }
86- } ,
8770} ;
8871
8972function main ( ) {
@@ -197,8 +180,9 @@ function main() {
197180 } ) ;
198181
199182 chrome . runtime . onInstalled . addListener ( function ( ) {
200- global . updateScriptClickCount ( "ufs-installed" ) ;
201- console . log ( "install" ) ;
183+ global . trackingUseScript ( "ufs-installed" ) ;
184+ console . log ( "installed" , version ) ;
185+
202186 chrome . contextMenus . create ( {
203187 title : "Magnify this image" ,
204188 contexts : [ "image" ] ,
0 commit comments