changed alerts to the logging
This commit is contained in:
		
							parent
							
								
									35e208b61d
								
							
						
					
					
						commit
						527d7b6835
					
				
					 7 changed files with 24 additions and 24 deletions
				
			
		|  | @ -43,10 +43,10 @@ export default class windowman { | ||||||
| 						throw new ReferenceError(new texts(`error_msg_fileNotFound`, [UI.CSS[index]])); | 						throw new ReferenceError(new texts(`error_msg_fileNotFound`, [UI.CSS[index]])); | ||||||
| 					} | 					} | ||||||
| 				} catch(err) { | 				} catch(err) { | ||||||
| 					const alerts = (await import(chrome.runtime.getURL(`/gui/scripts/alerts.js`))).default; | 					const logging = (await import(chrome.runtime.getURL(`/scripts/logging.js`))).default; | ||||||
| 					 | 					 | ||||||
| 					// Raise an alert. 
 | 					// Raise an alert. 
 | ||||||
| 					alerts.error(err.name, err.message, err.stack, true, [source]); | 					logging.error(err.name, err.message, err.stack, true, [source]); | ||||||
| 
 | 
 | ||||||
| 					// Stop loading the page when an error has occured; it's not going to work!
 | 					// Stop loading the page when an error has occured; it's not going to work!
 | ||||||
| 					if (!DEBUG) { | 					if (!DEBUG) { | ||||||
|  | @ -260,7 +260,7 @@ export default class windowman { | ||||||
| 	async sync() { | 	async sync() { | ||||||
| 		// Import the module.
 | 		// Import the module.
 | ||||||
| 		const secretariat = await import(chrome.runtime.getURL("scripts/secretariat.js")); | 		const secretariat = await import(chrome.runtime.getURL("scripts/secretariat.js")); | ||||||
| 		const alerts = (await import(chrome.runtime.getURL(`/gui/scripts/alerts.js`))).default; | 		const logging = (await import(chrome.runtime.getURL(`/scripts/logging.js`))).default; | ||||||
| 		 | 		 | ||||||
| 		async function fill() { | 		async function fill() { | ||||||
| 			let input_elements = document.querySelectorAll("[data-store]"); | 			let input_elements = document.querySelectorAll("[data-store]"); | ||||||
|  | @ -390,7 +390,7 @@ export default class windowman { | ||||||
| 		 | 		 | ||||||
| 		/* Enable the searching interface. */ | 		/* Enable the searching interface. */ | ||||||
| 		async function search() { | 		async function search() { | ||||||
| 			const search_GUI_manager = (await import(chrome.runtime.getURL(`scripts/gui/windowman.search.js`))); | 			const search_GUI_manager = (await import(chrome.runtime.getURL(`scripts/GUI/windowman.search.js`))); | ||||||
| 			return (search_GUI_manager.search()); | 			return (search_GUI_manager.search()); | ||||||
| 		}; | 		}; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| import {read, write, observe} from "/scripts/secretariat.js"; | import {read, write, observe} from "/scripts/secretariat.js"; | ||||||
| import alerts from "/gui/scripts/alerts.js" | import logging from "/scripts/logging.js" | ||||||
| import texts from "/scripts/strings/read.js"; | import texts from "/scripts/strings/read.js"; | ||||||
| 
 | 
 | ||||||
| export function search() { | export function search() { | ||||||
|  | @ -134,7 +134,7 @@ export function search() { | ||||||
|                                                                                 write(DATA[`target`], DATA[`value`], (ELEMENT.hasAttribute(`data-store-location`)) ? parseInt(ELEMENT.getAttribute(`data-store-location`)) : -1); |                                                                                 write(DATA[`target`], DATA[`value`], (ELEMENT.hasAttribute(`data-store-location`)) ? parseInt(ELEMENT.getAttribute(`data-store-location`)) : -1); | ||||||
|                                                                            } catch(err) { |                                                                            } catch(err) { | ||||||
|                                                                                 // The JSON isn't valid.
 |                                                                                 // The JSON isn't valid.
 | ||||||
|                                                                                 alerts.error(err.name, texts.localized(`JSON_parse_error`), err.stack, false); |                                                                                 logging.error(err.name, texts.localized(`JSON_parse_error`), err.stack, false); | ||||||
|                                                                            }; |                                                                            }; | ||||||
|                                                                       } |                                                                       } | ||||||
|                                                                  } else { |                                                                  } else { | ||||||
|  |  | ||||||
|  | @ -6,8 +6,8 @@ import {read, write, forget, search} from "./secretariat.js"; | ||||||
| import net from "./net.js"; | import net from "./net.js"; | ||||||
| import texts from "/scripts/strings/read.js"; | import texts from "/scripts/strings/read.js"; | ||||||
| import {Queue} from "./common.js"; | import {Queue} from "./common.js"; | ||||||
| import alerts from "/gui/scripts/alerts.js" | import logging from "/gui/scripts/logging.js" | ||||||
| // const alerts = (await import(chrome.runtime.getURL("gui/scripts/alerts.js"))).default;
 | // const logging = (await import(chrome.runtime.getURL("gui/scripts/logging.js"))).default;
 | ||||||
| 
 | 
 | ||||||
| export default class filters { | export default class filters { | ||||||
| 	constructor() { | 	constructor() { | ||||||
|  | @ -70,7 +70,7 @@ export default class filters { | ||||||
| 				let filter_URL = filters.dequeue(); | 				let filter_URL = filters.dequeue(); | ||||||
| 
 | 
 | ||||||
| 				// Inform the user of download state.
 | 				// Inform the user of download state.
 | ||||||
| 				new alerts (texts.localized(`settings_filters_update_status`, null, [filter_URL])); | 				new logging (texts.localized(`settings_filters_update_status`, null, [filter_URL])); | ||||||
| 
 | 
 | ||||||
| 				// Create promise of downloading.
 | 				// Create promise of downloading.
 | ||||||
| 				let filter_download = net.download(filter_URL, `JSON`, false, true); | 				let filter_download = net.download(filter_URL, `JSON`, false, true); | ||||||
|  | @ -80,7 +80,7 @@ export default class filters { | ||||||
| 						if (result) { | 						if (result) { | ||||||
| 							// Write the filter to storage.
 | 							// Write the filter to storage.
 | ||||||
| 							write(["filters", filter_URL], result, -1); | 							write(["filters", filter_URL], result, -1); | ||||||
| 							alerts.log(texts.localized(`settings_filters_update_status_complete`,null,[filter_URL])); | 							logging.log(texts.localized(`settings_filters_update_status_complete`,null,[filter_URL])); | ||||||
|                              |                              | ||||||
| 							// Add the filter to the sync list.
 | 							// Add the filter to the sync list.
 | ||||||
| 							if ((await read(["settings", `filters`])) ? !((Object.keys(await read(["settings", `filters`]))).includes(filter_URL)) : true) { | 							if ((await read(["settings", `filters`])) ? !((Object.keys(await read(["settings", `filters`]))).includes(filter_URL)) : true) { | ||||||
|  | @ -90,12 +90,12 @@ export default class filters { | ||||||
| 					}) | 					}) | ||||||
| 					.catch(async function(error) { | 					.catch(async function(error) { | ||||||
| 						// Inform the user of the download failure.
 | 						// Inform the user of the download failure.
 | ||||||
| 						alerts.error(error.name, texts.localized(`settings_filters_update_status_failure`, null, [error.name, filter_URL]), error.stack); | 						logging.error(error.name, texts.localized(`settings_filters_update_status_failure`, null, [error.name, filter_URL]), error.stack); | ||||||
| 					}); | 					}); | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 			// Inform the user of the download being unnecessary.
 | 			// Inform the user of the download being unnecessary.
 | ||||||
| 			alerts.warn(texts.localized(`settings_filters_update_stop`)); | 			logging.warn(texts.localized(`settings_filters_update_stop`)); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// Regardless of the download result, update will also mean setting the filters object to whatever is in storage.
 | 		// Regardless of the download result, update will also mean setting the filters object to whatever is in storage.
 | ||||||
|  | @ -113,7 +113,7 @@ export default class filters { | ||||||
| 			return((await forget([`filters`, URL], -1, false)) ? await forget([`settings`, `filters`, URL], 1, true) : false); | 			return((await forget([`filters`, URL], -1, false)) ? await forget([`settings`, `filters`, URL], 1, true) : false); | ||||||
| 		} else { | 		} else { | ||||||
| 			// Inform the user of the removal being unnecessary.
 | 			// Inform the user of the removal being unnecessary.
 | ||||||
| 			alerts.warn(texts.localized(`settings_filters_removal_stop`)); | 			logging.warn(texts.localized(`settings_filters_removal_stop`)); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
|  |  | ||||||
|  | @ -1,9 +1,10 @@ | ||||||
| /* alerts.js | /* logging.js | ||||||
| Alert management system. | Alert management system. | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
| import texts from "/scripts/strings/read.js"; | import texts from "/scripts/strings/read.js"; | ||||||
| export default class alerts { | 
 | ||||||
|  | export default class logging { | ||||||
| 	static async confirm(MESSAGE) { | 	static async confirm(MESSAGE) { | ||||||
| 		let user_response = confirm( | 		let user_response = confirm( | ||||||
| 			texts.localized((MESSAGE) ? MESSAGE : `GUI_alert_confirm_action_text`), | 			texts.localized((MESSAGE) ? MESSAGE : `GUI_alert_confirm_action_text`), | ||||||
|  | @ -15,7 +15,7 @@ export default class net { | ||||||
| 	static async download(URL, TYPE, VERIFY_ONLY = false, STRICT = false) { | 	static async download(URL, TYPE, VERIFY_ONLY = false, STRICT = false) { | ||||||
| 		const texts = (await import(chrome.runtime.getURL(`gui/scripts/read.js`))) | 		const texts = (await import(chrome.runtime.getURL(`gui/scripts/read.js`))) | ||||||
| 			.default; | 			.default; | ||||||
| 		const alerts = (await import(chrome.runtime.getURL(`gui/scripts/alerts.js`))).default; | 		const logging = (await import(chrome.runtime.getURL(`gui/scripts/logging.js`))).default; | ||||||
| 	 | 	 | ||||||
| 		let CONNECT, DATA;  | 		let CONNECT, DATA;  | ||||||
| 	 | 	 | ||||||
|  | @ -38,7 +38,7 @@ export default class net { | ||||||
| 							// Should not allow the data to be returned since it's not correct. 
 | 							// Should not allow the data to be returned since it's not correct. 
 | ||||||
| 							DATA = null; | 							DATA = null; | ||||||
| 							throw new TypeError(texts.localized(`error_msg_notJSON`, false)); | 							throw new TypeError(texts.localized(`error_msg_notJSON`, false)); | ||||||
| 						} else {alerts.warn(texts.localized(`error_msg_notJSON`, false));} | 						} else {logging.warn(texts.localized(`error_msg_notJSON`, false));} | ||||||
| 					}; | 					}; | ||||||
| 				}; | 				}; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | @ -5,10 +5,10 @@ | ||||||
| // Import modules.
 | // Import modules.
 | ||||||
| //import { windowman } from "../windowman.js";
 | //import { windowman } from "../windowman.js";
 | ||||||
| 
 | 
 | ||||||
| async function build() { | import {forget} from "/scripts/secretariat.js"; | ||||||
| 	let secretariat = await import(chrome.runtime.getURL("scripts/secretariat.js")); | import windowman from "/scripts/GUI/windowman.js"; | ||||||
| 	let windowman = (await import(chrome.runtime.getURL("/scripts/GUI/windowman.js"))).default; |  | ||||||
| 
 | 
 | ||||||
|  | async function build() { | ||||||
| 	let window = new windowman(); | 	let window = new windowman(); | ||||||
| 	window.sync(); | 	window.sync(); | ||||||
| 	 | 	 | ||||||
|  | @ -97,12 +97,11 @@ function events(window) { | ||||||
| 		document | 		document | ||||||
| 			.querySelector(`[data-action="storage,clear"]`) | 			.querySelector(`[data-action="storage,clear"]`) | ||||||
| 			.addEventListener(`click`, async () => { | 			.addEventListener(`click`, async () => { | ||||||
| 				secretariat.forget(`sites`); | 				forget(`sites`); | ||||||
| 			}); | 			}); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //main();
 |  | ||||||
| function load() { | function load() { | ||||||
| 	build(); | 	build(); | ||||||
| 	 | 	 | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| Manage the local cache. | Manage the local cache. | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
| import alerts from "/gui/scripts/alerts.js"; | import logging from "/scripts/logging.js"; | ||||||
| 
 | 
 | ||||||
| /* Read all stored data in the browser cache. | /* Read all stored data in the browser cache. | ||||||
| 
 | 
 | ||||||
|  | @ -268,7 +268,7 @@ export async function write(PATH, DATA, CLOUD = -1) { | ||||||
| */ | */ | ||||||
| export async function forget(preference, CLOUD = 0, override = false) { | export async function forget(preference, CLOUD = 0, override = false) { | ||||||
| 	// Confirm the action.
 | 	// Confirm the action.
 | ||||||
| 	let forget_action = override ? override : await alerts.confirm(); | 	let forget_action = override ? override : await logging.confirm(); | ||||||
| 
 | 
 | ||||||
| 	if (forget_action) { | 	if (forget_action) { | ||||||
| 		if (preference) { | 		if (preference) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue