├── testing ├── new.txt └── .gitmodules ├── no5.gif ├── clock.png ├── extension_small.png ├── screenshots ├── one.gif ├── Screenshot (59).png ├── Screenshot (60).png ├── Screenshot (61).png ├── Screenshot (62).png └── Screenshot (63).png ├── manifest.json ├── script.js ├── web.html ├── web.js ├── options.css ├── background.js ├── README.md ├── popup.js ├── popup.html ├── dateAndTime.js ├── options.js └── options.html /testing/new.txt: -------------------------------------------------------------------------------- 1 | sndfsdnfkdsfkds -------------------------------------------------------------------------------- /no5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pkarira/Fokus/HEAD/no5.gif -------------------------------------------------------------------------------- /clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pkarira/Fokus/HEAD/clock.png -------------------------------------------------------------------------------- /extension_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pkarira/Fokus/HEAD/extension_small.png -------------------------------------------------------------------------------- /screenshots/one.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pkarira/Fokus/HEAD/screenshots/one.gif -------------------------------------------------------------------------------- /screenshots/Screenshot (59).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pkarira/Fokus/HEAD/screenshots/Screenshot (59).png -------------------------------------------------------------------------------- /screenshots/Screenshot (60).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pkarira/Fokus/HEAD/screenshots/Screenshot (60).png -------------------------------------------------------------------------------- /screenshots/Screenshot (61).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pkarira/Fokus/HEAD/screenshots/Screenshot (61).png -------------------------------------------------------------------------------- /screenshots/Screenshot (62).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pkarira/Fokus/HEAD/screenshots/Screenshot (62).png -------------------------------------------------------------------------------- /screenshots/Screenshot (63).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pkarira/Fokus/HEAD/screenshots/Screenshot (63).png -------------------------------------------------------------------------------- /testing/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "git_test"] 2 | path = git_test 3 | url = /Users/pulkit.karira/Documents/git_test 4 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | 4 | "name": "Fokus", 5 | "description": "Chrome Extension for blocking website for specified duration between instances of closing and opening tab", 6 | "version": "1.5", 7 | "options_page": "options.html", 8 | 9 | "browser_action": { 10 | "default_icon": "clock.png", 11 | "default_popup": "popup.html" 12 | }, 13 | "icons": { 14 | "128": "extension_small.png" }, 15 | "background": { 16 | "scripts": ["dateAndTime.js","background.js"] 17 | }, 18 | "content_scripts":[ 19 | { 20 | "matches": ["http://*/*","https://*/*"], 21 | "js": ["script.js"] 22 | } 23 | 24 | ], 25 | "permissions": [ 26 | "tabs", 27 | "activeTab", 28 | "storage", 29 | "contentSettings", 30 | "alarms" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /script.js: -------------------------------------------------------------------------------- 1 | 2 | var a;chrome.runtime.sendMessage({greeting: "hello"}, function(response) { 3 | a=response.farewell.toString(); 4 | }); 5 | var diff; 6 | chrome.storage.sync.get('myArray', function(data) { 7 | for (var i=0;i 2 | 3 | 4 | 5 | 6 | 7 | 57 | 58 |
Sorry! This URL can't be opened right now.
Please, come after minutes.
59 | 60 |
61 |
© 2016 , Mobile Development Group , IIT Roorkee
62 | 63 | 64 | -------------------------------------------------------------------------------- /web.js: -------------------------------------------------------------------------------- 1 | document.addEventListener('DOMContentLoaded', function() { 2 | var list1=[]; 3 | document.getElementById("quote").innerHTML = store(); 4 | chrome.storage.sync.get('diff', function(data) { 5 | var timeLeft = data.diff; 6 | document.getElementById("war").innerHTML = timeLeft--; 7 | window.setInterval(function() { 8 | if(timeLeft >= 0) { 9 | document.getElementById("war").innerHTML = timeLeft--; 10 | } 11 | 12 | }, 60000); 13 | 14 | }); 15 | function getRandomInt(min, max) { 16 | return parseInt(Math.floor(Math.random() * (max - min + 1)) + min,10); 17 | } 18 | function store() 19 | { 20 | list1.push("Unfortunately, the clock is ticking, the hours are going by. The past increases, the future recedes. Possibilities decreasing, regrets mounting."); 21 | list1.push("Yesterday is gone. Tomorrow has not yet come. We have only today. Let us begin."); 22 | list1.push("Time is a created thing. To say 'i don't have time,' is like saying, 'i don't want to.'"); 23 | list1.push("Time is what we want most,but what we use worst."); 24 | list1.push("You must give everything to make your life as beautiful as the dreams that dance in your imagination."); 25 | list1.push("Until you value yourself, you won't value your time. Until you value your time, you will not do anything with it."); 26 | list1.push("Life is uncertain don't waste your time on such things that don't deserve your time and efforts instead do things you love and live your life to fullest."); 27 | list1.push("The bad news is time flies. The good news is you're the pilot."); 28 | list1.push("Time is the most valuable coin in your life. You and you alone will determine how that coin will be spent. Be careful that you do not let other people spend it for you."); 29 | list1.push("Time is priceless; you are responsible for your time. Earn it or kill it, your choice"); 30 | list1.push("If you don't steal time, time will loot you."); 31 | list1.push("Hard work is often the easy work you did not do at the proper time."); 32 | list1.push("Time is not money because it never returns."); 33 | var d; 34 | d=list1[getRandomInt(0,list1.length-1)]; 35 | return d; 36 | } 37 | },false); -------------------------------------------------------------------------------- /options.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: #fafafa url(http://jackrugile.com/images/misc/noise-diagonal.png); 3 | color: #444; 4 | font: 100%/30px 'Helvetica Neue', helvetica, arial, sans-serif; 5 | text-shadow: 0 1px 0 #fff; 6 | } 7 | 8 | strong { 9 | font-weight: bold; 10 | } 11 | 12 | em { 13 | font-style: italic; 14 | } 15 | 16 | table { 17 | background: #f5f5f5; 18 | border-collapse: separate; 19 | /*box-shadow: inset 0 1px 0 #fff;*/ 20 | font-size: 12px; 21 | line-height: 24px; 22 | margin: 30px auto; 23 | text-align: left; 24 | width: 600px; 25 | } 26 | 27 | th { 28 | background-color: #37474F; 29 | color: #fff; 30 | column-width: 5px; 31 | font-weight: bold; 32 | padding: 10px 15px; 33 | position: relative; 34 | text-shadow: 0 1px 0 #000; 35 | } 36 | 37 | th:after { 38 | background: linear-gradient(rgba(255,255,255,0), rgba(255,255,255,.08)); 39 | content: ''; 40 | display: block; 41 | height: 25%; 42 | left: 0; 43 | margin: 1px 0 0 0; 44 | position: absolute; 45 | top: 25%; 46 | width: 100%; 47 | } 48 | 49 | th:first-child { 50 | border-left: 1px solid #777; 51 | /*box-shadow: inset 1px 1px 0 #999;*/ 52 | } 53 | 54 | th:last-child { 55 | box-shadow: inset -1px 1px 0 #999; 56 | column-width: 20px; 57 | /*width: 50px;*/ 58 | } 59 | 60 | td { 61 | border-right: 1px solid #fff; 62 | border-left: 1px solid #e8e8e8; 63 | border-top: 1px solid #fff; 64 | border-bottom: 1px solid #e8e8e8; 65 | padding: 10px 15px; 66 | position: relative; 67 | width: 5px; 68 | transition: all 300ms; 69 | } 70 | 71 | td:first-child { 72 | box-shadow: inset 1px 0 0 #fff; 73 | } 74 | 75 | td:last-child { 76 | border-right: 1px solid #e8e8e8; 77 | box-shadow: inset -1px 0 0 #fff; 78 | } 79 | 80 | tr { 81 | /*background: url(http://jackrugile.com/images/misc/noise-diagonal.png);*/ 82 | background-color: #CFD8DC; 83 | } 84 | 85 | tr:nth-child(odd) td { 86 | background: #f1f1f1 url(http://jackrugile.com/images/misc/noise-diagonal.png); 87 | } 88 | 89 | tr:last-of-type td { 90 | box-shadow: inset 0 -1px 0 #fff; 91 | } 92 | 93 | tr:last-of-type td:first-child { 94 | box-shadow: inset 1px -1px 0 #fff; 95 | } 96 | 97 | tr:last-of-type td:last-child { 98 | box-shadow: inset -1px -1px 0 #fff; 99 | /*column-width: 20px;*/ 100 | } 101 | 102 | tbody:hover td { 103 | color: transparent; 104 | text-shadow: 0 0 3px #aaa; 105 | } 106 | 107 | tbody:hover tr:hover td { 108 | color: #444; 109 | text-shadow: 0 1px 0 #fff; 110 | } -------------------------------------------------------------------------------- /background.js: -------------------------------------------------------------------------------- 1 | 2 | /* chrome.storage.sync.get('myArray', function(data) { 3 | 4 | data.myArray.length=0; 5 | chrome.storage.sync.set({'myArray':data.myArray}, function(){ 6 | alert(data.myArray.length=0); 7 | }); 8 | });*/ 9 | 10 | chrome.runtime.onMessage.addListener(function(request, sender,sendResponse) { 11 | if (request.greeting == "hello") 12 | { 13 | var url = new URL(sender.tab.url); 14 | var domain = url.hostname; 15 | sendResponse({farewell: (domain+"")}); 16 | } 17 | else 18 | chrome.tabs.update(sender.tab.id, {url: request.redirect}); 19 | }); 20 | chrome.tabs.onRemoved.addListener(function(tabId, removeInfo) { 21 | chrome.storage.sync.get('myArray', function(data) { 22 | for (var i=0;iUSP 10 | As mentioned above this extension allows you set interval of closing and opening of same website , other site blockers either block your website 11 | indefinitely or allows you set time limit to your usage in a day but this is not a case with this extension , you can spend as much time on website as you want 12 | and once you close your tab then you will not be able to open it for saved time interval . 13 | 14 |

Usage ( Its quite simple people!! )

15 | In the pop box either copy paste the url or go on the which you want to add and click Add This Page button .

16 |

17 | Then select time interval of closing and opening and click on save button .

18 |

19 | Lets suppose you set 45 minutes for facebook and close your facebook's tab . Now if you try to open facebook then you will reach to a screen like:

20 |

21 | If you want to view/edit/delete saved urls then click on update button in popup box of extension then u will reach to a screen like:

22 |

23 | Now if u want to change time then just click on edit button beside the url to be edited and u will reach here:

24 |

25 |

"FOKUS" with a "K"

26 | Fokus is swedish translation of the word focus which means to concentrate. 27 |

License

28 | 29 | * [Apache Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) 30 | ``` 31 | Copyright 2016 Pulkit Karira 32 | 33 | Licensed under the Apache License, Version 2.0 (the "License"); 34 | you may not use this file except in compliance with the License. 35 | You may obtain a copy of the License at 36 | 37 | http://www.apache.org/licenses/LICENSE-2.0 38 | 39 | Unless required by applicable law or agreed to in writing, software 40 | distributed under the License is distributed on an "AS IS" BASIS, 41 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 42 | See the License for the specific language governing permissions and 43 | limitations under the License. 44 | ``` 45 | 46 | 47 | -------------------------------------------------------------------------------- /popup.js: -------------------------------------------------------------------------------- 1 | document.addEventListener('DOMContentLoaded', function() { 2 | var saveButton = document.getElementById('save'); 3 | var siteUrl; 4 | var min; 5 | var hour; 6 | var d=new Date(); 7 | var optionB=document.getElementById('option'); 8 | chrome.storage.sync.get('myArray', function(data) { 9 | if (typeof data.myArray === "undefined") { 10 | var a=[]; 11 | var list=[]; 12 | list.push(""); 13 | list.push(""); 14 | list.push(""); 15 | list.push(""); 16 | list.push(""); 17 | list.push(""); 18 | list.push(""); 19 | list.push(""); 20 | a.push(list); 21 | chrome.storage.sync.set({'myArray':a}, function(){ 22 | 23 | }); 24 | }}); 25 | var element2 = document.getElementById('minutes'); 26 | element2.value = 30; 27 | chrome.tabs.query({'active': true, 'lastFocusedWindow': true}, function (tabs) { 28 | var url =tabs[0].url; 29 | (document.getElementById("siteurl")).setAttribute("value",url+""); 30 | }); 31 | 32 | optionB.addEventListener('click',function() 33 | { 34 | chrome.tabs.create({ url: "options.html" }); 35 | 36 | }); 37 | saveButton.addEventListener('click', function() 38 | { 39 | 40 | var e1 = document.getElementById("hours"); 41 | var hour = e1.options[e1.selectedIndex].text; 42 | var e2 = document.getElementById("minutes"); 43 | var min = e2.options[e2.selectedIndex].text; 44 | 45 | chrome.storage.sync.get('myArray', function(data) { 46 | if (typeof data.myArray === "undefined") { 47 | var a=[]; 48 | var list=[]; 49 | list.push(""); 50 | list.push(""); 51 | list.push(""); 52 | list.push(""); 53 | list.push(""); 54 | list.push(""); 55 | list.push(""); 56 | list.push(""); 57 | a.push(list); 58 | chrome.storage.sync.set({'myArray':a}, function(){ 59 | alert("chrome.storage is now initialized , please click save again"); 60 | }); 61 | } 62 | if((ValidURL(document.getElementById("siteurl").value.toString()))==true) 63 | { 64 | var url = new URL(document.getElementById("siteurl").value); 65 | var domain = url.hostname; 66 | siteUrl = domain.toString(); 67 | var b=true; 68 | for (var i=0;i 2 | 3 | 4 | 5 | 6 | 7 | 8 | 87 | 88 | 89 |

92 |
93 | URL: 94 |

95 | 96 | Hours: 97 |       123 | 124 | 125 | Minutes: 126 | 127 | 142 |


143 |     144 | 145 |

146 | 147 | -------------------------------------------------------------------------------- /dateAndTime.js: -------------------------------------------------------------------------------- 1 | function dateAndTime(year,mon,date,hour,min,h1,m1) 2 | { 3 | var hour1=hour; 4 | if(mon==1||mon==3||mon==5||mon==7||mon==8||mon==10) 5 | { 6 | if(date!=31) 7 | { 8 | if((hour+min/60+h1+m1/60)<24) 9 | { 10 | hour=hour+h1+parseInt((min+m1)/60,10); 11 | min=(min+m1)%60; 12 | }else 13 | { 14 | date=date+1; 15 | hour=parseInt(((h1*60+m1)-((24-(hour+1))*60+(60-min)))/60,10); 16 | min=((h1*60+m1)-((24-(hour1+1))*60+(60-min)))%60; 17 | } 18 | }else 19 | { 20 | if((hour+min/60+h1+m1/60)<24) 21 | { 22 | hour=hour+h1+(int)(min+m1)/60; 23 | min=(min+m1)%60; 24 | }else 25 | { 26 | mon=mon+1; 27 | date=1; 28 | hour=parseInt(((h1*60+m1)-((24-(hour+1))*60+(60-min)))/60,10); 29 | min=((h1*60+m1)-((24-(hour1+1))*60+(60-min)))%60; 30 | } 31 | } 32 | }else 33 | if(mon==4||mon==6||mon==9||mon==11) 34 | { 35 | if(date!=30) 36 | { 37 | if((hour+min/60+h1+m1/60)<24) 38 | { 39 | hour=hour+h1+parseInt((min+m1)/60,10); 40 | min=(min+m1)%60; 41 | }else 42 | { 43 | date=date+1; 44 | hour=parseInt(((h1*60+m1)-((24-(hour+1))*60+(60-min)))/60,10); 45 | min=((h1*60+m1)-((24-(hour1+1))*60+(60-min)))%60; 46 | } 47 | }else 48 | { 49 | if((hour+min/60+h1+m1/60)<24) 50 | { 51 | hour=hour+h1+parseInt((min+m1)/60,10); 52 | min=(min+m1)%60; 53 | }else 54 | { 55 | mon=mon+1; 56 | date=1; 57 | hour=parseInt(((h1*60+m1)-((24-(hour+1))*60+(60-min)))/60,10); 58 | min=((h1*60+m1)-((24-(hour1+1))*60+(60-min)))%60; 59 | } 60 | } 61 | }else 62 | if(mon==2) 63 | { 64 | if(year%4==0) 65 | { 66 | if(date!=29) 67 | { 68 | if((hour+min/60+h1+m1/60)<24) 69 | { 70 | hour=hour+h1+parseInt((min+m1)/60,10); 71 | min=(min+m1)%60; 72 | }else 73 | { 74 | date=date+1; 75 | hour=parseInt(((h1*60+m1)-((24-(hour+1))*60+(60-min)))/60,10); 76 | min=((h1*60+m1)-((24-(hour1+1))*60+(60-min)))%60; 77 | } 78 | }else 79 | { 80 | if((hour+min/60+h1+m1/60)<24) 81 | { 82 | hour=hour+h1+parseInt((min+m1)/60,10); 83 | min=(min+m1)%60; 84 | }else 85 | { 86 | mon=mon+1; 87 | date=1; 88 | hour=parseInt(((h1*60+m1)-((24-(hour+1))*60+(60-min)))/60,10); 89 | min=((h1*60+m1)-((24-(hour1+1))*60+(60-min)))%60; 90 | } 91 | } 92 | }else 93 | { 94 | if(date!=28) 95 | { 96 | if((hour+min/60+h1+m1/60)<24) 97 | { 98 | hour=hour+h1+parseInt((min+m1)/60,10); 99 | min=(min+m1)%60; 100 | }else 101 | { 102 | date=date+1; 103 | hour=parseInt(((h1*60+m1)-((24-(hour+1))*60+(60-min)))/60,10); 104 | min=((h1*60+m1)-((24-(hour1+1))*60+(60-min)))%60; 105 | } 106 | }else 107 | { 108 | if((hour+min/60+h1+m1/60)<24) 109 | { 110 | hour=hour+h1+parseInt((min+m1)/60,10); 111 | min=(min+m1)%60; 112 | }else 113 | { 114 | mon=mon+1; 115 | date=1; 116 | hour=parseInt(((h1*60+m1)-((24-(hour+1))*60+(60-min)))/60,10); 117 | min=((h1*60+m1)-((24-(hour1+1))*60+(60-min)))%60; 118 | } 119 | } 120 | } 121 | }else 122 | if(mon==12) 123 | { 124 | if(date!=31) 125 | { 126 | if((hour+min/60+h1+m1/60)<24) 127 | { 128 | hour=hour+h1+parseInt((min+m1)/60,10); 129 | min=(min+m1)%60; 130 | }else 131 | { 132 | date=date+1; 133 | hour=parseInt(((h1*60+m1)-((24-(hour+1))*60+(60-min)))/60,10); 134 | min=((h1*60+m1)-((24-(hour1+1))*60+(60-min)))%60; 135 | } 136 | }else 137 | { 138 | if((hour+min/60+h1+m1/60)<24) 139 | { 140 | hour=hour+h1+parseInt((min+m1)/60,10); 141 | min=(min+m1)%60; 142 | }else 143 | { 144 | year=year+1; 145 | mon=1; 146 | date=1; 147 | hour=parseInt(((h1*60+m1)-((24-(hour+1))*60+(60-min)))/60,10); 148 | min=((h1*60+m1)-((24-(hour1+1))*60+(60-min)))%60; 149 | } 150 | } 151 | } 152 | return (parseInt(year,10)+" "+parseInt(mon,10)+" "+parseInt(date,10)+" "+parseInt(hour,10)+" "+parseInt(min,10)).toString()+" "; 153 | //return year+" "+mon+" "+" "+date+" "+" "+hour+" "+min+" "; 154 | } -------------------------------------------------------------------------------- /options.js: -------------------------------------------------------------------------------- 1 | document.addEventListener('DOMContentLoaded', function() { 2 | var table = document.getElementById("table"); 3 | var tableHead = document.createElement("thead"); 4 | tableHead.innerHTML = "URLTIMEOPTIONS"; 5 | table.appendChild(tableHead); 6 | chrome.storage.sync.get('myArray', function(data) { 7 | for (var i=0;i 2 | 3 | 4 | 5 | 6 | 7 | 120 | 121 | 122 | 123 | 124 | 150 | 151 | 152 | 155 |


156 |
157 |
158 |
161 |
162 | URL: 163 |
164 | Hours: 165 |       191 | Minutes: 192 |
207 |    208 | 209 |
210 |
211 |
212 | 213 |
214 | 215 | --------------------------------------------------------------------------------