File tree Expand file tree Collapse file tree 5 files changed +53
-18
lines changed
Expand file tree Collapse file tree 5 files changed +53
-18
lines changed Original file line number Diff line number Diff line change 55 < meta charset ="utf-8 ">
66 < title > Access to the site is limited</ title >
77 < link href ="style/block.css " rel ="stylesheet " />
8+ < script src ="scripts/storage.js "> </ script >
9+ < script src ="scripts/common.js "> </ script >
810 < script src ="scripts/block.js "> </ script >
911</ head >
1012
1113< body >
12- < div class =" content " >
14+ < div >
1315 < img src ="icons/time.svg " height ="50 ">
1416 < p class ="title "> Time limit</ p >
1517 < div class ="description "> You've reached today your limit on < span id ='site ' class ="current-site "> </ span > </ div >
18+ < div class ="description margin-top-10 "> Your current daily limit is < span id ='limit ' class ="current-limit "> </ span > </ div >
1619 </ div >
20+ < p class ="product-title "> Web Activity Time Tracker</ p >
1721</ body >
1822
1923</ html >
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class Activity {
3636
3737 isLimitExceeded ( domain , tab ) {
3838 if ( setting_restriction_list !== undefined && setting_restriction_list . length > 0 ) {
39- var item = setting_restriction_list . find ( o => this . isDomainEquals ( o . domain , domain ) ) ;
39+ var item = setting_restriction_list . find ( o => isDomainEquals ( o . domain , domain ) ) ;
4040 if ( item !== undefined ) {
4141 var today = new Date ( ) . toLocaleDateString ( ) ;
4242 var data = tab . days . find ( x => x . date == today ) ;
@@ -51,22 +51,6 @@ class Activity {
5151 return false ;
5252 }
5353
54- isDomainEquals ( first , second ) {
55- if ( first === second )
56- return true ;
57- else {
58- var resultUrl = function ( url ) {
59- if ( url . indexOf ( 'www.' ) > - 1 )
60- return url . split ( 'www.' ) [ 1 ] ;
61- return url ;
62- } ;
63-
64- if ( resultUrl ( first ) === resultUrl ( second ) )
65- return true ;
66- else return false ;
67- }
68- }
69-
7054 isNewUrl ( domain ) {
7155 if ( tabs . length > 0 )
7256 return tabs . find ( o => o . url === domain ) === undefined ;
Original file line number Diff line number Diff line change 1+ var storage = new LocalStorage ( ) ;
2+ var restrictionList = [ ] ;
3+
14document . addEventListener ( 'DOMContentLoaded' , function ( ) {
25 var url = new URL ( document . URL ) ;
36 var blockSiteUrl = url . searchParams . get ( "url" ) ;
47 document . getElementById ( 'site' ) . innerText = blockSiteUrl ;
8+
9+ storage . getSettings ( STORAGE_RESTRICTION_LIST , function ( items ) {
10+ restrictionList = items ;
11+ if ( restrictionList === undefined )
12+ restrictionList = [ ] ;
13+ var currentItem = restrictionList . find ( x => isDomainEquals ( x . domain , blockSiteUrl ) ) ;
14+ if ( currentItem !== undefined ) {
15+ document . getElementById ( 'limit' ) . innerText = convertShortSummaryTimeToString ( currentItem . time ) ;
16+ }
17+ } ) ;
518} ) ;
Original file line number Diff line number Diff line change @@ -152,3 +152,19 @@ function getDateFromRange(range) {
152152 case 'month3' : return 90 ;
153153 }
154154}
155+
156+ function isDomainEquals ( first , second ) {
157+ if ( first === second )
158+ return true ;
159+ else {
160+ var resultUrl = function ( url ) {
161+ if ( url . indexOf ( 'www.' ) > - 1 )
162+ return url . split ( 'www.' ) [ 1 ] ;
163+ return url ;
164+ } ;
165+
166+ if ( resultUrl ( first ) === resultUrl ( second ) )
167+ return true ;
168+ else return false ;
169+ }
170+ }
Original file line number Diff line number Diff line change 1515}
1616
1717.current-site {
18+ font-size : 18px ;
1819 font-weight : 500 ;
1920 color : rgb (202 , 48 , 48 );
21+ }
22+
23+ .current-limit {
24+ font-weight : 500 ;
25+ color : rgb (128 , 128 , 128 );
26+ }
27+
28+ .margin-top-10 {
29+ margin-top : 10px ;
30+ }
31+
32+ .product-title {
33+ font-size : 16px ;
34+ color : rgb (128 , 128 , 128 );
35+ position : absolute;
36+ bottom : 30px ;
37+ right : 30px ;
2038}
You can’t perform that action at this time.
0 commit comments