icon change only applies to a supported tab
This commit is contained in:
		
							parent
							
								
									7e07a9e2fd
								
							
						
					
					
						commit
						4581ec76f3
					
				
					 1 changed files with 16 additions and 3 deletions
				
			
		|  | @ -1,21 +1,34 @@ | ||||||
| import BrowserIcon from '/scripts/GUI/extensionIcon.js'; | import BrowserIcon from '/scripts/GUI/extensionIcon.js'; | ||||||
| import Image from '/scripts/mapping/image.js'; | import Image from '/scripts/mapping/image.js'; | ||||||
|  | import Tabs from '/scripts/GUI/tabs.js'; | ||||||
| import {session} from '/scripts/secretariat.js'; | import {session} from '/scripts/secretariat.js'; | ||||||
| 
 | 
 | ||||||
| class IconIndicator { | class IconIndicator { | ||||||
|  |      /* | ||||||
|  |      Update the icon.  | ||||||
|  |       | ||||||
|  |      @param {string} state The state to update the icon to.  | ||||||
|  |      */ | ||||||
|  |      static update(state = false) { | ||||||
|  |           (Image.get(((state) ? `default` : 'disabled'))).then((ICON) => { | ||||||
|  |                (Tabs.query(null, 0)).then((DATA) => { | ||||||
|  |                     BrowserIcon.set({"Icon": ICON}, {"tabId": DATA.id}); | ||||||
|  |                }); | ||||||
|  |           }) | ||||||
|  |      } | ||||||
|  | 
 | ||||||
|      /*  |      /*  | ||||||
|      Indicate that the website is supported through icon change.  |      Indicate that the website is supported through icon change.  | ||||||
|      */ |      */ | ||||||
|      static async enable() { |      static async enable() { | ||||||
|           // Set default enabled icon. 
 |           IconIndicator.update(true); | ||||||
|           BrowserIcon.set({"Icon": await Image.get('default')}); |  | ||||||
|      } |      } | ||||||
| 
 | 
 | ||||||
|      /*  |      /*  | ||||||
|      Indicate that the website isn't supported through icon change.  |      Indicate that the website isn't supported through icon change.  | ||||||
|      */ |      */ | ||||||
|      static async disable() { |      static async disable() { | ||||||
|           BrowserIcon.setIcon({"Icon": await Image.get('disabled')}); |           // IconIndicator.update(false);
 | ||||||
|      } |      } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue