1
1
/* global $,Materialize*/
2
2
var enableToggleElement = document . getElementById ( "enable" ) ;
3
3
var githubUsernameElement = document . getElementById ( "githubUsername" ) ;
4
+ var projectNameElement = document . getElementById ( "projectName" ) ;
4
5
var lastWeekContributionElement = document . getElementById ( "lastWeekContribution" ) ;
5
6
var startingDateElement = document . getElementById ( "startingDate" ) ;
6
7
var endingDateElement = document . getElementById ( "endingDate" ) ;
@@ -9,10 +10,13 @@ var userReasonElement = document.getElementById("userReason");
9
10
var gsoc = 0 ; //0 means gsoc. 1 means gsoc
10
11
function handleBodyOnLoad ( ) {
11
12
// 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 ) {
13
14
if ( items . githubUsername ) {
14
15
githubUsernameElement . value = items . githubUsername ;
15
16
}
17
+ if ( items . projectName ) {
18
+ projectNameElement . value = items . projectName ;
19
+ }
16
20
if ( items . enableToggle ) {
17
21
enableToggleElement . checked = items . enableToggle ;
18
22
}
@@ -58,15 +62,13 @@ function handleEnableChange(){
58
62
}
59
63
function handleStartingDateChange ( ) {
60
64
var value = startingDateElement . value ;
61
- console . log ( "starting date:" ) ;
62
- console . log ( value ) ;
63
65
chrome . storage . local . set ( { "startingDate" : value } ) ;
64
66
}
65
67
function handleEndingDateChange ( ) {
66
68
var value = endingDateElement . value ;
67
69
chrome . storage . local . set ( { "endingDate" : value } ) ;
68
70
}
69
- function handleLastWeekContributionChange ( keepPreviousValue = false ) {
71
+ function handleLastWeekContributionChange ( ) {
70
72
var value = lastWeekContributionElement . checked ;
71
73
if ( value ) {
72
74
startingDateElement . disabled = true ;
@@ -107,14 +109,13 @@ function handleGithubUsernameChange(){
107
109
var value = githubUsernameElement . value ;
108
110
chrome . storage . local . set ( { "githubUsername" : value } ) ;
109
111
}
112
+ function handleProjectNameChange ( ) {
113
+ var value = projectNameElement . value ;
114
+ chrome . storage . local . set ( { "projectName" : value } ) ;
115
+ }
110
116
function handleOpenLabelChange ( ) {
111
117
var value = showOpenLabelElement . checked ;
112
118
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 } ) ;
118
119
}
119
120
function handleUserReasonChange ( ) {
120
121
var value = userReasonElement . value ;
@@ -123,21 +124,22 @@ function handleUserReasonChange(){
123
124
function handleCodeheatClick ( ) {
124
125
gsoc = 0 ;
125
126
$ ( "#codeheatTab" ) . addClass ( "active" ) ;
126
- $ ( ' .tabs' ) . tabs ( ) ;
127
+ $ ( " .tabs" ) . tabs ( ) ;
127
128
$ ( "#noDays" ) . text ( "7 days" ) ;
128
129
chrome . storage . local . set ( { "gsoc" : 0 } ) ;
129
130
handleLastWeekContributionChange ( ) ;
130
131
}
131
132
function handleGsocClick ( ) {
132
133
gsoc = 1 ;
133
134
$ ( "#gsocTab" ) . addClass ( "active" ) ;
134
- $ ( ' .tabs' ) . tabs ( ) ;
135
+ $ ( " .tabs" ) . tabs ( ) ;
135
136
$ ( "#noDays" ) . text ( "1 day" ) ;
136
137
chrome . storage . local . set ( { "gsoc" : 1 } ) ;
137
138
handleLastWeekContributionChange ( ) ;
138
139
}
139
140
enableToggleElement . addEventListener ( "change" , handleEnableChange ) ;
140
141
githubUsernameElement . addEventListener ( "keyup" , handleGithubUsernameChange ) ;
142
+ projectNameElement . addEventListener ( "keyup" , handleProjectNameChange ) ;
141
143
startingDateElement . addEventListener ( "change" , handleStartingDateChange ) ;
142
144
endingDateElement . addEventListener ( "change" , handleEndingDateChange ) ;
143
145
lastWeekContributionElement . addEventListener ( "change" , handleLastWeekContributionChange ) ;
0 commit comments