@@ -56,32 +56,64 @@ function toggleRadio(radio){
56
56
const startDateInput = document . getElementById ( 'startingDate' ) ;
57
57
const endDateInput = document . getElementById ( 'endingDate' ) ;
58
58
59
-
60
59
if ( radio . id === 'lastWeekContribution' ) {
61
60
startDateInput . value = getLastWeek ( ) ;
62
61
endDateInput . value = getToday ( ) ;
62
+ chrome . storage . local . set ( {
63
+ startingDate : startDateInput . value ,
64
+ endingDate : endDateInput . value ,
65
+ lastWeekContribution : true ,
66
+ yesterday : false
67
+ } , ( ) => {
68
+ window . generateScrumReport ( ) ;
69
+ } ) ;
63
70
} else {
64
71
startDateInput . value = getYesterday ( ) ;
65
72
endDateInput . value = getToday ( ) ;
73
+ chrome . storage . local . set ( {
74
+ startingDate : startDateInput . value ,
75
+ endingDate : endDateInput . value ,
76
+ lastWeekContribution : false ,
77
+ yesterday : true
78
+ } , ( ) => {
79
+ window . generateScrumReport ( ) ;
80
+ } ) ;
66
81
}
67
82
startDateInput . disabled = endDateInput . disabled = true ;
68
83
}
69
84
document . getElementById ( 'customDateContainer' ) . addEventListener ( 'click' , ( ) => {
70
85
document . querySelectorAll ( 'input[name="timeframe"]' ) . forEach ( radio => radio . checked = false ) ;
71
86
document . getElementById ( 'startingDate' ) . disabled = false ;
72
87
document . getElementById ( 'endingDate' ) . disabled = false ;
88
+ chrome . storage . local . set ( {
89
+ lastWeekContribution : false ,
90
+ yesterday : false
91
+ } ) ;
92
+ } ) ;
93
+
94
+ document . getElementById ( 'startingDate' ) . addEventListener ( 'change' , function ( ) {
95
+ chrome . storage . local . set ( {
96
+ startingDate : this . value ,
97
+ lastWeekContribution : false ,
98
+ yesterday : false
99
+ } , ( ) => {
100
+ if ( document . getElementById ( 'endingDate' ) . value ) {
101
+ window . generateScrumReport ( ) ;
102
+ }
103
+ } ) ;
104
+ } ) ;
105
+
106
+ document . getElementById ( 'endingDate' ) . addEventListener ( 'change' , function ( ) {
107
+ chrome . storage . local . set ( {
108
+ endingDate : this . value ,
109
+ lastWeekContribution : false ,
110
+ yesterday : false
111
+ } , ( ) => {
112
+ if ( document . getElementById ( 'startingDate' ) . value ) {
113
+ window . generateScrumReport ( ) ;
114
+ }
115
+ } ) ;
73
116
} ) ;
74
- // Not working properly
75
- // document.getElementById('startingDate').addEventListener('focus', () => {
76
- // document.querySelectorAll('input[name="timeframe"]').forEach(radio => radio.checked = false);
77
- // document.getElementById('startingDate').disabled = false;
78
- // document.getElementById('endingDate').disabled = false;
79
- // });
80
- // document.getElementById('endingDate').addEventListener('focus', () => {
81
- // document.querySelectorAll('input[name="timeframe"]').forEach(radio => radio.checked = false);
82
- // document.getElementById('startingDate').disabled = false;
83
- // document.getElementById('endingDate').disabled = false;
84
- // });
85
117
86
118
document . addEventListener ( 'DOMContentLoaded' , function ( ) {
87
119
const darkModeToggle = document . querySelector ( 'img[alt="Night Mode"]' ) ;
0 commit comments