File tree 3 files changed +51
-5
lines changed
3 files changed +51
-5
lines changed Original file line number Diff line number Diff line change @@ -31,8 +31,10 @@ packageChromeFunction() {
31
31
}
32
32
33
33
prepareFirefoxFunction () {
34
- echo " Preparing manifest.json for Firefox"
35
- sed -i -e ' 14d;16d;17d' ./dev/manifest.json
34
+ # echo "Preparing manifest.json for Firefox"
35
+ echo " Firefox is currently not supported. It uses a different manifest.json file. Use an older version of the extension for Firefox."
36
+ exit 1
37
+ # sed -i -e '14d;16d;17d' ./dev/manifest.json
36
38
cd ./dev/
37
39
zip -qr firefox.zip ./*
38
40
cd ..
Original file line number Diff line number Diff line change @@ -125,4 +125,47 @@ setBadgeColor('#000000');
125
125
setBadgeTextColor ( '#ffffff' ) ;
126
126
setBadgeText ( '...' ) ;
127
127
fetchGeoLocation ( ) ;
128
- let intval = setInterval ( fetchGeoLocation , checkInterval ) ;
128
+
129
+ let intval ;
130
+
131
+ function startInterval ( ) {
132
+ if ( ! intval ) {
133
+ intval = setInterval ( fetchGeoLocation , checkInterval ) ;
134
+ }
135
+ }
136
+
137
+ function stopInterval ( ) {
138
+ if ( intval ) {
139
+ clearInterval ( intval ) ;
140
+ intval = null ;
141
+ }
142
+ }
143
+
144
+ chrome . alarms . onAlarm . addListener ( ( alarm ) => {
145
+ console . log ( 'alarm fired' ) ;
146
+ console . log ( alarm ) ;
147
+ if ( alarm . name === 'checkIntervalAlarm' ) {
148
+ stopInterval ( ) ;
149
+ startInterval ( ) ;
150
+ }
151
+ } ) ;
152
+
153
+ chrome . runtime . onSuspend . addListener ( function ( ) {
154
+ console . log ( 'unloading' ) ;
155
+ stopInterval ( ) ;
156
+ } ) ;
157
+
158
+
159
+ chrome . alarms . onAlarm . addListener ( ( alarm ) => {
160
+ console . log ( 'alarm fired' ) ;
161
+ if ( alarm . name === 'checkIntervalAlarm' ) {
162
+ stopInterval ( ) ;
163
+ startInterval ( ) ;
164
+ }
165
+ } ) ;
166
+
167
+ chrome . runtime . onInstalled . addListener ( ( ) => {
168
+ console . log ( 'installed' ) ;
169
+ startInterval ( ) ;
170
+ chrome . alarms . create ( 'checkIntervalAlarm' , { periodInMinutes : 1 * 60000 } ) ;
171
+ } ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " IP Address & Geolocation" ,
3
- "version" : " 3.0.1 " ,
3
+ "version" : " 3.0.2 " ,
4
4
"manifest_version" : 3 ,
5
5
"icons" : {
6
6
"16" : " img/icon16.png" ,
21
21
},
22
22
"permissions" : [
23
23
" notifications" ,
24
- " storage"
24
+ " storage" ,
25
+ " alarms"
25
26
],
26
27
"minimum_chrome_version" : " 88" ,
27
28
"options_ui" : {
You can’t perform that action at this time.
0 commit comments