Skip to content

Commit 94603a1

Browse files
hai-altx-softStigmatoz
authored andcommitted
Fix view settings and save restrictions time with new format
1 parent dfec726 commit 94603a1

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

options.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</div>
1919
<div id='nav' class="nav">
2020
<a id='settingsBtn' class="active">Settings</a>
21-
<a id='restrictionsBtn'>Restrictions</a>
21+
<a id='restrictionsBtn'>Limits</a>
2222
<a id='aboutBtn'>About</a>
2323
</div>
2424
<div id='block'>

scripts/common.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ function isEmpty(obj) {
5252
return JSON.stringify(obj) === JSON.stringify({});
5353
}
5454

55+
function convertTimeToSummaryTime(time) {
56+
var timeValue = time.split(':');
57+
var hour = timeValue[0];
58+
var min = timeValue[1];
59+
var resultTimeValue;
60+
if (hour > 0)
61+
resultTimeValue = hour * 60 * 3600;
62+
resultTimeValue += min * 60;
63+
64+
return resultTimeValue;
65+
}
66+
5567
function convertSummaryTimeToBadgeString(summaryTime) {
5668
var sec = (summaryTime);
5769
var min = (summaryTime / 60).toFixed(0);
@@ -69,7 +81,7 @@ function convertSummaryTimeToBadgeString(summaryTime) {
6981
}
7082
}
7183

72-
function convertShortSummaryTimeToString(summaryTime){
84+
function convertShortSummaryTimeToString(summaryTime) {
7385
var hours = Math.floor(summaryTime / (3600 * 60));
7486
var totalSeconds = summaryTime % 3600;
7587
var mins = Math.floor(totalSeconds / 60);
@@ -111,15 +123,15 @@ function isDateInRange(dateStr, range) {
111123
return date >= from && date <= to;
112124
}
113125

114-
function getValueFromArrayRange(value){
126+
function getValueFromArrayRange(value) {
115127
var arr;
116-
if (value.indexOf('.') !== -1){
128+
if (value.indexOf('.') !== -1) {
117129
arr = value.split('.');
118130
return new Date(arr[2], arr[1] - 1, arr[0]);
119131
}
120132
if (value.indexOf('/') !== -1)
121133
arr = value.split('/');
122-
return new Date(arr[2], arr[0] - 1, arr[1]);
134+
return new Date(arr[2], arr[0] - 1, arr[1]);
123135
}
124136

125137
function convertToDate(date) {

scripts/restriction.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
class Restriction {
44
constructor(domain, time) {
55
this.domain = domain;
6-
var timeValue = time.split(':');
7-
var hour = timeValue[0];
8-
var min = timeValue[1];
9-
var resultTimeValue;
10-
if (hour > 0)
11-
resultTimeValue = hour * 60 * 3600;
12-
resultTimeValue += min * 60;
13-
this.time = resultTimeValue;
6+
this.time = convertTimeToSummaryTime(time);
147
}
158
};

scripts/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ function isContainsBlackSite(domain) {
255255
}
256256

257257
function updateItemFromResctrictoinList(domain, time) {
258-
restrictionList.find(x => x.domain === domain).time = time;
258+
restrictionList.find(x => x.domain === domain).time = convertTimeToSummaryTime(time);
259259
}
260260

261261
function updateBlackList() {

style/settings.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,4 +318,8 @@ input[type="button"]:hover {
318318

319319
.restriction-item{
320320
width: 380px;
321+
}
322+
323+
.notify.warning{
324+
background-color: rgb(219, 93, 104);
321325
}

0 commit comments

Comments
 (0)