Skip to content

Commit 21d23a7

Browse files
committed
Add listbox for black list of site to settings
1 parent 6cf07c8 commit 21d23a7

File tree

6 files changed

+110
-6
lines changed

6 files changed

+110
-6
lines changed

icons/delete.png

753 Bytes
Loading

icons/information.png

-553 Bytes
Binary file not shown.

icons/information.svg

Lines changed: 44 additions & 0 deletions
Loading

options.html

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</label>
2828
<div class="margin-top-10">
2929
<label>Stop tracking if no activity detected for: </label>
30-
<div class="tooltip"><img src="/icons/information.png" />
30+
<div class="tooltip"><img src="/icons/information.svg" height="18"/>
3131
<span class="tooltiptext">An activity is an action with a mouse or keyboard</span>
3232
</div>
3333
<div class="margin-top-10">
@@ -57,7 +57,20 @@
5757
</select>
5858
</div>
5959
<div class="margin-top-10">
60-
<label>Data in memory use </label><label id='memoryUse'>test</label>
60+
<label>Ignored list of domain: </label>
61+
<div class="tooltip"><img src="/icons/information.svg" height="18"/>
62+
<span class="tooltiptext">Activity for these domains not will tracked</span>
63+
</div>
64+
<div class="margin-top-10">
65+
<ul id='blackList' class="listbox" size="7"></ul>
66+
</div>
67+
<div class="margin-top-10">
68+
<input type="text" id='addBlackSiteLbl'/>
69+
<input type="button" value="+" id='addBlackSiteBtn'/>
70+
</div>
71+
</div>
72+
<div class="margin-top-10">
73+
<label>Data in memory use </label><label id='memoryUse'></label>
6174
</div>
6275
<div class="margin-top-10"><input type="button" value="Clear all data" id='clearAllData'></div>
6376
<div class="notify" id='notify' hidden>

scripts/settings.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ document.addEventListener('DOMContentLoaded', function () {
1818
document.getElementById('clearAllData').addEventListener('click', function () {
1919
clearAllData();
2020
});
21+
document.getElementById('addBlackSiteBtn').addEventListener('click', function () {
22+
addNewBlackSite();
23+
});
2124
document.getElementById('viewTimeInBadge').addEventListener('change', function () {
2225
storage.saveSettings(SETTINGS_VIEW_TIME_IN_BADGE, this.checked);
2326
});
@@ -42,7 +45,7 @@ function loadSettings() {
4245
document.getElementById('viewTimeInBadge').setAttribute('checked', item);
4346
});
4447
storage.getMemoryUse(STORAGE_TABS, function (integer) {
45-
document.getElementById('memoryUse').innerHTML = (integer/1024).toFixed(2) + 'Kb';
48+
document.getElementById('memoryUse').innerHTML = (integer / 1024).toFixed(2) + 'Kb';
4649
})
4750
}
4851

@@ -55,4 +58,20 @@ function clearAllData() {
5558
function viewNotify() {
5659
document.getElementById('notify').hidden = false;
5760
setTimeout(function () { document.getElementById('notify').hidden = true; }, 3000);
61+
}
62+
63+
function addNewBlackSite() {
64+
var newBlackSite = document.getElementById('addBlackSiteLbl').value;
65+
if (newBlackSite !== '') {
66+
var count = document.getElementById('blackList').getElementsByTagName('li').length;
67+
var li = document.createElement('li');
68+
li.innerHTML = newBlackSite;
69+
li.value = count++;
70+
var del = document.createElement('img');
71+
del.height = 12;
72+
del.src = '/icons/delete.png';
73+
del.value = count++;
74+
document.getElementById('blackList').appendChild(li).appendChild(del);
75+
document.getElementById('addBlackSiteLbl').value = '';
76+
}
5877
}

style/settings.css

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ body {
55

66
.content {
77
width: 750px;
8-
margin: 50px auto;
8+
margin: 10px auto;
99
display: grid;
1010
grid-template-columns: 200px auto;
1111
grid-column-gap: 40px;
@@ -19,7 +19,7 @@ body {
1919

2020
.header{
2121
grid-area: h;
22-
margin: 0 0 50px;
22+
margin: 0 0 10px;
2323
font-size: 20px;
2424
}
2525

@@ -189,7 +189,7 @@ input[type="button"]:hover {
189189
margin-top: 20px;
190190
}
191191

192-
select {
192+
.option {
193193
min-width: 170px;
194194
color: #444;
195195
background: #fff;
@@ -249,4 +249,32 @@ select {
249249
font-size: 17px;
250250
white-space: nowrap;
251251
padding: 10px;
252+
}
253+
254+
.listbox{
255+
overflow-y: auto;
256+
width: 263px;
257+
height: 100px;
258+
padding: 3px;
259+
padding: 3px 5px 3px 5px;
260+
border: 1px solid rgb(172, 169, 169);
261+
}
262+
263+
.listbox img{
264+
float: right;
265+
cursor: pointer;
266+
}
267+
268+
#addBlackSiteLbl{
269+
width: 233px;
270+
height: 15px;
271+
padding: 3px;
272+
}
273+
274+
#addBlackSiteBtn{
275+
height: 24px !important;
276+
line-height: 20px !important;
277+
padding: 0 5px !important;
278+
min-width: 20px !important;
279+
width: 28px !important;
252280
}

0 commit comments

Comments
 (0)