extend the default page
This commit is contained in:
		
							parent
							
								
									b1cceec7fc
								
							
						
					
					
						commit
						d71e9effd0
					
				
					 3 changed files with 123 additions and 114 deletions
				
			
		
							
								
								
									
										18
									
								
								scripts/pages/page.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								scripts/pages/page.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| /* page.js  | ||||
| Construct an internal page.  | ||||
| */ | ||||
| 
 | ||||
| import windowman from "/scripts/GUI/windowman.js"; | ||||
| 
 | ||||
| export default class Page { | ||||
|      constructor () { | ||||
|           this.window = window; | ||||
| 
 | ||||
|           this.window[`manager`] = new windowman(); | ||||
|           (this.window[`manager`]) ? this.window.manager.sync() : false; | ||||
| 
 | ||||
| 		document.addEventListener("DOMContentLoaded", function () { | ||||
| 			M.AutoInit(); | ||||
| 		}); | ||||
|      } | ||||
| }; | ||||
|  | @ -3,20 +3,19 @@ | |||
| */ | ||||
| 
 | ||||
| // Import modules.
 | ||||
| import {read, forget} from "/scripts/secretariat.js"; | ||||
| import windowman from "/scripts/GUI/windowman.js"; | ||||
| let secretariat = await import(chrome.runtime.getURL("scripts/secretariat.js")); | ||||
| import Page from "/scripts/pages/page.js"; | ||||
| 
 | ||||
| function start() { | ||||
|   windowman.prepare(); | ||||
| } | ||||
| /* Populate the strings on the page. */ | ||||
| function say(element) { | ||||
|   // document.title
 | ||||
| class Page_Popup extends Page { | ||||
| 	constructor() { | ||||
| 		super(); | ||||
| 		(this.events) ? this.events() : false; | ||||
| 	} | ||||
| 
 | ||||
| 	events() { | ||||
| 
 | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| function main() { | ||||
|   let tab = start(); | ||||
|   say(tab); | ||||
| } | ||||
| 
 | ||||
| main(); | ||||
| new Page_Popup(); | ||||
|  | @ -5,23 +5,21 @@ | |||
| // Import modules.
 | ||||
| //import { windowman } from "../windowman.js";
 | ||||
| 
 | ||||
| import {forget} from "/scripts/secretariat.js"; | ||||
| import windowman from "/scripts/GUI/windowman.js"; | ||||
| import {read, forget} from "/scripts/secretariat.js"; | ||||
| import Page from "/scripts/pages/page.js"; | ||||
| 
 | ||||
| async function build() { | ||||
| 	let window = new windowman(); | ||||
| 	window.sync(); | ||||
| class Page_Settings extends Page { | ||||
| 	constructor() { | ||||
| 		super(); | ||||
| 		(this.events) ? this.events() : false; | ||||
| 	} | ||||
| 
 | ||||
| 	// Add the window events. 
 | ||||
| 	events(window); | ||||
| }; | ||||
| 	/* | ||||
| 	Define the mapping of each button. | ||||
| 
 | ||||
| /* | ||||
| Define the mapping of each button. | ||||
| 
 | ||||
| @param {object} window the window | ||||
| */ | ||||
| function events(window) { | ||||
| 	@param {object} window the window | ||||
| 	*/ | ||||
| 	events() { | ||||
| 		if (document.querySelector(`[data-action="filters,update"]`)) { | ||||
| 			document | ||||
| 				.querySelector(`[data-action="filters,update"]`) | ||||
|  | @ -97,17 +95,11 @@ function events(window) { | |||
| 			document | ||||
| 				.querySelector(`[data-action="storage,clear"]`) | ||||
| 				.addEventListener(`click`, async () => { | ||||
| 				forget(`sites`); | ||||
| 					await forget(`sites`); | ||||
| 					console.log(await read(null, 1), await read(null, -1)); | ||||
| 				}); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| function load() { | ||||
| 	build(); | ||||
| 	 | ||||
| 	document.addEventListener("DOMContentLoaded", function () { | ||||
| 		M.AutoInit(); | ||||
| 	}); | ||||
| } | ||||
| 
 | ||||
| load(); | ||||
| new Page_Settings(); | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue