Skip to content

Commit 6240a0d

Browse files
committed
Add warning notify for black and restriction list
1 parent 3ef8475 commit 6240a0d

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

options.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
<input type="text" placeholder="Enter site name..." id='addBlackSiteLbl' />
7171
<input type="button" value="+" id='addBlackSiteBtn' />
7272
</div>
73+
<div class="notify warning" id='notifyForBlackList' hidden>
74+
The site is already in the list
75+
</div>
7376
</div>
7477
<div class="margin-top-10">
7578
<label>Data in memory use </label><label id='memoryUse'></label>
@@ -93,6 +96,9 @@
9396
<input type="time" id='addRestrictionTimeLbl' />
9497
<input type="button" value="+" id='addRestrictionSiteBtn' />
9598
</div>
99+
<div class="notify warning" id='notifyForRestrictionList' hidden>
100+
The site is already in the list
101+
</div>
96102
</div>
97103
<div id='aboutBlock' hidden>
98104
<div><label id='version'></label></div>

scripts/settings.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,16 @@ function viewRestrictionList(items) {
9999
function clearAllData() {
100100
var tabs = [];
101101
chrome.extension.getBackgroundPage().tabs = tabs;
102-
storage.saveTabs(tabs, viewNotify);
102+
storage.saveTabs(tabs, allDataDeletedSuccess);
103103
}
104104

105-
function viewNotify() {
106-
document.getElementById('notify').hidden = false;
107-
setTimeout(function () { document.getElementById('notify').hidden = true; }, 3000);
105+
function allDataDeletedSuccess(){
106+
viewNotify('notify');
107+
}
108+
109+
function viewNotify(elementName) {
110+
document.getElementById(elementName).hidden = false;
111+
setTimeout(function () { document.getElementById(elementName).hidden = true; }, 3000);
108112
}
109113

110114
function addNewBlackSiteClickHandler() {
@@ -118,7 +122,7 @@ function addNewBlackSiteClickHandler() {
118122
document.getElementById('addBlackSiteLbl').value = '';
119123

120124
updateBlackList();
121-
}
125+
} else viewNotify('notifyForBlackList');
122126
}
123127
}
124128

@@ -136,6 +140,7 @@ function addNewRestrictionSiteClickHandler() {
136140

137141
updateRestrictionList();
138142
}
143+
else viewNotify('notifyForRestrictionList');
139144
}
140145
}
141146

style/settings.css

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ input[type="button"]:hover {
242242
}
243243

244244
.notify{
245-
width: 200px;
246-
height: 30px;
245+
width: 250px;
246+
height: 22px;
247247
margin: auto;
248248
background-color: rgb(118, 219, 93);
249249
color: rgb(0, 0, 0);
@@ -254,11 +254,15 @@ input[type="button"]:hover {
254254
z-index: 1;
255255
top: 10px;
256256
right: 20px;
257-
font-size: 17px;
257+
font-size: 15px;
258258
white-space: nowrap;
259259
padding: 10px;
260260
}
261261

262+
.notify.warning{
263+
background-color: rgb(219, 93, 104);
264+
}
265+
262266
.listbox{
263267
overflow-y: auto;
264268
width: 263px;

0 commit comments

Comments
 (0)