AdvancedProfanityFilter

A browser extension to filter profanity from webpages

View the Project on GitHub FrostCo/AdvancedProfanityFilter

Development

Quick Start

After downloading/cloning the repository, run the following commands to get started:

# Install dependencies
npm install

# Build the extension for the default target browser for local development
# See table below for supported targets
npm run build

Once the extension has been built, you can load the unpacked extension (found in dist/) in your browser.

Commonly Used Scripts

Target Manifest Stage Script Description
chrome 3 build npm run build:chrome:mv3 Dev build for Chrome Manifest V3
chrome 2 build npm run build:chrome:mv2 Dev build for Chrome Manifest V2
firefox 2 build npm run build:firefox:mv2 Dev build for Firefox Manifest V2
    release npm run release:all Official relase for all targets

Build Targets

Target Manifest Browsers
chrome 2, 3* Chrome, Edge, etc.
edgeLegacy 2 Legacy Edge
firefox 2*, 3 Firefox

* = default target

Build Stages

Stage Output Description
build dist/ Build/compile the extension for local development
release release/target-manifest-version.zip Create an official release for a target browser

State Files

The state files hold the details about the current build. These files are managed by bin/prebuild.js.

Details Contained In State Files

Scripts

For all scripts, please see package.json.

Build Chains

Build (Load Last Target From File)

Build Chrome Manifest V2

Release Chrome Manifest V3

Test Addon (Firefox Manifest V2)

Localization

Adding support for a new language can be done by creating a new locale folder (locales/{lang}) with a file for each namespace. To update an existing translation, modify the existing file in the same location.

Translations will automatically be compiled at build time (part of the prebuild script), but can be run manually as well with npm run build:translations. The compiled translations are stored in src/script/translations.js.

To use the translations, use the Translation class (src/script/translation.ts). When creating a new instance, pass in the desired namespace(s) (you should almost always include the 'common' namespace). Once you have the translation instance you can simply call translation.t() with the desired key, such as common:app.name.

Namespaces