@@ -256,8 +256,8 @@ document.addEventListener('DOMContentLoaded', function () {
256
256
257
257
const startDateInput = document . getElementById ( 'startingDate' ) ;
258
258
const endDateInput = document . getElementById ( 'endingDate' ) ;
259
- startDateInput . disabled = false ;
260
- endDateInput . disabled = false ;
259
+ startDateInput . readOnly = false ;
260
+ endDateInput . readOnly = false ;
261
261
262
262
chrome . storage . local . set ( {
263
263
lastWeekContribution : false ,
@@ -294,9 +294,8 @@ document.addEventListener('DOMContentLoaded', function () {
294
294
startDateInput . value = getYesterday ( ) ;
295
295
endDateInput . value = getToday ( ) ;
296
296
}
297
-
298
- startDateInput . disabled = endDateInput . disabled = true ;
299
-
297
+ startDateInput . readOnly = endDateInput . readOnly = true ;
298
+
300
299
chrome . storage . local . set ( {
301
300
startingDate : startDateInput . value ,
302
301
endingDate : endDateInput . value ,
@@ -369,11 +368,9 @@ document.addEventListener('DOMContentLoaded', function () {
369
368
. then ( res => {
370
369
console . log ( '[Org Check] Response status for' , org , ':' , res . status ) ;
371
370
if ( res . status === 404 ) {
372
- console . log ( '[Org Check] Organisation not found on GitHub:' , org ) ;
373
- // Remove any existing toast with the same id
371
+ console . log ( '[Org Check] Organization not found on GitHub:' , org ) ;
374
372
const oldToast = document . getElementById ( 'invalid-org-toast' ) ;
375
373
if ( oldToast ) oldToast . parentNode . removeChild ( oldToast ) ;
376
- // Create a new toast div
377
374
const toastDiv = document . createElement ( 'div' ) ;
378
375
toastDiv . id = 'invalid-org-toast' ;
379
376
toastDiv . className = 'toast' ;
@@ -387,32 +384,30 @@ document.addEventListener('DOMContentLoaded', function () {
387
384
toastDiv . style . left = '50%' ;
388
385
toastDiv . style . transform = 'translateX(-50%)' ;
389
386
toastDiv . style . zIndex = '9999' ;
390
- toastDiv . innerText = 'Organisation not found on GitHub.' ;
387
+ toastDiv . innerText = 'Organization not found on GitHub.' ;
391
388
document . body . appendChild ( toastDiv ) ;
392
389
setTimeout ( ( ) => {
393
390
if ( toastDiv . parentNode ) toastDiv . parentNode . removeChild ( toastDiv ) ;
394
391
} , 3000 ) ;
395
- // Do NOT update storage or fetch data for invalid org
396
392
return ;
397
393
}
398
- // Remove any existing toast with the same id (for valid orgs)
399
394
const oldToast = document . getElementById ( 'invalid-org-toast' ) ;
400
395
if ( oldToast ) oldToast . parentNode . removeChild ( oldToast ) ;
401
396
console . log ( '[Org Check] Organisation exists on GitHub:' , org ) ;
397
+
402
398
// Valid org: update storage and fetch data
403
399
chrome . storage . local . set ( { orgName : org , githubCache : null } , function ( ) {
404
400
const scrumReport = document . getElementById ( 'scrumReport' ) ;
405
401
if ( scrumReport ) {
406
402
scrumReport . innerHTML = '<p style="text-align: center; color: #666; padding: 20px;">Organisation changed. Click "Generate Report" to fetch new data.</p>' ;
407
403
}
404
+
408
405
} ) ;
409
406
} )
410
407
. catch ( ( err ) => {
411
408
console . log ( '[Org Check] Error validating organisation:' , org , err ) ;
412
- // Remove any existing toast with the same id
413
409
const oldToast = document . getElementById ( 'invalid-org-toast' ) ;
414
410
if ( oldToast ) oldToast . parentNode . removeChild ( oldToast ) ;
415
- // Create a new toast div
416
411
const toastDiv = document . createElement ( 'div' ) ;
417
412
toastDiv . id = 'invalid-org-toast' ;
418
413
toastDiv . className = 'toast' ;
@@ -426,12 +421,11 @@ document.addEventListener('DOMContentLoaded', function () {
426
421
toastDiv . style . left = '50%' ;
427
422
toastDiv . style . transform = 'translateX(-50%)' ;
428
423
toastDiv . style . zIndex = '9999' ;
429
- toastDiv . innerText = 'Error validating organisation .' ;
424
+ toastDiv . innerText = 'Error validating organization .' ;
430
425
document . body . appendChild ( toastDiv ) ;
431
426
setTimeout ( ( ) => {
432
427
if ( toastDiv . parentNode ) toastDiv . parentNode . removeChild ( toastDiv ) ;
433
428
} , 3000 ) ;
434
- // Do NOT update storage or fetch data for invalid org
435
429
} ) ;
436
430
} , 2500 ) ;
437
431
@@ -488,8 +482,8 @@ document.querySelectorAll('input[name="timeframe"]').forEach(radio => {
488
482
489
483
const startDateInput = document . getElementById ( 'startingDate' ) ;
490
484
const endDateInput = document . getElementById ( 'endingDate' ) ;
491
- startDateInput . disabled = false ;
492
- endDateInput . disabled = false ;
485
+ startDateInput . readOnly = false ;
486
+ endDateInput . readOnly = false ;
493
487
494
488
chrome . storage . local . set ( {
495
489
lastWeekContribution : false ,
@@ -561,7 +555,7 @@ function toggleRadio(radio) {
561
555
endDateInput . value = getToday ( ) ;
562
556
}
563
557
564
- startDateInput . disabled = endDateInput . disabled = true ;
558
+ startDateInput . readOnly = endDateInput . readOnly = true ;
565
559
566
560
chrome . storage . local . set ( {
567
561
startingDate : startDateInput . value ,
@@ -579,7 +573,7 @@ function toggleRadio(radio) {
579
573
} ) ;
580
574
}
581
575
582
- const cacheInput = document . getElementById ( 'cacheInput' ) ;
576
+ let cacheInput = document . getElementById ( 'cacheInput' ) ;
583
577
if ( cacheInput ) {
584
578
chrome . storage . local . get ( [ 'cacheInput' ] , function ( result ) {
585
579
if ( result . cacheInput ) {
0 commit comments