update reference to be as default functions
This commit is contained in:
		
							parent
							
								
									1e9c50dc9e
								
							
						
					
					
						commit
						8164ccf8e4
					
				
					 1 changed files with 55 additions and 45 deletions
				
			
		|  | @ -6,14 +6,14 @@ | ||||||
| //import { windowman } from "../windowman.js";
 | //import { windowman } from "../windowman.js";
 | ||||||
| 
 | 
 | ||||||
| async function build() { | async function build() { | ||||||
| 	let secretariat = ( |   let secretariat = await import( | ||||||
| 		await import(chrome.runtime.getURL("scripts/secretariat.js")) |     chrome.runtime.getURL("scripts/secretariat.js") | ||||||
| 	); |   ); | ||||||
| 	let windowman = ( |   let windowman = ( | ||||||
| 		await import(chrome.runtime.getURL("gui/scripts/windowman.js")) |     await import(chrome.runtime.getURL("gui/scripts/windowman.js")) | ||||||
| 	).default; |   ).default; | ||||||
| 
 | 
 | ||||||
| 	let window = new windowman(); |   let window = new windowman(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* | /* | ||||||
|  | @ -47,51 +47,61 @@ function main() { | ||||||
| 		Define the mapping of each button. | 		Define the mapping of each button. | ||||||
| 		*/ | 		*/ | ||||||
| function events() { | function events() { | ||||||
| 	if (document.querySelector(`[data-action="filters,update"]`)) { |   if (document.querySelector(`[data-action="filters,update"]`)) { | ||||||
| 		document.querySelector(`[data-action="filters,update"]`).addEventListener(`click`, async () => { |     document | ||||||
| 			let filters = new (( |       .querySelector(`[data-action="filters,update"]`) | ||||||
| 				await import(chrome.runtime.getURL(`scripts/filters.js`)) |       .addEventListener(`click`, async () => { | ||||||
| 			).default); |         let filters = new ( | ||||||
| 			await filters.update(); |           await import(chrome.runtime.getURL(`scripts/filters.js`)) | ||||||
| 		}); |         ).default(); | ||||||
| 	} |         await filters.update(); | ||||||
| 	 |       }); | ||||||
| 	if (document.querySelector(`[data-action="filters,add,one"]`)) { |   } | ||||||
| 		document.querySelector(`[data-action="filters,add,one"]`).addEventListener(`click`, async () => { |  | ||||||
| 			(async () => { |  | ||||||
| 				// Import the filters module.
 |  | ||||||
| 				let texts = (await import(chrome.runtime.getURL(`gui/scripts/read.js`))).default; |  | ||||||
| 				let filters = new ((await import(chrome.runtime.getURL(`scripts/filters.js`))).default); |  | ||||||
| 
 | 
 | ||||||
| 				// Open text input window for adding a filter.
 |   if (document.querySelector(`[data-action="filters,add,one"]`)) { | ||||||
| 				let filter_source = prompt(texts.localized(`settings_filters_add_prompt`)); |     document | ||||||
| 				if (filter_source.trim) { |       .querySelector(`[data-action="filters,add,one"]`) | ||||||
| 					filters.update(filter_source.trim); |       .addEventListener(`click`, async () => { | ||||||
| 				}; |         (async () => { | ||||||
| 			})(); |           // Import the filters module.
 | ||||||
| 		}); |           let texts = ( | ||||||
| 	} |             await import(chrome.runtime.getURL(`gui/scripts/read.js`)) | ||||||
|  |           ).default; | ||||||
|  |           let filters = new ( | ||||||
|  |             await import(chrome.runtime.getURL(`scripts/filters.js`)) | ||||||
|  |           ).default(); | ||||||
| 
 | 
 | ||||||
| 	if (document.querySelector(`[data-action="storage,clear"]`)) { |           // Open text input window for adding a filter.
 | ||||||
| 		document |           let filter_source = prompt( | ||||||
| 			.querySelector(`[data-action="storage,clear"]`) |             texts.localized(`settings_filters_add_prompt`), | ||||||
| 			.addEventListener(`click`, async () => { |           ); | ||||||
| 				let storage = ( |           if (filter_source ? filter_source.trim() : false) { | ||||||
| 					await import(chrome.runtime.getURL(`scripts/secretariat.js`)) |             filters.update(filter_source.trim()); | ||||||
| 				)["secretariat"]; |           } | ||||||
| 				storage.forget(`sites`); |         })(); | ||||||
| 			}); |       }); | ||||||
| 	} |   } | ||||||
|  | 
 | ||||||
|  |   if (document.querySelector(`[data-action="storage,clear"]`)) { | ||||||
|  |     document | ||||||
|  |       .querySelector(`[data-action="storage,clear"]`) | ||||||
|  |       .addEventListener(`click`, async () => { | ||||||
|  |         let storage = ( | ||||||
|  |           await import(chrome.runtime.getURL(`scripts/secretariat.js`)) | ||||||
|  |         )["secretariat"]; | ||||||
|  |         storage.forget(`sites`); | ||||||
|  |       }); | ||||||
|  |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //main();
 | //main();
 | ||||||
| function load() { | function load() { | ||||||
| 	document.addEventListener("DOMContentLoaded", function () { |   document.addEventListener("DOMContentLoaded", function () { | ||||||
| 		M.AutoInit(); |     M.AutoInit(); | ||||||
| 		events(); |     events(); | ||||||
| 	}); |   }); | ||||||
| 
 | 
 | ||||||
| 	build(); |   build(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| load(); | load(); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue