22// the background page to activate or deactivate the icon
33
44import { debug } from "../../../debug" ;
5- import { isFirefox } from "../utils" ;
6-
7- const IS_FIREFOX = isFirefox ( ) ;
8- function getUrl ( url : string ) {
9- if ( IS_FIREFOX ) return url ;
10- return chrome . runtime . getURL ( url ) ;
11- }
125
136export function setPopupStatus ( tabId : number , enabled ?: boolean ) {
147 const status = enabled ? "enabled" : "disabled" ;
@@ -19,18 +12,18 @@ export function setPopupStatus(tabId: number, enabled?: boolean) {
1912 ) ;
2013 const suffix = enabled ? "" : "-disabled" ;
2114
22- ( IS_FIREFOX ? chrome . browserAction : chrome . action ) . setIcon ( {
15+ chrome . browserAction . setIcon ( {
2316 tabId,
2417 path : {
25- "16" : getUrl ( `icons/icon-16${ suffix } .png` ) ,
26- "32" : getUrl ( `icons/icon-32${ suffix } .png` ) ,
27- "48" : getUrl ( `icons/icon-48${ suffix } .png` ) ,
28- "128" : getUrl ( `icons/icon-128${ suffix } .png` ) ,
29- "192" : getUrl ( `icons/icon-192${ suffix } .png` ) ,
18+ "16" : `icons/icon-16${ suffix } .png` ,
19+ "32" : `icons/icon-32${ suffix } .png` ,
20+ "48" : `icons/icon-48${ suffix } .png` ,
21+ "128" : `icons/icon-128${ suffix } .png` ,
22+ "192" : `icons/icon-192${ suffix } .png` ,
3023 } ,
3124 } ) ;
32- ( IS_FIREFOX ? chrome . browserAction : chrome . action ) . setPopup ( {
25+ chrome . browserAction . setPopup ( {
3326 tabId,
34- popup : getUrl ( `popup/${ status } .html` ) ,
27+ popup : `popup/${ status } .html` ,
3528 } ) ;
3629}
0 commit comments