File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -269,10 +269,29 @@ document.addEventListener('DOMContentLoaded', function () {
269
269
chrome . storage . local . get ( [
270
270
'selectedTimeframe' ,
271
271
'lastWeekContribution' ,
272
- 'yesterdayContribution'
272
+ 'yesterdayContribution' ,
273
+ 'startingDate' ,
274
+ 'endingDate' ,
273
275
] , ( items ) => {
274
276
console . log ( 'Restoring state:' , items ) ;
275
277
278
+ if ( items . startingDate && items . endingDate && ! items . lastWeekContribution && ! items . yesterdayContribution ) {
279
+ const startDateInput = document . getElementById ( 'startingDate' ) ;
280
+ const endDateInput = document . getElementById ( 'endingDate' ) ;
281
+
282
+ if ( startDateInput && endDateInput ) {
283
+ startDateInput . value = items . startingDate ;
284
+ endDateInput . value = items . endingDate ;
285
+ startDateInput . readOnly = false ;
286
+ endDateInput . readOnly = false ;
287
+ }
288
+ document . querySelectorAll ( 'input[name="timeframe"]' ) . forEach ( radio => {
289
+ radio . checked = false ;
290
+ radio . dataset . wasChecked = 'false' ;
291
+ } )
292
+ return ;
293
+ }
294
+
276
295
if ( ! items . selectedTimeframe ) {
277
296
items . selectedTimeframe = 'yesterdayContribution' ;
278
297
items . lastWeekContribution = false ;
@@ -597,4 +616,4 @@ if (cacheInput) {
597
616
} ) ;
598
617
} ) ;
599
618
600
- }
619
+ }
Original file line number Diff line number Diff line change @@ -122,11 +122,11 @@ function allIncluded(outputTarget = 'email') {
122
122
handleLastWeekContributionChange ( ) ;
123
123
} else if ( items . yesterdayContribution ) {
124
124
handleYesterdayContributionChange ( ) ;
125
- } else if ( items . startDate && items . endingDate ) {
125
+ } else if ( items . startingDate && items . endingDate ) {
126
126
startingDate = items . startingDate ;
127
127
endingDate = items . endingDate ;
128
128
} else {
129
- handleLastWeekContributionChange ( ) ; //when no date is stored, i.e on fresh unpack - default to last week.
129
+ handleLastWeekContributionChange ( ) ; //when no date is stored i.e on fresh unpack - default to last week.
130
130
if ( outputTarget === 'popup' ) {
131
131
chrome . storage . local . set ( { lastWeekContribution : true , yesterdayContribution : false } ) ;
132
132
}
You can’t perform that action at this time.
0 commit comments