1
- console . log ( "Script loaded" , new Date ( ) . toISOString ( ) ) ;
2
1
console . log ( 'Script loaded, adapter exists:' , ! ! window . emailClientAdapter ) ;
3
2
let refreshButton_Placed = false ;
4
3
let enableToggle = true ;
@@ -410,13 +409,6 @@ function allIncluded(outputTarget = 'email') {
410
409
reviewedPrsArray = [ ] ;
411
410
githubPrsReviewDataProccessed = { } ;
412
411
413
- log ( 'Writing issues from process' )
414
- writeGithubIssuesPrs ( ) ;
415
- log ( 'Writing prs from process' )
416
- writeGithubPrsReviews ( ) ;
417
- log ( 'Writing body from process' )
418
- writeScrumBody ( ) ;
419
-
420
412
// Update subject
421
413
if ( ! githubCache . subject && scrumSubject ) {
422
414
scrumSubjectLoaded ( ) ;
@@ -431,7 +423,7 @@ function allIncluded(outputTarget = 'email') {
431
423
432
424
//load initial text in scrum body
433
425
function writeScrumBody ( ) {
434
- if ( ! enableToggle || ( outputTarget === 'email' && hasInjectedContent ) ) return ;
426
+ if ( ! enableToggle || hasInjectedContent ) return ;
435
427
436
428
if ( outputTarget === 'email' ) {
437
429
if ( ! window . emailClientAdapter ) {
@@ -461,22 +453,22 @@ function allIncluded(outputTarget = 'email') {
461
453
462
454
// Create the complete content
463
455
let content ;
464
- if ( lastWeekContribution == true ) {
465
- content = `<b>1. What did I do ${ weekOrDay } ?</b><br>
466
- ${ lastWeekUl } <br>
467
- <b>2. What do I plan to do ${ weekOrDay2 } ?</b><br >
468
- ${ nextWeekUl } <br>
469
- <b>3. What is stopping me from doing my work?</b><br >
470
- ${ userReason } ` ;
471
- } else {
472
- content = `<b>1. What did I do from ${ formatDate ( startingDate ) } to ${ formatDate ( endingDate ) } ?</b><br >
473
- ${ lastWeekUl } <br>
474
- <b>2. What do I plan to do ${ weekOrDay2 } ?</b><br >
475
- ${ nextWeekUl } <br>
476
- <b>3. What is stopping me from doing my work?</b><br >
477
- ${ userReason } ` ;
478
- }
479
-
456
+ if ( lastWeekContribution == true ) {
457
+ content = `<b>1. What did I do ${ weekOrDay } ?</b>
458
+ <br> ${ lastWeekUl } <br> <br>
459
+ <b>2. What I plan to do ${ weekOrDay2 } ?</b>
460
+ <br> ${ nextWeekUl } <br> <br>
461
+ <b>3. What is stopping me from doing my work?</b>
462
+ <p> ${ userReason } </p> ` ;
463
+ } else {
464
+ content = `<b>1. What did I do from ${ formatDate ( startingDate ) } to ${ formatDate ( endingDate ) } ?</b>
465
+ <br> ${ lastWeekUl } <br> <br>
466
+ <b>2. What I plan to do ${ weekOrDay2 } ?</b>
467
+ <br> ${ nextWeekUl } <br> <br>
468
+ <b>3. What is stopping me from doing my work?</b>
469
+ <p> ${ userReason } </p> ` ;
470
+ }
471
+
480
472
481
473
if ( outputTarget === 'popup' ) {
482
474
const scrumReport = document . getElementById ( 'scrumReport' ) ;
@@ -501,43 +493,43 @@ function allIncluded(outputTarget = 'email') {
501
493
return ;
502
494
}
503
495
window . emailClientAdapter . injectContent ( elements . body , content , elements . eventTypes . contentChange ) ;
496
+ hasInjectedContent = true ;
504
497
}
505
- hasInjectedContent = true ;
506
498
} , 500 ) ;
507
499
}
508
500
509
501
//load initial scrum subject
510
502
function scrumSubjectLoaded ( ) {
511
503
try {
512
- if ( ! enableToggle || hasInjectedContent ) return ;
513
- if ( ! scrumSubject ) {
514
- console . error ( 'Subject element not found' ) ;
515
- return ;
516
- }
517
- setTimeout ( ( ) => {
518
- let name = githubUserData . name || githubUsername ;
519
- let project = projectName || '<project name>' ;
520
- let curDate = new Date ( ) ;
521
- let year = curDate . getFullYear ( ) . toString ( ) ;
522
- let date = curDate . getDate ( ) ;
523
- let month = curDate . getMonth ( ) ;
524
- month ++ ;
525
- if ( month < 10 ) month = '0' + month ;
526
- if ( date < 10 ) date = '0' + date ;
527
- let dateCode = year . toString ( ) + month . toString ( ) + date . toString ( ) ;
528
-
529
- const subject = `[Scrum] ${ name } - ${ project } - ${ dateCode } - False` ;
504
+ if ( ! enableToggle || hasInjectedContent ) return ;
505
+ if ( ! scrumSubject ) {
506
+ console . error ( 'Subject element not found' ) ;
507
+ return ;
508
+ }
509
+ setTimeout ( ( ) => {
510
+ let name = githubUserData . name || githubUsername ;
511
+ let project = projectName || '<project name>' ;
512
+ let curDate = new Date ( ) ;
513
+ let year = curDate . getFullYear ( ) . toString ( ) ;
514
+ let date = curDate . getDate ( ) ;
515
+ let month = curDate . getMonth ( ) ;
516
+ month ++ ;
517
+ if ( month < 10 ) month = '0' + month ;
518
+ if ( date < 10 ) date = '0' + date ;
519
+ let dateCode = year . toString ( ) + month . toString ( ) + date . toString ( ) ;
520
+
521
+ const subject = `[Scrum] ${ name } - ${ project } - ${ dateCode } - False` ;
530
522
log ( 'Generated subject:' , subject ) ;
531
- githubCache . subject = subject ;
532
- saveToStorage ( githubCache . data , subject ) ;
523
+ githubCache . subject = subject ;
524
+ saveToStorage ( githubCache . data , subject ) ;
533
525
534
- if ( scrumSubject && scrumSubject . value !== subject ) {
535
- scrumSubject . value = subject ;
536
- scrumSubject . dispatchEvent ( new Event ( 'input' , { bubbles : true } ) ) ;
537
- }
538
- } ) ;
526
+ if ( scrumSubject && scrumSubject . value !== subject ) {
527
+ scrumSubject . value = subject ;
528
+ scrumSubject . dispatchEvent ( new Event ( 'input' , { bubbles : true } ) ) ;
529
+ }
530
+ } ) ;
539
531
} catch ( err ) {
540
- console . err ( 'Error while setting subject: ' , err ) ;
532
+ console . err ( 'Error while setting subject: ' , err ) ;
541
533
}
542
534
}
543
535
@@ -552,8 +544,8 @@ function allIncluded(outputTarget = 'email') {
552
544
logError ( 'No Github PR review data available' ) ;
553
545
return ;
554
546
}
555
- reviewedPrsArray = [ ] ;
556
- githubPrsReviewDataProcessed = { } ;
547
+ // reviewedPrsArray = [];
548
+ // githubPrsReviewDataProcessed = {};
557
549
let i ;
558
550
for ( i = 0 ; i < items . length ; i ++ ) {
559
551
let item = items [ i ] ;
@@ -626,8 +618,8 @@ function allIncluded(outputTarget = 'email') {
626
618
}
627
619
function writeGithubIssuesPrs ( ) {
628
620
let items = githubIssuesData . items ;
629
- lastWeekArray = [ ] ;
630
- nextWeekArray = [ ] ;
621
+ // lastWeekArray = [];
622
+ // nextWeekArray = [];
631
623
if ( ! items ) {
632
624
logError ( 'No Github issues data available' ) ;
633
625
}
@@ -668,12 +660,20 @@ function allIncluded(outputTarget = 'email') {
668
660
li = `<li><i>(${ project } )</i> - Opened Issue(#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ issue_opened_button } </li>` ;
669
661
} else if ( item . state === 'closed' ) {
670
662
li = `<li><i>(${ project } )</i> - Opened Issue(#${ number } ) - <a href='${ html_url } '>${ title } </a> ${ issue_closed_button } </li>` ;
663
+ } else {
664
+ li =
665
+ '<li><i>(' +
666
+ project +
667
+ ')</i> - Opened Issue(#' +
668
+ number +
669
+ ") - <a href='" +
670
+ html_url +
671
+ "' target='_blank'>" +
672
+ title +
673
+ '</a> </li>' ;
671
674
}
672
675
}
673
- if ( li ) {
674
676
lastWeekArray . push ( li ) ;
675
- } else {
676
- }
677
677
}
678
678
writeScrumBody ( ) ;
679
679
}
@@ -703,9 +703,10 @@ function allIncluded(outputTarget = 'email') {
703
703
704
704
clearInterval ( intervalSubject ) ;
705
705
scrumSubject = elements . subject ;
706
- if ( ! scrumSubject . value ) {
706
+
707
+ setTimeout ( ( ) => {
707
708
scrumSubjectLoaded ( ) ;
708
- }
709
+ } , 500 ) ;
709
710
} , 500 ) ;
710
711
711
712
//check for github safe writing
@@ -752,6 +753,10 @@ $('button>span:contains(New conversation)').parent('button').click(() => {
752
753
allIncluded ( ) ;
753
754
} ) ;
754
755
756
+ window . generateScrumReport = function ( ) {
757
+ allIncluded ( 'popup' ) ;
758
+ }
759
+
755
760
chrome . runtime . onMessage . addListener ( ( request , sender , sendResponse ) => {
756
761
if ( request . action === 'forceRefresh' ) {
757
762
forceGithubDataRefresh ( )
@@ -761,8 +766,4 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
761
766
} ) ;
762
767
return true ;
763
768
}
764
- } ) ;
765
-
766
- window . generateScrumReport = function ( ) {
767
- allIncluded ( 'popup' ) ;
768
- }
769
+ } ) ;
0 commit comments