Saving, do not close the window…
Add the saving message.
This commit is contained in:
parent
230f330ebd
commit
b1cceec7fc
3 changed files with 36 additions and 1 deletions
|
@ -174,6 +174,16 @@
|
|||
"settings_filters_target": {
|
||||
"message": "Injection Target"
|
||||
},
|
||||
"saving_current": {
|
||||
"message": "Saving…"
|
||||
},
|
||||
"saving_current_message": {
|
||||
"message": "Leave your computer and this window open."
|
||||
},
|
||||
"saving_done": {
|
||||
"message": "Saved!"
|
||||
},
|
||||
|
||||
"JSON_parse_error": {
|
||||
"message": "There is a mistake in your JSON formatting. Please correct the error before saving."
|
||||
},
|
||||
|
|
|
@ -14,7 +14,12 @@ export default class logging {
|
|||
return user_response;
|
||||
}
|
||||
|
||||
constructor(TITLE, MESSAGE) {
|
||||
/* Create a new message.
|
||||
|
||||
@param {string} TITLE the title
|
||||
@param {string} MESSAGE the message
|
||||
@param {bool} PRIORITY automatically dismiss other, older messages */
|
||||
constructor(TITLE, MESSAGE, PRIORITY = true) {
|
||||
// Set this message's properties.
|
||||
if (MESSAGE == null) {
|
||||
this.message = TITLE;
|
||||
|
@ -23,6 +28,8 @@ export default class logging {
|
|||
this.message = MESSAGE;
|
||||
}
|
||||
|
||||
(PRIORITY) ? this.clear() : false;
|
||||
|
||||
// Display the message.
|
||||
console.log((MESSAGE ? (this.title).concat(`\n`) : ``).concat(this.message));
|
||||
try {
|
||||
|
@ -76,4 +83,15 @@ export default class logging {
|
|||
} catch (err) {};
|
||||
};
|
||||
}
|
||||
|
||||
/* Clear the current message. */
|
||||
clear() {
|
||||
try {
|
||||
var toastElement = document.querySelectorAll('.toast');
|
||||
(toastElement) ? (
|
||||
toastElement.forEach((element) => {
|
||||
element.style.display = "none";
|
||||
})) : false;
|
||||
} catch(err) {};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ Manage the local cache.
|
|||
*/
|
||||
|
||||
import logging from "/scripts/logging.js";
|
||||
import texts from "/scripts/strings/read.js";
|
||||
|
||||
/* Read all stored data in the browser cache.
|
||||
|
||||
|
@ -207,6 +208,9 @@ export async function search(SOURCE, TERM, ADDITIONAL_PLACES, STRICT = 0, OPTION
|
|||
export async function write(PATH, DATA, CLOUD = -1) {
|
||||
let DATA_INJECTED = {};
|
||||
|
||||
// Inform the user that saving is in progress.
|
||||
let notification = new logging ((new texts(`saving_current`)).localized, (new texts(`saving_current_message`)).localized, false);
|
||||
|
||||
/* Forcibly write the data to chrome database
|
||||
|
||||
@param {object} DATA the data
|
||||
|
@ -271,6 +275,9 @@ export async function write(PATH, DATA, CLOUD = -1) {
|
|||
|
||||
// Write!
|
||||
write_database(DATA_INJECTED, CLOUD);
|
||||
|
||||
// Inform the user that the saving operation is completed.
|
||||
notification = new logging ((new texts(`saving_done`)).localized);
|
||||
}
|
||||
|
||||
/* Dangerous: Resets all data or a domain's data.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue