use the new checking module
This commit is contained in:
		
							parent
							
								
									2372e09c6d
								
							
						
					
					
						commit
						aaa33b3d39
					
				
					 2 changed files with 8 additions and 19 deletions
				
			
		
							
								
								
									
										8
									
								
								scripts/external/entries/manager.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								scripts/external/entries/manager.js
									
										
									
									
										vendored
									
									
								
							|  | @ -5,20 +5,20 @@ import Tabs from "/scripts/GUI/tabs.js"; | |||
| import MenuEntry from "./menu.js"; | ||||
| import ManagedSidebar from "./sidebar.js"; | ||||
| import IconIndicator from "./icons.js"; | ||||
| import filters from '../../filters.js'; | ||||
| import check from "/scripts/external/check.js"; | ||||
| 
 | ||||
| export default class EntryManager { | ||||
|      constructor () { | ||||
|           this.instances = {}; | ||||
|           this.instances.menu = new MenuEntry(); | ||||
|           Tabs.addActionListener(`onActivated`, (data) => {this.check()}); | ||||
|           Tabs.addActionListener(`onActivated`, (data) => {this.onRefresh()}); | ||||
|      } | ||||
| 
 | ||||
|      async check() { | ||||
|      async onRefresh() { | ||||
|           const DATA = await Tabs.query(null, 0) | ||||
| 
 | ||||
|           if (DATA.url) { | ||||
|                (!!await ((new filters).select(DATA.url))) | ||||
|                (!!await check.platform(DATA.url)) | ||||
|                     ? (this.enable()) | ||||
|                     : (this.disable()) | ||||
|           }; | ||||
|  |  | |||
							
								
								
									
										19
									
								
								scripts/external/watch.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								scripts/external/watch.js
									
										
									
									
										vendored
									
									
								
							|  | @ -2,25 +2,13 @@ | |||
| Be sensitive to changes and update the state. | ||||
| */ | ||||
| 
 | ||||
| import filters from "/scripts/filters.js"; | ||||
| import check from "/scripts/external/check.js"; | ||||
| import processor from "/scripts/external/processor.js"; | ||||
| import logging from "/scripts/logging.js"; | ||||
| import texts from "/scripts/mapping/read.js"; | ||||
| 
 | ||||
| 
 | ||||
| export default class watchman { | ||||
| 	/* Check the current URL. | ||||
| 
 | ||||
| 		@param {string} URL the page URL; default value is the current webpage | ||||
| 		@return {dictionary} the filter to follow | ||||
| 		*/ | ||||
| 	static async observe(URL = window.location.href) { | ||||
| 		// Create the variable to determine the corresponding key.
 | ||||
| 		let activity = await (new filters).select(URL); | ||||
| 
 | ||||
| 		return activity; | ||||
| 	} | ||||
| 
 | ||||
| 	/* Act on the page. | ||||
| 
 | ||||
| 	@param {dictionary} filters the filter to work with | ||||
|  | @ -48,10 +36,11 @@ export default class watchman { | |||
| 		// Set the icon to indicate that it's not active. 
 | ||||
| 	} | ||||
| 
 | ||||
| 	static async job() { | ||||
| 	static job() { | ||||
| 		/* The main action. */ | ||||
| 
 | ||||
| 		(watchman.observe()).then((RULES) => { | ||||
| 		(check.platform()).then((RULES) => { | ||||
| 			console.log(RULES); | ||||
| 			if (RULES && Object.keys(RULES).length !== 0) { | ||||
| 				watchman.act(RULES); | ||||
| 			} else { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue