Defense Against Distractions is a browser extension that helps you avoid procrastination by blocking pages when distracting words or phrases appear in their text.
Instead of only blocking entire domains, you can define plan entries with websites and keywords. When a matching page reaches the configured distraction score, the extension redirects it to a block page.
- Block pages based on keywords, phrases, and weighted keyword scores.
- Organize websites and keywords inside enableable plans.
- Give plans their own allowed websites, schedules, and optional UI cleanup assignments.
- Use locked schedules to make focus rules harder to relax during chosen time windows.
- Allow websites inside a plan so that plan does not scan them.
- Protect the options page with a password.
- Hide distracting UI elements with a popup-based element picker. See UI Element Blocking.
- Export and import extension settings.
- Reset extension data from Settings before uninstalling or starting over.
- Localized UI through Chrome extension locales.
Create a plan, add one or more entries with websites and keywords, then decide when that plan should be active. Different protection contexts can be enabled, disabled, scheduled, and adjusted independently.
Keywords can be entered in three formats:
video gamesblocks as soon as the phrase is detected.news, 50adds 50 points each time the keyword is found.news, *, 10multiplies the current page score when the keyword is found.
Pages are blocked when their score reaches 1000.
Locked schedules let you define times when the extension should resist being weakened. During an active locked schedule, the extension prevents changes such as deleting active schedules, weakening plan entries, relaxing schedule constraints, adding allowed websites, or changing password protection.
Each scheduled day must keep at least one hour unlocked.
- Clone this repository.
- Open your Chromium-based browser's extensions page.
- Enable developer mode.
- Choose "Load unpacked".
- Select this repository folder.
The extension uses Manifest V3 and does not require a build step.
Run npm run package to generate release archives in dist/:
Defense_against_Distractions-vX.Y.Z-extension.zipcontains only the runtime extension files for loading or store upload.Defense_against_Distractions-vX.Y.Z-source.zipcontains the source tree, tests, docs, scripts, screenshots, and promotional assets.
Run npm run verify:playbook to check README, privacy, license, package metadata, and store-listing alignment against the shared browser-extension playbook. Run npm run verify:browser-load after packaging to smoke-test loading the generated unpacked extension in Chrome, Edge, or Chromium. Run npm run verify:package after packaging to check the generated runtime output for manifest/import consistency, source-map policy, and remote executable code. Run npm run verify:release to check the generated archives and the package gate together. See Release Readiness for the full automated and manual release gates.
The dist/ directory is generated output and is not the source of truth. If a file in dist/source/ looks stale, rerun npm run package instead of editing the generated copy directly.
Chrome Web Store API release helpers are documented in Chrome Web Store API. They use environment variables for OAuth credentials and never store CWS secrets in the repository.
_locales/contains translated extension messages.src/options.htmlcontains the options page.src/instructions.htmlcontains the in-extension guide.src/blocked.htmlcontains the block page.src/app/contains runtime entry points such as the MV3 background service worker.src/features/contains feature-owned source modules that can be imported by runtime entries.src/platform/contains browser API wrappers and platform adapters.src/app/background/index.jscontains the service worker entry point.src/app/popup/index.jscontains the popup entry point.src/app/options/index.jscontains the options page entry point.src/app/instructions/index.jscontains the instructions page entry point.src/app/blocked/index.jscontains the blocked page entry point.src/app/content/index.jscontains the classic content-script entry point.src/js/shared/contains shared parsing, URL, UI helpers, and compatibility barrels; feature-owned models live undersrc/features/, and Chrome API wrappers live undersrc/platform/.src/css/contains extension styles.
Runtime extension files are the files that must ship inside the extension ZIP. Source-only project files such as docs, tests, scripts, screenshots, promotional images, and store listing text are kept in the repository and source ZIP, but are intentionally excluded from the runtime extension package.
Release-facing assets use the shared browser-extension playbook shape:
assets/icons/contains packaged extension icons referenced by the manifest.store/promo/contains Chrome Web Store promotional images.store/screenshots/contains Chrome Web Store screenshots.store/store-listing/contains plain text Chrome Web Store listing copy.
Architecture and release notes live in docs/. The current future-facing product model is documented in Protection Model, the planned user-facing plan structure is documented in Plans Architecture, reviewer-facing browser limitations are documented in Reviewer Notes, and release gates are documented in Release Readiness.
Defense Against Distractions is local-first. It stores configuration and bounded diagnostics in Chrome extension storage, does not use analytics, ads, tracking pixels, telemetry, or remote executable code, and does not require a server for core blocking behavior. See PRIVACY.md.
Bug reports, ideas, and pull requests are welcome. If you find an issue, please open a GitHub issue with the browser version, extension version, steps to reproduce, and what you expected to happen.
For code changes, keep the extension behavior focused: improve clarity, reliability, and maintainability without expanding permissions unless there is a strong reason.
If this extension saves you time and you want to support its development:
Licensed under GPL-3.0-only. See LICENSE.
Source: https://github.com/molodchyk/Defense_against_Distractions