Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChromeExtension_Problem3_by_ParthSharma #10

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Problem3_ParthSharma_20117088.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
##ChromeExtension
Link-
https://github.com/lhcalpha/Makers_ChromeExtension_Problem3
Binary file added extension_img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -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"]}
10 changes: 10 additions & 0 deletions newtab.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<html>
<head>
<title>Test</title>
</head>
<body>
<h1 id="button" style="align-content: center;">Facebook</h1>
<script src="popup.js"> </script>
</body>
</html>
10 changes: 10 additions & 0 deletions popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<html>
<head>
<title>Test</title>
</head>
<body>
<p>Extension to control Facebook addiction</p>
<script src="popup.js"> </script>
</body>
</html>
19 changes: 19 additions & 0 deletions popup.js
Original file line number Diff line number Diff line change
@@ -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();
// }