16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/icons/icon.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/src/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Back To Work",
3 |
4 | "description": "Get back to doing what you're supposed to be doing with Back To Work",
5 |
6 | "author": "Dheeraj Lalwani",
7 |
8 | "version": "0.0.1",
9 |
10 | "manifest_version": 3,
11 |
12 | "background": {
13 | "service_worker": "background.js",
14 | "type": "module"
15 | },
16 |
17 | "options_page": "options/options.html",
18 |
19 | "permissions": ["storage", "tabs", "declarativeNetRequest"],
20 |
21 | "action": {
22 | "default_popup": "popup/popup.html",
23 | "default_icon": {
24 | "16": "icons/icon-16.png",
25 | "32": "icons/icon-32.png",
26 | "48": "icons/icon-48.png",
27 | "96": "icons/icon-96.png",
28 | "128": "icons/icon-128.png"
29 | },
30 | "default_title": "Back To Work"
31 | },
32 |
33 | "icons": {
34 | "16": "icons/icon-16.png",
35 | "32": "icons/icon-32.png",
36 | "48": "icons/icon-48.png",
37 | "96": "icons/icon-96.png",
38 | "128": "icons/icon-128.png"
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/popup/quotes.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "quote": "Always remember, your focus determines your reality.",
4 | "author": "George Lucas"
5 | },
6 | {
7 | "quote": "I don't focus on what I'm up against. I focus on my goals and I try to ignore the rest.",
8 | "author": "Venus Williams"
9 | },
10 | {
11 | "quote": "The successful warrior is the average man, with laser-like focus.",
12 | "author": "Bruce Lee"
13 | },
14 | {
15 | "quote": "The secret of change is to focus all of your energy, not on fighting the old, but on building the new.",
16 | "author": "Socrates"
17 | },
18 | {
19 | "quote": "Our focus is our future and what we focus on will multiply in our life.",
20 | "author": "David DeNotaris"
21 | },
22 | {
23 | "quote": "Focus on the possibilities for success, not on the potential for failure.",
24 | "author": "Napoleon Hill"
25 | },
26 | {
27 | "quote": "The secret of change is to focus all of your energy, not on fighting the old, but on building the new.",
28 | "author": "Socrates"
29 | }
30 | ]
31 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Dheeraj Lalwani
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.
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | I am relatively very new to web-extension development & I am not a security expert, nor am I an expert at developing web-based extensions. So, if you do find any vulnerabilities, high risk or low risk, please please do send them my way. I shall try my best to patch them as soon as possible. User safety, security & privacy is my utmost priority.
4 |
5 | ## NO LIABILITY FOR DAMAGES
6 |
7 | In no event shall the author of this Software be liable for any special, consequential, incidental or indirect damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use this product, even if the Author of this Software is aware of the possibility of such damages and known defects.
8 |
9 | ## Supported Versions
10 |
11 | | Version | Supported |
12 | | :-----: | :-------: |
13 | | 0.0.1 | ✅ |
14 | | 0.0.2 | ✅ |
15 |
16 | ## Reporting a Vulnerability
17 |
18 | If you do happen to find a vulnerability, please feel free to shoot me an email or send me a direct message on Twitter or LinkedIn. My DMs are always open. My socials 👇🏼
19 |
20 | - [Email - lalwanidheeraj1234+BackToWork@gmail.com](lalwanidheeraj1234+BackToWork@gmail.com)
21 | - [Twitter - DhiruCodes](https://twitter.com/DhiruCodes)
22 | - [LinkedIn - lalwanidheeraj](https://www.linkedin.com/in/lalwanidheeraj)
23 |
--------------------------------------------------------------------------------
/src/background.js:
--------------------------------------------------------------------------------
1 | console.log("Get Back To Work, NOW 😡");
2 |
3 | // Setting initial mode as Chill
4 | let mode = "Chill";
5 | chrome.runtime.onInstalled.addListener(() => {
6 | console.log("Beginning to set default mode to 'Chill'.");
7 | chrome.storage.sync.set({ mode });
8 | chrome.storage.sync.get("blockedWebsites", ({ blockedWebsites }) => {
9 | if (blockedWebsites === undefined) {
10 | // checking if there is a list of empty websites in storage. if not initializing an empty list.
11 | console.log("ha bhai, blockedWebsites nahi hai list me.");
12 | let blockedWebsites = [];
13 | chrome.storage.sync.set({ blockedWebsites });
14 | }
15 | });
16 | chrome.declarativeNetRequest.getDynamicRules((rules) => {
17 | // removing old persisted dynamic rules from storage
18 | console.log(
19 | "Hello, here in the service worker. Deleting the old persisted rules."
20 | );
21 | let rulesToBeDeleted = [];
22 | for (let i = 0; i < rules.length; i++) {
23 | rulesToBeDeleted.push(rules[i].id);
24 | }
25 | console.log("Rules to be deleted: " + rulesToBeDeleted);
26 | chrome.declarativeNetRequest.updateDynamicRules(
27 | {
28 | removeRuleIds: rulesToBeDeleted,
29 | },
30 | () => {
31 | console.log("Done deleting 🥰");
32 | }
33 | );
34 | });
35 | // showing options page. TODO make an onboarding page.
36 | chrome.tabs.create({
37 | url: chrome.runtime.getURL("options/options.html"),
38 | });
39 | });
40 |
--------------------------------------------------------------------------------
/src/popup/popup.css:
--------------------------------------------------------------------------------
1 | @import url("https://fonts.googleapis.com/css2?family=Manrope:wght@200;300;400;500;600;700;800&display=swap");
2 |
3 | * {
4 | padding: 0;
5 | margin: 0;
6 | box-sizing: border-box;
7 | }
8 |
9 | html,
10 | body {
11 | width: 500px;
12 | font-family: "Manrope", sans-serif;
13 | display: flex;
14 | flex-direction: column;
15 | /* align-items: center; */
16 | background-color: #e7efff;
17 | color: #000000;
18 | }
19 |
20 | #popup_header {
21 | display: flex;
22 | align-items: center;
23 | justify-content: space-around;
24 | margin: 1em;
25 | }
26 |
27 | #popup_header > img {
28 | margin: 10px;
29 | width: 75px;
30 | height: auto;
31 | filter: drop-shadow(0 0 7px #1f283f);
32 | }
33 |
34 | #header_content {
35 | display: flex;
36 | flex-direction: column;
37 | }
38 |
39 | #header_content > #main_title {
40 | font-size: 6vw;
41 | font-weight: 600;
42 | }
43 |
44 | #header_content > #sub_title {
45 | font-size: 4vw;
46 | font-weight: 400;
47 | font-style: italic;
48 | }
49 |
50 | #options_page {
51 | margin: 10px;
52 | padding: 10px;
53 | font-size: 3vw;
54 | font-weight: 700;
55 | background-color: #000e24;
56 | color: #ffffff;
57 | border: none;
58 | border-radius: 5px;
59 | cursor: pointer;
60 | }
61 |
62 | #mode_button {
63 | width: 30vw;
64 | margin: 15px;
65 | padding: 15px;
66 | font-size: 25px;
67 | font-weight: 700;
68 | background-color: #e7efff;
69 | color: #1f283f;
70 | border: none;
71 | border-radius: 5px;
72 | cursor: pointer;
73 | align-self: center;
74 | }
75 |
76 | .chill_mode_background {
77 | background: rgb(110, 231, 183);
78 | background: radial-gradient(
79 | circle,
80 | rgba(110, 231, 183, 1) 0%,
81 | rgba(52, 211, 153, 1) 25%,
82 | rgba(16, 185, 129, 1) 50%,
83 | rgba(5, 150, 105, 1) 100%
84 | );
85 | color: #000000;
86 | }
87 | .work_mode_background {
88 | background: rgb(248, 113, 113);
89 | background: radial-gradient(
90 | circle,
91 | rgba(248, 113, 113, 1) 0%,
92 | rgba(248, 113, 113, 1) 25%,
93 | rgba(239, 68, 68, 1) 75%,
94 | rgba(239, 68, 68, 1) 100%
95 | );
96 | }
97 |
98 | #quote_section {
99 | display: flex;
100 | flex-direction: column;
101 | align-items: center;
102 | justify-content: center;
103 | font-size: 1.5em;
104 | text-align: center;
105 | background-color: #000e24;
106 | color: #e7efff;
107 | border-radius: 15px 15px 0 0;
108 | }
109 |
110 | .quote {
111 | padding: 1em;
112 | }
113 |
114 | .author {
115 | font-weight: 700;
116 | }
117 |
--------------------------------------------------------------------------------
/src/options/options.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Back To Work
9 |
10 |
11 |
17 |
44 |
45 |
46 |
47 |
48 |
Back to work
49 |
Get shit done ☑️
50 |
51 |
52 |
53 |
- Your addictive websites -
54 |
55 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | - Using welcoming and inclusive language
18 | - Being respectful of differing viewpoints and experiences
19 | - Gracefully accepting constructive criticism
20 | - Focusing on what is best for the community
21 | - Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | - The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | - Trolling, insulting/derogatory comments, and personal or political attacks
28 | - Public or private harassment
29 | - Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | - Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at lalwanidheeraj1234@gmail.com. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
--------------------------------------------------------------------------------
/src/options/options.js:
--------------------------------------------------------------------------------
1 | let list = document.querySelector("#list");
2 | console.log(list);
3 |
4 | document.addEventListener("DOMContentLoaded", () => {
5 | console.log("Load ho gaya window.");
6 | chrome.storage.sync.get("blockedWebsites", ({ blockedWebsites }) => {
7 | if (blockedWebsites.length == 0) {
8 | console.log("ha bhai, undefined bata raha hai.");
9 | let emptyListMessage = `
You have added no websites. Add now
`;
10 | list.innerHTML = emptyListMessage;
11 | return;
12 | }
13 | console.log(blockedWebsites);
14 | let listItems = "";
15 | // inserting the buttons links & delete buttons on the page.
16 | for (let i = 0; i < blockedWebsites.length; i++) {
17 | listItems += `
11 | A simple browser extension, intended to get you Back To Work when you start slacking off to one of those really addictive sites.
12 |
13 |
14 |
15 |
16 |
How to install?
17 |
18 |
19 |
20 | Clone the repository or download the latest release archive from here.
21 |
22 |
23 | If you are on Google Chrome Browser, open new tab & type: chrome://extensions or if you are on Microsoft Edge Browser, type: edge://extensions.
24 |
25 |
26 | Look for the Developer mode toggle & turn it on if it's not already.
27 |
28 |
29 | Here's where to find it in -
30 |
31 |
Chrome
32 |
33 |
Edge
34 |
35 |
36 |
37 |
38 | Next, click on Load unpacked.
39 |
40 |
41 | Here's where to find it in -
42 |
43 |
Chrome
44 |
45 |
Edge
46 |
47 |
48 |
49 |
50 | Then navigate to the extracted folder if you downloaded it from the Releases page or to the src folder if you have cloned the source code.
51 |
52 |
53 | There you go! Your extension is installed.
54 |
55 |
56 |
57 |
58 |
59 |
What does it really do?
60 |
61 |
62 | Well thats easy to understand. There are 2 modes.
63 |
64 |
Work
65 |
Chill
66 |
67 | When you switch to work mode, it asks you to list all the websites that you are addicted to.For example: YouTube, Instagram, Twitter... And it locks you out of those websites.
68 |
69 |
70 |
71 |
72 |
For how long? How do I unlock them? I need to have some fun at least...
73 |
74 |
75 | The extension asks you to choose one out of the two unlocking modes-
76 |
77 |
78 |
Time Based
79 |
80 |
81 | In time based locking mode. It will ask you for how long you wish to lock these websites and they will be forbidden. If you still try to visit these websites, you shall be redirected to a standard page, reminding you to get back to your tasks or redirect you to a website of your choice.
82 |
83 |
84 |
Password Based
85 |
86 | In password based unlocking, you shall be asked to type in an unlocking password which can be set by someone else and can be unlocked by them once you are done with your work.
87 |
88 |
89 |
90 |
91 |
Compatibility
92 |
93 | Currently, this extension works only on Chrome, Edge and hopefully other Chromium based browsers. But one of the long term goals for this project is to be cross browser compatible. If you wish to help me make them compatible across browsers, feel free to open a new issue or shoot me an email or direct message me at any of my socials 👇🏼
94 |