diff --git a/extension_img.png b/extension_img.png new file mode 100644 index 0000000..f295486 Binary files /dev/null and b/extension_img.png differ diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..ae63f67 --- /dev/null +++ b/manifest.json @@ -0,0 +1,11 @@ +{ "manifest_version": 2, "name": "Anti-Distract", "description": "Will close the tab of facebook page after a certain time is over", "version": "1", "author": "Parth Sharma", + "browser_action": { "default_popup": "popup.html", "default_icon": "extension_img.png", "default_title": "Be anti-Addict" }, + "chrome_url_overrides" : { "newtab": "newtab.html"}, + "content_security_policy":"script-src 'self' https://apis.google.com/popup.js; object-src 'self'", + "content_scripts": [ + { + "matches" : ["http://*/*", "https://*/*"], + "js" : ["popup.js"] + } + ], + "permissions": ["activeTab"]} diff --git a/newtab.html b/newtab.html new file mode 100644 index 0000000..b637205 --- /dev/null +++ b/newtab.html @@ -0,0 +1,10 @@ + + +
+Extension to control Facebook addiction
+ + + \ No newline at end of file diff --git a/popup.js b/popup.js new file mode 100644 index 0000000..b6d84a9 --- /dev/null +++ b/popup.js @@ -0,0 +1,19 @@ +window.addEventListener("DOMContentLoaded",()=>{ + Link_open(); +}) +function Link_open() { + var myWindow = window.open('https://www.facebook.com/'); + setTimeout(function () { + window.alert("Your facebook watching time is over so the tab was closed"); + myWindow.close(); + }, 10000); +} +// function timer() { +// setTimeout(Close_window, 10000); +// } +// function Close_window() { +// myWindow.close(); +// } +// function Click_me() { +// document.getElementById('button').onclick = Link_open(); +// } \ No newline at end of file