Skip to content

Commit ca59326

Browse files
adityasticHarshit Kedia
authored andcommitted
feat: allow custom project names (#31)
1 parent ef8c527 commit ca59326

File tree

4 files changed

+357
-349
lines changed

4 files changed

+357
-349
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
node_modules
2-
package-lock.json
2+
package-lock.json

src/popup.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ <h6 class="center">
4242
</div>
4343
</div>
4444
<div class="row">
45+
<div class="input-field col s12">
46+
<input placeholder="Your Project Name" id="projectName" type="text">
47+
<label for="projectName">Your Project Name</label>
48+
</div>
4549
<div class="input-field col s12">
4650
<input placeholder="Required for getting data from github" id="githubUsername" type="text">
4751
<label for="githubUsername">Your Github Username</label>

src/scripts/main.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* global $,Materialize*/
22
var enableToggleElement = document.getElementById("enable");
33
var githubUsernameElement = document.getElementById("githubUsername");
4+
var projectNameElement = document.getElementById("projectName");
45
var lastWeekContributionElement=document.getElementById("lastWeekContribution");
56
var startingDateElement = document.getElementById("startingDate");
67
var endingDateElement = document.getElementById("endingDate");
@@ -9,10 +10,13 @@ var userReasonElement = document.getElementById("userReason");
910
var gsoc = 0;//0 means gsoc. 1 means gsoc
1011
function handleBodyOnLoad(){
1112
// prefill name
12-
chrome.storage.local.get(["githubUsername","enableToggle","startingDate","endingDate","showOpenLabel","showClosedLabel","userReason","lastWeekContribution","gsoc"],function(items){
13+
chrome.storage.local.get(["githubUsername","projectName","enableToggle","startingDate","endingDate","showOpenLabel","userReason","lastWeekContribution","gsoc"],function(items){
1314
if(items.githubUsername){
1415
githubUsernameElement.value=items.githubUsername;
1516
}
17+
if(items.projectName){
18+
projectNameElement.value = items.projectName;
19+
}
1620
if(items.enableToggle){
1721
enableToggleElement.checked=items.enableToggle;
1822
}
@@ -58,15 +62,13 @@ function handleEnableChange(){
5862
}
5963
function handleStartingDateChange(){
6064
var value = startingDateElement.value;
61-
console.log("starting date:");
62-
console.log(value);
6365
chrome.storage.local.set({"startingDate": value});
6466
}
6567
function handleEndingDateChange(){
6668
var value = endingDateElement.value;
6769
chrome.storage.local.set({"endingDate": value});
6870
}
69-
function handleLastWeekContributionChange(keepPreviousValue=false){
71+
function handleLastWeekContributionChange(){
7072
var value = lastWeekContributionElement.checked;
7173
if(value){
7274
startingDateElement.disabled=true;
@@ -107,14 +109,13 @@ function handleGithubUsernameChange(){
107109
var value = githubUsernameElement.value;
108110
chrome.storage.local.set({"githubUsername": value});
109111
}
112+
function handleProjectNameChange(){
113+
var value = projectNameElement.value;
114+
chrome.storage.local.set({"projectName": value});
115+
}
110116
function handleOpenLabelChange(){
111117
var value = showOpenLabelElement.checked;
112118
chrome.storage.local.set({"showOpenLabel": value});
113-
chrome.storage.local.set({"showClosedLabel": value});
114-
}
115-
function handleClosedLabelChange(){
116-
var value = showClosedLabelElement.checked;
117-
chrome.storage.local.set({"showClosedLabel": value});
118119
}
119120
function handleUserReasonChange(){
120121
var value = userReasonElement.value;
@@ -123,21 +124,22 @@ function handleUserReasonChange(){
123124
function handleCodeheatClick(){
124125
gsoc=0;
125126
$("#codeheatTab").addClass("active");
126-
$('.tabs').tabs();
127+
$(".tabs").tabs();
127128
$("#noDays").text("7 days");
128129
chrome.storage.local.set({"gsoc": 0});
129130
handleLastWeekContributionChange();
130131
}
131132
function handleGsocClick(){
132133
gsoc=1;
133134
$("#gsocTab").addClass("active");
134-
$('.tabs').tabs();
135+
$(".tabs").tabs();
135136
$("#noDays").text("1 day");
136137
chrome.storage.local.set({"gsoc": 1});
137138
handleLastWeekContributionChange();
138139
}
139140
enableToggleElement.addEventListener("change", handleEnableChange);
140141
githubUsernameElement.addEventListener("keyup", handleGithubUsernameChange);
142+
projectNameElement.addEventListener("keyup", handleProjectNameChange);
141143
startingDateElement.addEventListener("change", handleStartingDateChange);
142144
endingDateElement.addEventListener("change", handleEndingDateChange);
143145
lastWeekContributionElement.addEventListener("change", handleLastWeekContributionChange);

0 commit comments

Comments
 (0)