Skip to content

rupnikj/focus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Focus Chrome Extension

A Chrome extension designed to help you stay focused by blocking distracting websites with confirmation prompts.

Features

  • Regex Pattern Blocking: Use regular expressions to block websites that match specific patterns
  • Confirmation Prompts: Require typing a specific sentence to access blocked sites
  • Customizable Confirmation Text: Set your own confirmation message
  • Pattern Management: Easy interface to add, edit, and toggle patterns
  • Pattern Testing: Test your regex patterns before applying them
  • Modern UI: Clean, responsive design that works well in all browsers

Installation

For Brave Browser (or any Chromium-based browser)

  1. Download the extension: Clone or download this repository to your computer
  2. Open Extension Management:
    • In Brave: Go to brave://extensions/
    • In Chrome: Go to chrome://extensions/
  3. Enable Developer Mode: Toggle the "Developer mode" switch in the top right
  4. Load the Extension: Click "Load unpacked" and select the extension folder
  5. Pin the Extension: Click the puzzle piece icon in the toolbar and pin the Focus extension

Usage

Setting Up Patterns

  1. Open Settings: Click the Focus extension icon and select "Settings"
  2. Add a Pattern:
    • Enter a descriptive name (e.g., "Social Media")
    • Enter a regex pattern (e.g., .*(facebook|twitter|instagram)\.com.*)
    • Click "Add Pattern"
  3. Test Patterns: Use the "Test Pattern" button to verify your regex works correctly
  4. Manage Patterns: Toggle patterns on/off or delete them as needed

Example Patterns

Here are some useful regex patterns to get you started:

  • Social Media: .*(facebook|twitter|instagram|tiktok)\.com.*
  • News Sites: .*(cnn|bbc|reddit|news)\.com.*
  • Video Platforms: .*(youtube|twitch|netflix)\.com.*
  • General Distractions: .*(youtube|facebook|twitter|reddit|instagram)\.com.*

Customizing Confirmation Text

  1. Go to Settings
  2. Change the "Confirmation Text" field
  3. The text will auto-save as you type
  4. This text must be typed exactly to access blocked sites

Using the Extension

  1. Normal Browsing: Browse normally - the extension runs in the background
  2. Blocked Site Access: When you try to visit a blocked site:
    • You'll see a Focus Mode page
    • Read the confirmation text carefully
    • Type it exactly as shown
    • Click "Proceed to Site" or press Enter
  3. Quick Access: Use the "Go Back" button or press Escape to return

How It Works

The extension uses Chrome's webNavigation API to intercept navigation attempts. When you try to visit a URL that matches one of your regex patterns, the extension:

  1. Blocks the navigation
  2. Redirects to a custom blocking page
  3. Shows the confirmation prompt
  4. Requires exact text input to proceed
  5. Allows access only after correct confirmation

Privacy

  • No Data Collection: The extension doesn't collect or transmit any personal data
  • Local Storage: All patterns and settings are stored locally in your browser
  • No External Connections: The extension doesn't make any network requests

Permissions

The extension requires these permissions:

  • webNavigation: To intercept navigation attempts
  • storage: To save your patterns and settings
  • activeTab: To manage blocked tabs
  • <all_urls>: To check URLs against patterns

Contributing

Feel free to submit issues and enhancement requests!

License

This project is open source and available under the MIT License.


Stay focused, stay productive! 🎯

About

chrome extension for digital health (block sites you don't want to visit)

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages