Skip to content

Commit 6a24c94

Browse files
author
hkedia321
committed
make delay in writing
1 parent 30f7a54 commit 6a24c94

File tree

2 files changed

+34
-31
lines changed

2 files changed

+34
-31
lines changed

src/scripts/main.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,9 @@ function handleUserReasonChange(){
119119
chrome.storage.local.set({"userReason": value});
120120
}
121121
function handleRefresh(){
122-
window.onbeforeunload = null;
123122
window.close();
124123
chrome.tabs.executeScript({
125-
code: "document.location.reload()"
124+
code: "console.log('herrree');window.onbeforeunload = null;document.location.reload()"
126125
});
127126
}
128127
enableToggleElement.addEventListener("change", handleEnableChange);

src/scripts/scrumHelper.js

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -102,28 +102,30 @@ function fetchGithubData(){
102102
function writeScrumBody(){
103103
if(!enableToggle)
104104
return;
105-
var lastWeekUl="<ul>";
106-
var i;
107-
for(i =0;i<lastWeekArray.length;i++)
108-
lastWeekUl+=lastWeekArray[i];
109-
for(i =0;i<reviewedPrsArray.length;i++)
110-
lastWeekUl+=reviewedPrsArray[i];
111-
lastWeekUl+="</ul>";
105+
setTimeout(function(){ //to apply this after google has autofilled
106+
var lastWeekUl="<ul>";
107+
var i;
108+
for(i =0;i<lastWeekArray.length;i++)
109+
lastWeekUl+=lastWeekArray[i];
110+
for(i =0;i<reviewedPrsArray.length;i++)
111+
lastWeekUl+=reviewedPrsArray[i];
112+
lastWeekUl+="</ul>";
112113

113-
var nextWeekUl="<ul>";
114-
for(i =0;i<nextWeekArray.length;i++)
115-
nextWeekUl+=nextWeekArray[i];
116-
for(i in githubPrsReviewDataProccessed){
117-
nextWeekUl+="<li><i>("+i+")</i> - Review more PRs </li>";
118-
}
119-
nextWeekUl+="</ul>";
114+
var nextWeekUl="<ul>";
115+
for(i =0;i<nextWeekArray.length;i++)
116+
nextWeekUl+=nextWeekArray[i];
117+
for(i in githubPrsReviewDataProccessed){
118+
nextWeekUl+="<li><i>("+i+")</i> - Review more PRs </li>";
119+
}
120+
nextWeekUl+="</ul>";
120121

121-
scrumBody.innerHTML="<b>1. What did I do last week?</b>\
122-
<br>"+lastWeekUl+"<br><br>\
122+
scrumBody.innerHTML="<b>1. What did I do last week?</b>\
123+
<br>"+lastWeekUl+"<br><br>\
123124
<b>2. What I plan to do this week?</b>\
124125
<br>"+nextWeekUl+"<br><br>\
125126
<b>3. What is stopping me from doing my work?</b>\
126127
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+userReason+"</p>";
128+
},2000);
127129
}
128130

129131
function getProject(){
@@ -137,19 +139,21 @@ function getProject(){
137139
//load initial scrum subject
138140
function scrumSubjectLoaded(){
139141
if(!enableToggle) return;
140-
var name = githubUserData.name || githubUsername;
141-
var project = getProject();
142-
var curDate = new Date();
143-
var year=curDate.getFullYear().toString();
144-
var date=curDate.getUTCDate();
145-
var month=curDate.getMonth();
146-
month++;
147-
if(month<10)
148-
month="0"+month;
149-
if(date<10)
150-
date="0"+date;
151-
var dateCode=year.toString()+month.toString()+date.toString();
152-
scrumSubject.value = "[Scrum] "+name+" - "+project+" - "+dateCode+" - False";
142+
setTimeout(function(){ //to apply this after google has autofilled
143+
var name = githubUserData.name || githubUsername;
144+
var project = getProject();
145+
var curDate = new Date();
146+
var year=curDate.getFullYear().toString();
147+
var date=curDate.getUTCDate();
148+
var month=curDate.getMonth();
149+
month++;
150+
if(month<10)
151+
month="0"+month;
152+
if(date<10)
153+
date="0"+date;
154+
var dateCode=year.toString()+month.toString()+date.toString();
155+
scrumSubject.value = "[Scrum] "+name+" - "+project+" - "+dateCode+" - False";
156+
},2000);
153157
}
154158

155159
// write PRs Reviewed

0 commit comments

Comments
 (0)