File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ class Activity {
77 tabs = tabs || [ ] ;
88 var domain = this . extractHostname ( tab . url ) ;
99 this . setCurrentActiveTab ( domain ) ;
10- if ( this . isNewUrl ( domain ) ) {
10+ if ( this . isNewUrl ( domain ) && ! this . isInBlackList ( domain ) ) {
1111 var favicon = tab . favIconUrl ;
1212 if ( favicon === undefined ) {
1313 favicon = 'chrome://favicon/' + domain ;
@@ -28,6 +28,12 @@ class Activity {
2828 return true ;
2929 }
3030
31+ isInBlackList ( domain ) {
32+ if ( setting_black_list !== undefined && setting_black_list . length > 0 )
33+ return setting_black_list . find ( o => o === domain ) !== undefined ;
34+ else return false ;
35+ }
36+
3137 isNewUrl ( domain ) {
3238 if ( tabs . length > 0 )
3339 return tabs . find ( o => o . url === domain ) === undefined ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ var currentTab;
55var activity = new Activity ( ) ;
66var storage = new LocalStorage ( ) ;
77
8+ var setting_black_list ;
89var setting_interval_save ;
910var setting_interval_inactivity ;
1011var setting_view_in_badge ;
@@ -34,7 +35,10 @@ function backgroundCheck() {
3435 activity . setCurrentActiveTab ( tab . url ) ;
3536 chrome . idle . queryState ( parseInt ( setting_interval_inactivity ) , function ( state ) {
3637 if ( state === 'active' ) {
37- tab . incSummaryTime ( ) ;
38+ if ( ! activity . isInBlackList ( activeUrl ) )
39+ tab . incSummaryTime ( ) ;
40+ //todo: сделать, чтобы, если страница в черном списке,
41+ //то показываем крестик на badge text
3842 if ( setting_view_in_badge === true ) {
3943 var today = new Date ( ) . toLocaleDateString ( ) ;
4044 var summary = tab . days . find ( s => s . date === today ) . summary ;
@@ -107,7 +111,14 @@ function loadTabs() {
107111 } ) ;
108112}
109113
114+ function loadBlackList ( ) {
115+ storage . getSettings ( STORAGE_BLACK_LIST , function ( items ) {
116+ setting_black_list = items ;
117+ } )
118+ }
119+
110120loadTabs ( ) ;
121+ loadBlackList ( ) ;
111122addListener ( ) ;
112123updateSummaryTime ( ) ;
113124updateStorage ( ) ;
You can’t perform that action at this time.
0 commit comments