update commenting style
This commit is contained in:
parent
5066be6e87
commit
4b2e8db824
4 changed files with 59 additions and 71 deletions
|
@ -44,14 +44,13 @@ export default class texts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function read(source, message_name, params) {
|
/* This reads the message from its source. This is a fallback for the content scripts, who doesn't appear to read classes.
|
||||||
/* This reads the message from its source. This is a fallback for the content scripts, who doesn't appear to read classes.
|
|
||||||
|
|
||||||
Parameters:
|
@param {string} source the source name, with accepted parameters "localized" and "fallback"
|
||||||
source: the source name, with accepted parameters "localized" and "fallback"
|
@param {string} message the message name
|
||||||
message: the message name
|
@return {string} the message
|
||||||
Returns: (string) the message
|
*/
|
||||||
*/
|
export function read(source, message_name, params) {
|
||||||
|
|
||||||
let message;
|
let message;
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,8 @@ let config = chrome.runtime.getURL('config/config.json');
|
||||||
|
|
||||||
export default class fc {
|
export default class fc {
|
||||||
|
|
||||||
|
/* Start the out of the box experience. */
|
||||||
static hello() {
|
static hello() {
|
||||||
/* Start the out of the box experience.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// the OOBE must be in the config.
|
// the OOBE must be in the config.
|
||||||
fetch(config)
|
fetch(config)
|
||||||
|
@ -29,11 +28,8 @@ export default class fc {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Initialize the configuration. */
|
||||||
static setup() {
|
static setup() {
|
||||||
/* Initialize the configuration.
|
|
||||||
|
|
||||||
Returns: the initialization result
|
|
||||||
*/
|
|
||||||
|
|
||||||
// the OOBE must be in the config.
|
// the OOBE must be in the config.
|
||||||
fetch(config)
|
fetch(config)
|
||||||
|
@ -58,8 +54,8 @@ export default class fc {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static run() {
|
|
||||||
/* main function */
|
/* main function */
|
||||||
|
static run() {
|
||||||
|
|
||||||
fc.trigger();
|
fc.trigger();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,13 @@
|
||||||
Manage the local cache.
|
Manage the local cache.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function read(prefname, cloud = 0) {
|
/* Read all storeed data in the browser cache.
|
||||||
/* Read all storeed data in the browser cache.
|
|
||||||
|
|
||||||
Parameters:
|
@param {string} prefname the preference name
|
||||||
prefname: (string) the preference name
|
@param {int} cloud determine cloud reading, which is otherwise set to automatic (0)
|
||||||
cloud: (bool) determine cloud reading, which is otherwise set to automatic (0)
|
@return {dictionary} the preferences
|
||||||
Returns: (Object) the preferences
|
*/
|
||||||
*/
|
export function read(prefname, cloud = 0) {
|
||||||
|
|
||||||
// Initialize the selected pref data.
|
// Initialize the selected pref data.
|
||||||
let pref_data;
|
let pref_data;
|
||||||
|
@ -38,14 +37,13 @@ export function read(prefname, cloud = 0) {
|
||||||
return(pref_data);
|
return(pref_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function specifics(WHERE, domain) {
|
/* List the matching rule or memory for a particular domain.
|
||||||
/* List the matching rule or memory for a particular domain.
|
|
||||||
|
|
||||||
Parameters:
|
@param {string} WHERE the data source
|
||||||
WHERE: the data source
|
@param {string} the data to check
|
||||||
domain: the website to check, which --- by default --- is the current website
|
@return {dictionary} the rules
|
||||||
Returns: (dictionary) the rules
|
*/
|
||||||
*/
|
export function specifics(WHERE, domain) {
|
||||||
|
|
||||||
let result;
|
let result;
|
||||||
|
|
||||||
|
@ -106,15 +104,14 @@ export function specifics(WHERE, domain) {
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function write(PREFERENCE, SUBPREFERENCE, DATA, CLOUD = 0) {
|
/* Write the data on the selected prefname.
|
||||||
/* Write the data on the selected prefname.
|
|
||||||
|
|
||||||
Parameters:
|
@param {string} PREFERENCE the preference name
|
||||||
PREFERENCE: the preference name
|
@param {string} SUBPREFERENCE the subpreference
|
||||||
DATA: the new data to be written
|
@param {object} DATA the new data to be written
|
||||||
SUBPREFERENCE: the intermediate data
|
@param {int} CLOUD store in the cloud; otherwise set to automatic
|
||||||
CLOUD: store in the cloud; otherwise set to automatic
|
*/
|
||||||
*/
|
export function write(PREFERENCE, SUBPREFERENCE, DATA, CLOUD = 0) {
|
||||||
|
|
||||||
let DATA_INJECTED = DATA;
|
let DATA_INJECTED = DATA;
|
||||||
|
|
||||||
|
@ -141,15 +138,14 @@ export function write(PREFERENCE, SUBPREFERENCE, DATA, CLOUD = 0) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function forget(preference, subpreference, CLOUD = 0) {
|
/* Dangerous: Resets all data or a domain's data.
|
||||||
/* Dangerous: Resets all data or a domain's data.
|
|
||||||
|
|
||||||
Parameters:
|
@param {string} preference the preference name to delete
|
||||||
prefernece: the preference name to delete
|
@param {string} subpreference the subpreference name to delete
|
||||||
subpreference: the subpreference name to delete
|
@param {int} CLOUD the storage of the data
|
||||||
CLOUD: the storage of the data
|
@return {boolean} the user's confirmation
|
||||||
Returns: the user's confirmation
|
*/
|
||||||
*/
|
export function forget(preference, subpreference, CLOUD = 0) {
|
||||||
|
|
||||||
let forget_action = false;
|
let forget_action = false;
|
||||||
|
|
||||||
|
@ -199,12 +195,11 @@ export function forget(preference, subpreference, CLOUD = 0) {
|
||||||
return (forget_action);
|
return (forget_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function init(data) {
|
/* Initialize the storage.
|
||||||
/* Initialize the storage.
|
|
||||||
|
|
||||||
Parameters:
|
@param {dictionary} data this build's managed data
|
||||||
data: (dictionary) this build's managed data
|
*/
|
||||||
*/
|
export function init(data) {
|
||||||
|
|
||||||
let PREFERENCES_ALL = {};
|
let PREFERENCES_ALL = {};
|
||||||
PREFERENCES_ALL[`build`] = data;
|
PREFERENCES_ALL[`build`] = data;
|
||||||
|
|
|
@ -8,13 +8,12 @@ Be sensitive to changes and update the state.
|
||||||
let reader = await import(chrome.runtime.getURL("scripts/reader.js"));
|
let reader = await import(chrome.runtime.getURL("scripts/reader.js"));
|
||||||
|
|
||||||
class watchman {
|
class watchman {
|
||||||
static observe(URL = window.location.href) {
|
|
||||||
/* Check the current URL.
|
/* Check the current URL.
|
||||||
|
|
||||||
Parameters:
|
@param {string} URL the page URL; default value is the current webpage
|
||||||
URL: the page URL; default value is the current webpage
|
@return {dictionary} the filter to follow
|
||||||
Returns: (dictionary) the filter to follow
|
|
||||||
*/
|
*/
|
||||||
|
static observe(URL = window.location.href) {
|
||||||
|
|
||||||
// Create the variable to determine the corresponding key.
|
// Create the variable to determine the corresponding key.
|
||||||
let activity = false;
|
let activity = false;
|
||||||
|
@ -26,21 +25,20 @@ Be sensitive to changes and update the state.
|
||||||
return (activity);
|
return (activity);
|
||||||
};
|
};
|
||||||
|
|
||||||
static act(filters) {
|
|
||||||
/* Act on the page.
|
/* Act on the page.
|
||||||
|
|
||||||
Parameters:
|
@param {dictionary} filters the filter to work with
|
||||||
filters: the filter to work with
|
@return {boolean} the state
|
||||||
Returns: the state
|
|
||||||
*/
|
*/
|
||||||
|
static act(filters) {
|
||||||
|
|
||||||
console.log("ShopAI works here! Click on the button in the toolbar or website to start.");
|
console.log("ShopAI works here! Click on the button in the toolbar or website to start.");
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
static standby() {
|
|
||||||
/* Set the program to standby utnil next load.
|
/* Set the program to standby utnil next load.
|
||||||
*/
|
*/
|
||||||
|
static standby() {
|
||||||
|
|
||||||
console.log("ShopAI doesn't work here (yet). Expecting something? Try checking your filters. If you know what you're doing, feel free to create a filter yourself.");
|
console.log("ShopAI doesn't work here (yet). Expecting something? Try checking your filters. If you know what you're doing, feel free to create a filter yourself.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue