Skip to content

Commit e716571

Browse files
hai-altx-softStigmatoz
authored andcommitted
Add new icon for edit + add time to list for restrictions
1 parent 095d4ef commit e716571

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

icons/edit.png

1.64 KB
Loading

scripts/settings.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,14 @@ function addNewBlackSiteClickHandler() {
109109

110110
function addNewRestrictionSiteClickHandler(){
111111
var newRestrictionSite = document.getElementById('addRestrictionSiteLbl').value;
112-
if (newRestrictionSite !== '') {
113-
addDomainToRestrictionListBox(newRestrictionSite);
112+
var newRestrictionTime = document.getElementById('addRestrictionTimeLbl').value;
113+
if (newRestrictionSite !== '' && newRestrictionTime !== '') {
114+
addDomainToRestrictionListBox(newRestrictionSite, newRestrictionTime);
114115
if (restrictionList === undefined)
115116
restrictionList = [];
116117
restrictionList.push(newRestrictionSite);
117118
document.getElementById('addRestrictionSiteLbl').value = '';
119+
document.getElementById('addRestrictionTimeLbl').value = '';
118120
}
119121
updateRestrictionList();
120122
}
@@ -131,24 +133,30 @@ function addDomainToListBox(domain) {
131133
document.getElementById('blackList').appendChild(li).appendChild(del);
132134
}
133135

134-
function addDomainToRestrictionListBox(domain) {
136+
function addDomainToRestrictionListBox(domain, time) {
135137
var li = document.createElement('li');
136138
li.innerText = domain;
137139
var edit = document.createElement('img');
138-
edit.height = 12;
139-
edit.src = '/icons/delete.png';
140+
edit.height = 14;
141+
edit.src = '/icons/edit.png';
140142
edit.addEventListener('click', function (e) {
141143
editRestrictionSite(e);
142144
});
143145
var del = document.createElement('img');
144146
del.height = 12;
145147
del.src = '/icons/delete.png';
148+
del.classList.add('margin-left-5');
146149
del.addEventListener('click', function (e) {
147150
deleteRestrictionSite(e);
148151
});
152+
var timeElement = document.createElement('div');
153+
var timeArray = time.split(':');
154+
var resultTime = timeArray[0] + 'h ' + timeArray[1] + 'm';
155+
timeElement.innerText = resultTime;
149156
var li = document.getElementById('restrictionsList').appendChild(li);
150157
li.appendChild(del);
151158
li.appendChild(edit);
159+
li.appendChild(timeElement);
152160
}
153161

154162
function deleteBlackSite(e) {

style/settings.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,18 @@ input[type="button"]:hover {
181181
text-decoration: none;
182182
}
183183

184-
.margin-top-10{
184+
.margin-top-10{
185185
margin-top: 10px;
186186
}
187187

188-
.margin-top-20{
188+
.margin-top-20{
189189
margin-top: 20px;
190190
}
191191

192+
.margin-left-5{
193+
margin-left: 5px;
194+
}
195+
192196
.option {
193197
min-width: 170px;
194198
color: #444;

0 commit comments

Comments
 (0)