├── src
├── popup.html
├── img
│ ├── 16x16.png
│ ├── 32x32.png
│ ├── github-mark-white.svg
│ └── kofi_symbol.svg
├── js
│ ├── background.js
│ ├── contentscript.js
│ └── popup.js
├── css
│ ├── block.css
│ └── style.css
└── html
│ ├── page.html
│ └── popup.html
├── tools
├── make-chrome.sh
└── make-firefox.sh
├── Makefile
├── platform
├── chrome
│ └── manifest.json
└── firefox
│ └── manifest.json
├── LICENSE
└── README.md
/src/popup.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/img/16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bsodoge/Focus-Mode/HEAD/src/img/16x16.png
--------------------------------------------------------------------------------
/src/img/32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bsodoge/Focus-Mode/HEAD/src/img/32x32.png
--------------------------------------------------------------------------------
/src/js/background.js:
--------------------------------------------------------------------------------
1 | if(typeof browser === "undefined") browser = chrome;
2 |
3 | browser.runtime.onMessage.addListener(async (message, sender) => {
4 | browser.tabs.update(sender.tab.id, message);
5 | })
--------------------------------------------------------------------------------
/src/css/block.css:
--------------------------------------------------------------------------------
1 | *{
2 | font-family: "IBM Plex Mono", monospace;
3 | background-color: #181a19;
4 | color: #fff;
5 | text-align: center;
6 | }
7 |
8 | h1{
9 | font-size: 5rem;
10 | }
11 |
12 | .logo{
13 | font-size: 1rem;
14 | }
15 |
--------------------------------------------------------------------------------
/tools/make-chrome.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | BLDIR=dist/chrome
5 | rm -rf $BLDIR/*
6 |
7 | echo "Starting build"
8 |
9 | cp -R src/* $BLDIR # Seperate this later
10 | cp platform/chrome/*.json $BLDIR
11 |
12 | pushd $BLDIR
13 |
14 | zip -r chrome.zip ./*
15 |
16 | popd
--------------------------------------------------------------------------------
/tools/make-firefox.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | BLDIR=dist/firefox
5 | rm -rf $BLDIR/*
6 |
7 | echo "Starting build"
8 |
9 | cp -R src/* $BLDIR # Seperate this later
10 | cp platform/firefox/*.json $BLDIR
11 |
12 | pushd $BLDIR
13 |
14 | zip -r firefox.zip ./*
15 |
16 | popd
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | src := ${wildcard src/* src/*/*}
2 | platform := ${wildcard platform/* platform/*/*}
3 |
4 | all: firefox chrome
5 |
6 | firefox: dist/firefox/firefox.zip
7 | echo "Firefox build complete"
8 |
9 | dist/firefox/firefox.zip: ${src} ${platform}
10 | tools/make-firefox.sh
11 |
12 | chrome: dist/chrome/chrome.zip
13 | echo "Chrome build complete"
14 |
15 | dist/chrome/chrome.zip: ${src} ${platform}
16 | tools/make-chrome.sh
--------------------------------------------------------------------------------
/platform/chrome/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version" : 3,
3 | "name": "Focus Mode",
4 | "version": "1.2",
5 |
6 | "description": "A browser extension that allows you to block distractions and stay focused.",
7 | "homepage_url": "https://github.com/Bsodoge/Focus-Mode",
8 | "icons": {
9 | "16": "/img/16x16.png",
10 | "32": "/img/32x32.png"
11 | },
12 | "content_scripts": [
13 | {
14 | "matches": [""],
15 | "js": ["/js/contentscript.js"]
16 | }
17 | ],
18 | "background": {
19 | "service_worker": "/js/background.js"
20 | },
21 | "permissions": [
22 | "storage",
23 | "tabs"
24 | ],
25 | "action": {
26 | "default_title": "Focus Mode",
27 | "default_popup": "/html/popup.html"
28 | }
29 | }
--------------------------------------------------------------------------------
/src/img/github-mark-white.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/platform/firefox/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version" : 3,
3 | "name": "Focus Mode",
4 | "version": "1.2",
5 |
6 | "description": "A browser extension that allows you to block distractions and stay focused.",
7 | "homepage_url": "https://github.com/Bsodoge/Focus-Mode",
8 | "icons": {
9 | "16": "/img/16x16.png",
10 | "32": "/img/32x32.png"
11 | },
12 | "content_scripts": [
13 | {
14 | "matches": ["*://*/*"],
15 | "js": ["/js/contentscript.js"]
16 | }
17 | ],
18 | "browser_specific_settings": {
19 | "gecko": {
20 | "id": "Focus-Mode@bsodoge"
21 | }
22 | },
23 | "background": {
24 | "scripts": ["/js/background.js"]
25 | },
26 | "permissions": [
27 | "storage",
28 | "tabs"
29 | ],
30 | "action": {
31 | "browser_style": true,
32 | "default_title": "Focus Mode",
33 | "default_popup": "/html/popup.html"
34 | }
35 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 Bsodoge
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/js/contentscript.js:
--------------------------------------------------------------------------------
1 | if(typeof browser === "undefined") browser = chrome;
2 |
3 | let isToggled = false;
4 | let optionsToggled = false;
5 | let links = [];
6 | let displayLinks = [];
7 | let days = [];
8 | let startTime = new Date().toLocaleTimeString([], {hour: "2-digit", minute: "2-digit"});
9 | let endTime = new Date().toLocaleTimeString([], {hour: "2-digit", minute: "2-digit"});
10 | let settings = {
11 | isToggled,
12 | links,
13 | days,
14 | startTime,
15 | displayLinks,
16 | endTime
17 | }
18 |
19 | const applySettings = (storageSettings) => {
20 | settings = storageSettings;
21 | if(settings.isToggled) blockSite();
22 | }
23 |
24 | const blockSite = () => {
25 | const day = new Date().getDay();
26 | const time = new Date().toLocaleTimeString([], {hour: "2-digit", minute: "2-digit"});
27 | settings.links.forEach(link => {
28 | let reg = new RegExp(link.url);
29 | if(reg.exec(window.location.href) && settings.days.includes(day)) {
30 | setTimeout(blockSite, 5000)
31 | if((time >= settings.startTime) && (time <= settings.endTime) && settings.isToggled) {
32 | browser.runtime.sendMessage({url: browser.runtime.getURL("html/page.html")});
33 | }
34 | }
35 | })
36 | }
37 |
38 | const onLoad = async () => {
39 | const storageSettings = await browser.storage.local.get(settings);
40 | applySettings(storageSettings);
41 | }
42 |
43 | browser.runtime.onMessage.addListener(applySettings);
44 |
45 | onLoad();
--------------------------------------------------------------------------------
/src/html/page.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Blocked
7 |
8 |
9 |
10 |
11 |
12 |
13 |
Blocked by
14 |
15 | `7MM"""YMM
16 | MM `7
17 | MM d ,pW"Wq. ,p6"bo `7MM `7MM ,pP"Ybd
18 | MM""MM 6W' `Wb 6M' OO MM MM 8I `"
19 | MM Y 8M M8 8M MM MM `YMMMa.
20 | MM YA. ,A9 YM. , MM MM L. I8
21 | .JMML. `Ybmd9' YMbmd' `Mbod"YML.M9mmmP'
22 | ,,
23 | `7MMM. ,MMF' `7MM
24 | MMMb dPMM MM
25 | M YM ,M MM ,pW"Wq. ,M""bMM .gP"Ya
26 | M Mb M' MM 6W' `Wb ,AP MM ,M' Yb
27 | M YM.P' MM 8M M8 8MI MM 8M""""""
28 | M `YM' MM YA. ,A9 `Mb MM YM. ,
29 | .JML. `' .JMML.`Ybmd9' `Wbmd"MML.`Mbmmd'
30 |
8 |
9 | ***
10 |
11 | Focus Mode is a browser extension designed to keep you focused and productive while browsing the web.
12 |
13 | Features:
14 | - Ability to block multiple sites.
15 | - Ability to block at certain times and days.
16 | - Ability to use wildcard to mass block certain sites e.g reddit.com/* will block all reddit links.
17 |
18 | This is an open-source project and all contributions are welcome.
19 |
20 |
License
21 | MIT License
22 |
23 | Copyright (c) 2025 Bsodoge
24 |
25 | Permission is hereby granted, free of charge, to any person obtaining a copy
26 | of this software and associated documentation files (the "Software"), to deal
27 | in the Software without restriction, including without limitation the rights
28 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29 | copies of the Software, and to permit persons to whom the Software is
30 | furnished to do so, subject to the following conditions:
31 |
32 | The above copyright notice and this permission notice shall be included in all
33 | copies or substantial portions of the Software.
34 |
35 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41 | SOFTWARE.
42 |
--------------------------------------------------------------------------------
/src/img/kofi_symbol.svg:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/src/html/popup.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Focus Mode
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | `7MM"""YMM
16 | MM `7
17 | MM d ,pW"Wq. ,p6"bo `7MM `7MM ,pP"Ybd
18 | MM""MM 6W' `Wb 6M' OO MM MM 8I `"
19 | MM Y 8M M8 8M MM MM `YMMMa.
20 | MM YA. ,A9 YM. , MM MM L. I8
21 | .JMML. `Ybmd9' YMbmd' `Mbod"YML.M9mmmP'
22 | ,,
23 | `7MMM. ,MMF' `7MM
24 | MMMb dPMM MM
25 | M YM ,M MM ,pW"Wq. ,M""bMM .gP"Ya
26 | M Mb M' MM 6W' `Wb ,AP MM ,M' Yb
27 | M YM.P' MM 8M M8 8MI MM 8M""""""
28 | M `YM' MM YA. ,A9 `Mb MM YM. ,
29 | .JML. `' .JMML.`Ybmd9' `Wbmd"MML.`Mbmmd'
30 |