File tree Expand file tree Collapse file tree 7 files changed +45
-10
lines changed
Expand file tree Collapse file tree 7 files changed +45
-10
lines changed Original file line number Diff line number Diff line change 5757 </ select >
5858 </ div >
5959 < div class ="margin-top-10 "> < input type ="button " value ="Clear all data " id ='clearAllData '> </ div >
60+ < div class ="notify " id ='notify ' hidden >
61+ Data succeed deleted
62+ </ div >
6063 </ div >
6164 </ div >
6265 < div id ='aboutBlock ' hidden >
Original file line number Diff line number Diff line change @@ -14,8 +14,7 @@ function updateSummaryTime() {
1414}
1515
1616function updateStorage ( ) {
17- storage . getSettings ( SETTINGS_INTERVAL_SAVE_STORAGE , function ( item ) { setting_interval_save = item ; } ) ;
18- setInterval ( backgroundUpdateStorage , setting_interval_save ) ;
17+ setInterval ( backgroundUpdateStorage , SETTINGS_INTERVAL_SAVE_STORAGE_DEFAULT ) ;
1918}
2019
2120function backgroundCheck ( ) {
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ function donutChart() {
1616
1717 // ===========================================================================================
1818 // Set up constructors for making donut. See https://github.com/d3/d3-shape/blob/master/README.md
19- var radius = 120 ;
19+ var radius = 135 ;
2020
2121 // creates a new pie generator
2222 var pie = d3 . pie ( )
@@ -49,7 +49,7 @@ function donutChart() {
4949 . attr ( 'height' , height + margin . top + margin . bottom )
5050 . attr ( 'class' , 'backColorChart' )
5151 . append ( 'g' )
52- . attr ( 'transform' , 'translate(' + ( width / 2 - 100 ) + ',' + ( height / 2 ) + ')' ) ;
52+ . attr ( 'transform' , 'translate(' + ( width / 2 - 100 ) + ',' + ( height / 2 + 10 ) + ')' ) ;
5353 // ===========================================================================================
5454
5555 // ===========================================================================================
@@ -74,7 +74,7 @@ function donutChart() {
7474 . data ( pie ( data ) )
7575 . enter ( ) . append ( "g" )
7676 . attr ( "transform" , function ( d , i ) {
77- return "translate(" + ( 120 ) + "," + ( i * 20 - 30 ) + ")" ; // place each legend on the right and bump each one down 15 pixels
77+ return "translate(" + ( 130 ) + "," + ( i * 20 - 30 ) + ")" ; // place each legend on the right and bump each one down 15 pixels
7878 } )
7979 . attr ( "class" , "legend" ) ;
8080
Original file line number Diff line number Diff line change @@ -47,5 +47,12 @@ function loadSettings(){
4747}
4848
4949function clearAllData ( ) {
50- storage . saveTabs ( null ) ;
50+ var tabs = [ ] ;
51+ chrome . extension . getBackgroundPage ( ) . tabs = tabs ;
52+ storage . saveTabs ( tabs , viewNotify ) ;
53+ }
54+
55+ function viewNotify ( ) {
56+ document . getElementById ( 'notify' ) . hidden = false ;
57+ setTimeout ( function ( ) { document . getElementById ( 'notify' ) . hidden = true ; } , 3000 ) ;
5158}
Original file line number Diff line number Diff line change @@ -4,15 +4,17 @@ class LocalStorage {
44 loadTabs ( name , callback ) {
55 chrome . storage . local . get ( name , function ( item ) {
66 if ( item [ name ] !== undefined ) {
7- var result = JSON . parse ( item [ name ] ) ;
7+ var result = item [ name ] ;
88 if ( result !== undefined )
99 callback ( result ) ;
1010 }
1111 } ) ;
1212 }
1313
14- saveTabs ( value ) {
15- chrome . storage . local . set ( { tabs : JSON . stringify ( value ) } ) ;
14+ saveTabs ( value , callback ) {
15+ chrome . storage . local . set ( { tabs : value } ) ;
16+ if ( callback !== undefined )
17+ callback ( ) ;
1618 }
1719
1820 saveSettings ( name , value ) {
Original file line number Diff line number Diff line change @@ -65,7 +65,13 @@ function getTabsFromStorage(tabs) {
6565 return b . summaryTime - a . summaryTime ;
6666 } ) ;
6767
68- totalTime = getTotalTime ( targetTabs ) ;
68+ if ( targetTabs . length > 0 ) {
69+ totalTime = getTotalTime ( targetTabs ) ;
70+ }
71+ else {
72+ ui . fillEmptyBlock ( 'chart' ) ;
73+ return ;
74+ }
6975 }
7076 if ( currentTypeOfList === TypeListEnum . ToDay ) {
7177 targetTabs = tabs . filter ( x => x . days . find ( s => s . date === today ) ) ;
Original file line number Diff line number Diff line change @@ -231,4 +231,22 @@ select {
231231 .tooltip : hover .tooltiptext {
232232 visibility : visible;
233233 opacity : 1 ;
234+ }
235+
236+ .notify {
237+ width : 200px ;
238+ height : 30px ;
239+ margin : auto;
240+ background-color : rgb (118 , 219 , 93 );
241+ color : rgb (0 , 0 , 0 );
242+ text-align : center;
243+ font-weight : 600 ;
244+ border-radius : 5px ;
245+ position : fixed;
246+ z-index : 1 ;
247+ top : 10px ;
248+ right : 20px ;
249+ font-size : 17px ;
250+ white-space : nowrap;
251+ padding : 10px ;
234252 }
You can’t perform that action at this time.
0 commit comments