add function to pass the creation of the callback made in EntryManager
This commit is contained in:
		
							parent
							
								
									b85be98f1f
								
							
						
					
					
						commit
						093511e738
					
				
					 1 changed files with 26 additions and 3 deletions
				
			
		|  | @ -4,19 +4,42 @@ import Tabs from '/scripts/GUI/tabs.js'; | ||||||
| import texts from "/scripts/mapping/read.js"; | import texts from "/scripts/mapping/read.js"; | ||||||
| import {session} from '/scripts/secretariat.js'; | import {session} from '/scripts/secretariat.js'; | ||||||
| 
 | 
 | ||||||
|  | const CONFIG = chrome.runtime.getURL("styles/colors/icon.json"); | ||||||
|  | 
 | ||||||
| class IconIndicator { | class IconIndicator { | ||||||
| 	/*  | 	/*  | ||||||
| 	Indicate that the website is supported through icon change.  | 	Indicate that the website is supported through icon change.  | ||||||
| 	*/ | 	*/ | ||||||
| 	static async enable() { | 	static enable() { | ||||||
| 		BrowserIcon.set({"BadgeText": await (new texts(`extensionIcon_website_loading`)).symbol}); | 		BrowserIcon.enable(); | ||||||
|  | 		(Tabs.query(null, 0)).then(async (TAB) => { | ||||||
|  | 			BrowserIcon.set({ | ||||||
|  | 					"BadgeText": await (new texts(`extensionIcon_website_loading`)).symbol, | ||||||
|  | 					"BadgeBackgroundColor": await fetch(CONFIG).then((response) => response.json()).then((jsonData) => {return (jsonData[`loading`]);}) | ||||||
|  | 				}, {"tabId": TAB.id}); | ||||||
|  | 		}) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/*  | 	/*  | ||||||
| 	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.set({"BadgeText": await (new texts(`extensionIcon_website_unsupported`)).symbol}); | 		BrowserIcon.disable(); | ||||||
|  | 		(Tabs.query(null, 0)).then(async (TAB) => { | ||||||
|  | 			BrowserIcon.set({ | ||||||
|  | 					"BadgeText": await (new texts(`extensionIcon_website_unsupported`)).symbol, | ||||||
|  | 					"BadgeBackgroundColor": await fetch(CONFIG).then((response) => response.json()).then((jsonData) => {return (jsonData[`N/A`]);}) | ||||||
|  | 				}, {"tabId": TAB.id}); | ||||||
|  | 		}) | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	/* | ||||||
|  | 	Set the function.  | ||||||
|  | 	 | ||||||
|  | 	@param {function} callback the function to run. | ||||||
|  | 	*/ | ||||||
|  | 	static set(callback) { | ||||||
|  | 		BrowserIcon.addEventListener("onClicked", callback); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue