Skip to content

Commit 3f716d7

Browse files
hai-altx-softStigmatoz
authored andcommitted
Block page part 2
1 parent 71fd825 commit 3f716d7

File tree

5 files changed

+88
-2
lines changed

5 files changed

+88
-2
lines changed

block.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
<head>
55
<meta charset="utf-8">
66
<title>Access to the site is limited</title>
7-
<link href="style/settings.css" rel="stylesheet" />
7+
<link href="style/block.css" rel="stylesheet" />
88
</head>
99

1010
<body>
1111
<div class="content">
12-
Limit for this site
12+
<img src="icons/time.svg" height="50">
13+
<p class="title">Time limit</p>
14+
<div class="description">You've reached today your limit on <span id='site' class="current-site">youtube.com</span></div>
1315
</div>
1416
</body>
1517

icons/time.svg

Lines changed: 44 additions & 0 deletions
Loading

scripts/activity.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ class Activity {
3434
else return false;
3535
}
3636

37+
checkRestrictionIfAny(domain){
38+
if (setting_restriction_list !== undefined && setting_restriction_list.length > 0){
39+
var item = setting_restriction_list.find(o => o.domain === domain);
40+
if (item !== undefined){
41+
42+
}
43+
}
44+
else return false;
45+
}
46+
3747
isNewUrl(domain) {
3848
if (tabs.length > 0)
3949
return tabs.find(o => o.url === domain) === undefined;

scripts/background.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var activity = new Activity();
66
var storage = new LocalStorage();
77

88
var setting_black_list;
9+
var setting_restriction_list;
910
var setting_interval_save;
1011
var setting_interval_inactivity;
1112
var setting_view_in_badge;
@@ -20,6 +21,7 @@ function updateStorage() {
2021

2122
function backgroundCheck() {
2223
loadBlackList();
24+
loadRestrictionList();
2325
storage.getSettings(SETTINGS_INTERVAL_INACTIVITY, function (item) { setting_interval_inactivity = item; });
2426
storage.getSettings(SETTINGS_VIEW_TIME_IN_BADGE, function (item) { setting_view_in_badge = item; });
2527
chrome.windows.getLastFocused({ populate: true }, function (currentWindow) {
@@ -36,6 +38,9 @@ function backgroundCheck() {
3638
activity.setCurrentActiveTab(tab.url);
3739
chrome.idle.queryState(parseInt(setting_interval_inactivity), function (state) {
3840
if (state === 'active') {
41+
if (activity.checkRestrictionIfAny(activeUrl) && ){
42+
43+
}
3944
if (!activity.isInBlackList(activeUrl))
4045
tab.incSummaryTime();
4146
if (setting_view_in_badge === true) {
@@ -134,6 +139,12 @@ function loadBlackList() {
134139
})
135140
}
136141

142+
function loadRestrictionList() {
143+
storage.getSettings(STORAGE_RESTRICTION_LIST, function (items) {
144+
setting_restriction_list = items;
145+
})
146+
}
147+
137148
loadTabs();
138149
loadBlackList();
139150
addListener();

style/block.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
body{
2+
padding: 150px;
3+
text-align: center;
4+
background-color: rgb(243, 243, 243)
5+
}
6+
7+
.title{
8+
font-size: 23px;
9+
font-weight: 600;
10+
}
11+
12+
.description{
13+
font-size: 15px;
14+
font-weight: 400;
15+
}
16+
17+
.current-site{
18+
font-weight: 500;
19+
}

0 commit comments

Comments
 (0)