diff --git a/assets/128px.png b/assets/128px.png new file mode 100644 index 0000000..07447a8 Binary files /dev/null and b/assets/128px.png differ diff --git a/assets/16px.png b/assets/16px.png new file mode 100644 index 0000000..515d668 Binary files /dev/null and b/assets/16px.png differ diff --git a/assets/48px.png b/assets/48px.png new file mode 100644 index 0000000..9930288 Binary files /dev/null and b/assets/48px.png differ diff --git a/assets/500px.png b/assets/500px.png new file mode 100644 index 0000000..140c650 Binary files /dev/null and b/assets/500px.png differ diff --git a/assets/64px.png b/assets/64px.png new file mode 100644 index 0000000..6ed8a57 Binary files /dev/null and b/assets/64px.png differ diff --git a/content.js b/content.js new file mode 100644 index 0000000..0669680 --- /dev/null +++ b/content.js @@ -0,0 +1,340 @@ +var URLpath = String(window.location.hostname) +var URLlist = [] + +const generateSTYLES = () => { + return ` + + `; +}; + +const generateHTML = () => { + return ` +
+ +
+
+
+
+
+
+ +
+ +
+ +
Dei
+
+
Parama, Poi Padi Da
+ +


+ + + +
+ +
+ +
+

CREATED BY THE NITHIN BALAJI

+
+
+
+ + `; +}; + +chrome.storage.local.get(["blockedlist"], function(items){ + finishedload(items) +}); + +function finishedload(items){ + + console.log("Blocklist = ", JSON.stringify(items)) + URLlist = items["blockedlist"] + + if(typeof URLlist === "undefined"){ + URLlist = [] + + chrome.storage.local.set({ "blockedlist": URLlist }, function(){ + }); + + } + + console.log("Current URL = ", URLpath) + console.log("Is the current URL there in list = ", URLlist.includes(URLpath)) + + + if(URLlist.includes(URLpath)){ + document.head.innerHTML = generateSTYLES(); + document.body.innerHTML = generateHTML(); + } +} + + diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..ffd371d --- /dev/null +++ b/manifest.json @@ -0,0 +1,41 @@ +{ + "manifest_version": 3, + + "name": "Padi Da", + "description": "Dei Parama, Padi Da!", + "version": "1.0.0", + + "homepage_url": "https://github.com/thenithinbalaji", + + "icons": { + "16": "assets/16px.png", + "48": "assets/48px.png", + "64": "assets/64px.png", + "128": "assets/128px.png" + }, + + "permissions": [ + "storage", + "tabs" + ], + + "content_scripts": [ + { + "matches": [""], + "js": ["content.js"] + } + + ], + + "action": { + "default_popup": "popup.html", + "default_title": "Padi Da", + "default_icon": { + "16": "assets/16px.png", + "48": "assets/48px.png", + "64": "assets/64px.png", + "128": "assets/128px.png" + } + } + +} \ No newline at end of file diff --git a/popup.html b/popup.html new file mode 100644 index 0000000..d4e665d --- /dev/null +++ b/popup.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + +

THIS WEBSITE IS

+ +
+ + + + \ No newline at end of file diff --git a/popupscript.js b/popupscript.js new file mode 100644 index 0000000..be61652 --- /dev/null +++ b/popupscript.js @@ -0,0 +1,78 @@ +var URLpath +var URLlist = [] + +chrome.tabs.query( + { + active:true + }, + + tabs=>{ + URLpath = tabs[0].url; + let domain = (new URL(URLpath)) + URLpath = domain.hostname + } +) + +chrome.storage.local.get(["blockedlist"], function(items){ + + console.log("Existing List = ", JSON.stringify(items)) + URLlist = items["blockedlist"] + + if(typeof URLlist === "undefined"){ + URLlist = [] + + chrome.storage.local.set({ "blockedlist": URLlist }, function(){ + }); + + } + +}); + +window.onload = function(){ + + const by = document.getElementById("buttonyes") + if(by){ + by.addEventListener("click", clickedyes); + } + + const bn = document.getElementById("buttonno") + if(bn){ + bn.addEventListener("click", clickedno); + } + +} + + +function clickedyes(){ + + URLlist.push(URLpath) + URLlist = [...new Set(URLlist)]; + chrome.storage.local.set({ "blockedlist": URLlist }, function(){ + }); + + chrome.storage.local.get(["blockedlist"], function(items){ + console.log("New (Added) List = ", JSON.stringify(items)) + }); + + chrome.tabs.reload() + window.close() +} + +function clickedno(){ + + var URLlistindex = URLlist.indexOf(URLpath); + + if(URLlistindex != -1) + URLlist.splice(URLlistindex, 1) + + URLlist = [...new Set(URLlist)]; + chrome.storage.local.set({ "blockedlist": URLlist }, function(){ + }); + + chrome.storage.local.get(["blockedlist"], function(items){ + console.log("New (Removed) List = ", JSON.stringify(items)) + }); + + chrome.tabs.reload() + window.close(); +} \ No newline at end of file diff --git a/popupstyle.css b/popupstyle.css new file mode 100644 index 0000000..5c64a14 --- /dev/null +++ b/popupstyle.css @@ -0,0 +1,25 @@ +body { + width: 250px; + text-align: center; + background-color: rgb(240, 240, 240); + margin: 20px; +} + +p{ + font-weight: bold; + font-size: 15px; +} + +button { + padding: 5px; + margin: 6px; + width: 200px; + cursor: pointer; + border-radius: 10px; + font-weight: bold; + background-color: #ffc400; +} + +button:hover{ + background-color: #ce9f04; +} diff --git a/readme assets/extension.png b/readme assets/extension.png new file mode 100644 index 0000000..4221692 Binary files /dev/null and b/readme assets/extension.png differ diff --git a/readme assets/load unpacked.png b/readme assets/load unpacked.png new file mode 100644 index 0000000..5d6c4d7 Binary files /dev/null and b/readme assets/load unpacked.png differ diff --git a/readme assets/pinning extension.png b/readme assets/pinning extension.png new file mode 100644 index 0000000..5cc05d2 Binary files /dev/null and b/readme assets/pinning extension.png differ diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..7367cef --- /dev/null +++ b/readme.md @@ -0,0 +1,30 @@ +# 🤔 Dei Parama, Padi Da +A Chrome browser extension made with JS, extension manifest version 3. It helps you be free of distractions and focus on your studies. Made by TheNithinBalaji. + +# 💻 How to install? +Since uploading an extension to the chrome store costs around $5, I haven't done it (I'm broke guys). Please follow these steps to install it from a zip file. + ++ Click here to download the zip ++ Extract this zip to a location and make sure not to move those files from that location, because these are the extension's files. Recommended to put it in a folder in your favorite place and name it "Don't Delete To Pass The Exams". ++ Open the Extension Management page by navigating to +``` + chrome://extensions. +``` ++ Alternatively, open this page by clicking on the Extensions menu button and selecting Manage Extensions at the bottom of the menu. + ++ Alternatively, open this page by clicking on the Chrome menu, hovering over More Tools then select Extensions + +| Unpacking the Extension | Pinning the extension | +|:------------------------:|:----------------------------------------------:| +|

|

| + ++ Enable Developer Mode by clicking the toggle switch next to Developer mode. ++ Click the Load unpacked button and select the unzipped folder containing `manifest.json`. ++ By default, extensions appear in the extensions menu. Pinning the extension will display the icon in the toolbar. + +# How to use? ++ Go to the website that's distracting you. ++ Click on the extension and mark it as **'A Distraction'**. ++ If you want to unmark the same website, click on the extension again and mark it as **'Not a Distraction'**. + +

\ No newline at end of file