update commenting style

This commit is contained in:
buzzcode2007 2024-03-23 20:35:41 +08:00
parent 5066be6e87
commit 4b2e8db824
4 changed files with 59 additions and 71 deletions

View file

@ -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:
source: the source name, with accepted parameters "localized" and "fallback"
message: the message name
Returns: (string) the message
*/
@param {string} source the source name, with accepted parameters "localized" and "fallback"
@param {string} message the message name
@return {string} the message
*/
export function read(source, message_name, params) {
let message;

View file

@ -8,9 +8,8 @@ let config = chrome.runtime.getURL('config/config.json');
export default class fc {
/* Start the out of the box experience. */
static hello() {
/* Start the out of the box experience.
*/
// the OOBE must be in the config.
fetch(config)
@ -29,11 +28,8 @@ export default class fc {
});
};
/* Initialize the configuration. */
static setup() {
/* Initialize the configuration.
Returns: the initialization result
*/
// the OOBE must be in the config.
fetch(config)
@ -58,8 +54,8 @@ export default class fc {
});
}
/* main function */
static run() {
/* main function */
fc.trigger();
}

View file

@ -2,14 +2,13 @@
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:
prefname: (string) the preference name
cloud: (bool) determine cloud reading, which is otherwise set to automatic (0)
Returns: (Object) the preferences
*/
@param {string} prefname the preference name
@param {int} cloud determine cloud reading, which is otherwise set to automatic (0)
@return {dictionary} the preferences
*/
export function read(prefname, cloud = 0) {
// Initialize the selected pref data.
let pref_data;
@ -38,14 +37,13 @@ export function read(prefname, cloud = 0) {
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:
WHERE: the data source
domain: the website to check, which --- by default --- is the current website
Returns: (dictionary) the rules
*/
@param {string} WHERE the data source
@param {string} the data to check
@return {dictionary} the rules
*/
export function specifics(WHERE, domain) {
let result;
@ -106,15 +104,14 @@ export function specifics(WHERE, domain) {
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:
PREFERENCE: the preference name
DATA: the new data to be written
SUBPREFERENCE: the intermediate data
CLOUD: store in the cloud; otherwise set to automatic
*/
@param {string} PREFERENCE the preference name
@param {string} SUBPREFERENCE the subpreference
@param {object} DATA the new data to be written
@param {int} CLOUD store in the cloud; otherwise set to automatic
*/
export function write(PREFERENCE, SUBPREFERENCE, DATA, CLOUD = 0) {
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:
prefernece: the preference name to delete
subpreference: the subpreference name to delete
CLOUD: the storage of the data
Returns: the user's confirmation
*/
@param {string} preference the preference name to delete
@param {string} subpreference the subpreference name to delete
@param {int} CLOUD the storage of the data
@return {boolean} the user's confirmation
*/
export function forget(preference, subpreference, CLOUD = 0) {
let forget_action = false;
@ -199,12 +195,11 @@ export function forget(preference, subpreference, CLOUD = 0) {
return (forget_action);
}
export function init(data) {
/* Initialize the storage.
/* Initialize the storage.
Parameters:
data: (dictionary) this build's managed data
*/
@param {dictionary} data this build's managed data
*/
export function init(data) {
let PREFERENCES_ALL = {};
PREFERENCES_ALL[`build`] = data;

View file

@ -8,13 +8,12 @@ Be sensitive to changes and update the state.
let reader = await import(chrome.runtime.getURL("scripts/reader.js"));
class watchman {
static observe(URL = window.location.href) {
/* Check the current URL.
/* Check the current URL.
Parameters:
URL: the page URL; default value is the current webpage
Returns: (dictionary) the filter to follow
*/
@param {string} URL the page URL; default value is the current webpage
@return {dictionary} the filter to follow
*/
static observe(URL = window.location.href) {
// Create the variable to determine the corresponding key.
let activity = false;
@ -26,21 +25,20 @@ Be sensitive to changes and update the state.
return (activity);
};
static act(filters) {
/* Act on the page.
/* Act on the page.
Parameters:
filters: the filter to work with
Returns: the state
*/
@param {dictionary} filters the filter to work with
@return {boolean} the state
*/
static act(filters) {
console.log("ShopAI works here! Click on the button in the toolbar or website to start.");
// TODO
}
/* Set the program to standby utnil next load.
*/
static standby() {
/* Set the program to standby utnil next load.
*/
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.");
}