@@ -9,6 +9,7 @@ let startingDateElement = document.getElementById('startingDate');
9
9
let endingDateElement = document . getElementById ( 'endingDate' ) ;
10
10
let showOpenLabelElement = document . getElementById ( 'showOpenLabel' ) ;
11
11
let userReasonElement = document . getElementById ( 'userReason' ) ;
12
+ let showCommitsElement = document . getElementById ( 'showCommits' ) ;
12
13
13
14
function handleBodyOnLoad ( ) {
14
15
chrome . storage . local . get (
@@ -24,6 +25,7 @@ function handleBodyOnLoad() {
24
25
'yesterdayContribution' ,
25
26
'cacheInput' ,
26
27
'githubToken' ,
28
+ 'showCommits' ,
27
29
] ,
28
30
( items ) => {
29
31
if ( items . githubUsername ) {
@@ -77,6 +79,12 @@ function handleBodyOnLoad() {
77
79
yesterdayContributionElement . checked = true ;
78
80
handleYesterdayContributionChange ( ) ;
79
81
}
82
+ if ( items . showCommits ) {
83
+ showCommitsElement . checked = items . showCommits ;
84
+ } else {
85
+ showCommitsElement . checked = false ;
86
+ handleShowCommitsChange ( ) ;
87
+ }
80
88
} ,
81
89
) ;
82
90
}
@@ -123,19 +131,19 @@ function handleLastWeekContributionChange() {
123
131
let value = lastWeekContributionElement . checked ;
124
132
let labelElement = document . querySelector ( "label[for='lastWeekContribution']" ) ;
125
133
if ( value ) {
126
- startingDateElement . readOnly = true ;
127
- endingDateElement . readOnly = true ;
128
- endingDateElement . value = getToday ( ) ;
129
- startingDateElement . value = getLastWeek ( ) ;
130
- handleEndingDateChange ( ) ;
131
- handleStartingDateChange ( ) ;
132
- labelElement . classList . add ( "selectedLabel" ) ;
133
- labelElement . classList . remove ( "unselectedLabel" ) ;
134
+ startingDateElement . readOnly = true ;
135
+ endingDateElement . readOnly = true ;
136
+ endingDateElement . value = getToday ( ) ;
137
+ startingDateElement . value = getLastWeek ( ) ;
138
+ handleEndingDateChange ( ) ;
139
+ handleStartingDateChange ( ) ;
140
+ labelElement . classList . add ( "selectedLabel" ) ;
141
+ labelElement . classList . remove ( "unselectedLabel" ) ;
134
142
} else {
135
- startingDateElement . readOnly = false ;
136
- endingDateElement . readOnly = false ;
137
- labelElement . classList . add ( "unselectedLabel" ) ;
138
- labelElement . classList . remove ( "selectedLabel" ) ;
143
+ startingDateElement . readOnly = false ;
144
+ endingDateElement . readOnly = false ;
145
+ labelElement . classList . add ( "unselectedLabel" ) ;
146
+ labelElement . classList . remove ( "selectedLabel" ) ;
139
147
}
140
148
141
149
chrome . storage . local . set ( { lastWeekContribution : value } ) ;
@@ -241,12 +249,19 @@ function handleUserReasonChange() {
241
249
let value = userReasonElement . value ;
242
250
chrome . storage . local . set ( { userReason : value } ) ;
243
251
}
252
+
253
+ function handleShowCommitsChange ( ) {
254
+ let value = showCommitsElement . checked ;
255
+ chrome . storage . local . set ( { showCommits : value } ) ;
256
+ }
257
+
244
258
enableToggleElement . addEventListener ( 'change' , handleEnableChange ) ;
245
259
githubUsernameElement . addEventListener ( 'keyup' , handleGithubUsernameChange ) ;
246
260
githubTokenElement . addEventListener ( 'keyup' , handleGithubTokenChange ) ;
247
261
cacheInputElement . addEventListener ( 'keyup' , handleCacheInputChange ) ;
248
262
projectNameElement . addEventListener ( 'keyup' , handleProjectNameChange ) ;
249
263
startingDateElement . addEventListener ( 'change' , handleStartingDateChange ) ;
264
+ showCommitsElement . addEventListener ( 'change' , handleShowCommitsChange ) ;
250
265
endingDateElement . addEventListener ( 'change' , handleEndingDateChange ) ;
251
266
lastWeekContributionElement . addEventListener ( 'change' , handleLastWeekContributionChange ) ;
252
267
yesterdayContributionElement . addEventListener ( 'change' , handleYesterdayContributionChange ) ;
0 commit comments