move files
This commit is contained in:
		
							parent
							
								
									ec43576519
								
							
						
					
					
						commit
						6451dfd065
					
				
					 11 changed files with 6 additions and 6 deletions
				
			
		
							
								
								
									
										13
									
								
								scripts/pages/open/popup.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								scripts/pages/open/popup.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| import windowman from "/scripts/GUI/windowman.JS"; | ||||
| 
 | ||||
| function redirect() { | ||||
|   windowman.new(`/pages/settings.htm`); | ||||
| 
 | ||||
|   window.close(); | ||||
| } | ||||
| 
 | ||||
| function main() { | ||||
|   redirect(); | ||||
| } | ||||
| 
 | ||||
| main(); | ||||
							
								
								
									
										15
									
								
								scripts/pages/open/settings.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								scripts/pages/open/settings.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| // Open the settings in a pop-up window.
 | ||||
| 
 | ||||
| import windowman from "/scripts/GUI/windowman.JS"; | ||||
| 
 | ||||
| function redirect() { | ||||
|   windowman.new(`/pages/settings.htm`); | ||||
| 
 | ||||
|   window.close(); | ||||
| } | ||||
| 
 | ||||
| function main() { | ||||
|   redirect(); | ||||
| } | ||||
| 
 | ||||
| main(); | ||||
							
								
								
									
										22
									
								
								scripts/pages/popup.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								scripts/pages/popup.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| /* Popup.js | ||||
|   Build the interface for popup | ||||
| */ | ||||
| 
 | ||||
| // Import modules.
 | ||||
| import windowman from "/scripts/GUI/windowman.js"; | ||||
| let secretariat = await import(chrome.runtime.getURL("scripts/secretariat.js")); | ||||
| 
 | ||||
| function start() { | ||||
|   windowman.prepare(); | ||||
| } | ||||
| /* Populate the strings on the page. */ | ||||
| function say(element) { | ||||
|   // document.title
 | ||||
| } | ||||
| 
 | ||||
| function main() { | ||||
|   let tab = start(); | ||||
|   say(tab); | ||||
| } | ||||
| 
 | ||||
| main(); | ||||
							
								
								
									
										114
									
								
								scripts/pages/settings.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								scripts/pages/settings.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,114 @@ | |||
| /* Settings.js | ||||
| 	Build the interface for the settings | ||||
| */ | ||||
| 
 | ||||
| // Import modules.
 | ||||
| //import { windowman } from "../windowman.js";
 | ||||
| 
 | ||||
| async function build() { | ||||
| 	let secretariat = await import(chrome.runtime.getURL("scripts/secretariat.js")); | ||||
| 	let windowman = (await import(chrome.runtime.getURL("/scripts/GUI/windowman.js"))).default; | ||||
| 
 | ||||
| 	let window = new windowman(); | ||||
| 	window.sync(); | ||||
| 	 | ||||
| 	// Add the window events. 
 | ||||
| 	events(window); | ||||
| }; | ||||
| 
 | ||||
| /* | ||||
| Define the mapping of each button. | ||||
| 
 | ||||
| @param {object} window the window | ||||
| */ | ||||
| function events(window) { | ||||
| 	if (document.querySelector(`[data-action="filters,update"]`)) { | ||||
| 		document | ||||
| 			.querySelector(`[data-action="filters,update"]`) | ||||
| 			.addEventListener(`click`, async () => { | ||||
| 				let filters = new ( | ||||
| 					await import(chrome.runtime.getURL(`scripts/filters.js`)) | ||||
| 				).default(); | ||||
| 				filters.update(); | ||||
| 			}); | ||||
| 	} | ||||
| 
 | ||||
| 	if (document.querySelector(`[data-action="filters,add,one"]`)) { | ||||
| 		document | ||||
| 			.querySelector(`[data-action="filters,add,one"]`) | ||||
| 			.addEventListener(`click`, async () => { | ||||
| 				// Import the filters module.
 | ||||
| 				const texts = ( | ||||
| 					await import(chrome.runtime.getURL(`gui/scripts/read.js`)) | ||||
| 				).default; | ||||
| 				let filters = new ( | ||||
| 					await import(chrome.runtime.getURL(`scripts/filters.js`)) | ||||
| 				).default(); | ||||
| 				 | ||||
| 				let filter_source = prompt( | ||||
| 					texts.localized(`settings_filters_add_prompt`), | ||||
| 				); | ||||
| 				if (filter_source ? filter_source.trim() : false) { | ||||
| 					filters.update(filter_source.trim()); | ||||
| 				}; | ||||
| 			}); | ||||
| 	} | ||||
| 	if (document.querySelector(`[data-action="filters,update,one"]`)) { | ||||
| 		document | ||||
| 			.querySelector(`[data-action="filters,update,one"]`) | ||||
| 			.addEventListener(`click`, async () => { | ||||
| 				// Import the filters module.
 | ||||
| 				const 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.
 | ||||
| 				let filter_source = (document.querySelector(`[data-result-linked="filters"] [data-result-content="*"]`)) ? document.querySelector(`[data-result-linked="filters"] [data-result-content="*"]`).innerText : prompt(texts.localized(`settings_filters_add_prompt`)); | ||||
| 				if (filter_source ? filter_source.trim() : false) { | ||||
| 					filters.update(filter_source.trim()); | ||||
| 				}; | ||||
| 			}); | ||||
| 	} | ||||
| 	 | ||||
| 	if (document.querySelector(`[data-action="filters,delete,one"]`)) { | ||||
| 		document | ||||
| 			.querySelector(`[data-action="filters,delete,one"]`) | ||||
| 			.addEventListener(`click`, 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.
 | ||||
| 				let filter_source = (document.querySelector(`[data-result-linked="filters"] [data-result-content="*"]`)) ? document.querySelector(`[data-result-linked="filters"] [data-result-content="*"]`).innerText : prompt(texts.localized(`settings_filters_remove_prompt`)); | ||||
| 				if (filter_source ? filter_source.trim() : false) { | ||||
| 					filters.remove(filter_source.trim()); | ||||
| 				} | ||||
| 			}); | ||||
| 	} | ||||
| 
 | ||||
| 	if (document.querySelector(`[data-action="storage,clear"]`)) { | ||||
| 		document | ||||
| 			.querySelector(`[data-action="storage,clear"]`) | ||||
| 			.addEventListener(`click`, async () => { | ||||
| 				secretariat.forget(`sites`); | ||||
| 			}); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| //main();
 | ||||
| function load() { | ||||
| 	build(); | ||||
| 	 | ||||
| 	document.addEventListener("DOMContentLoaded", function () { | ||||
| 		M.AutoInit(); | ||||
| 	}); | ||||
| } | ||||
| 
 | ||||
| load(); | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue