Skip to content

Commit e2895de

Browse files
jnarebgitster
authored andcommitted
gitweb.js: Update and improve comments in JavaScript files
This consists of adding a few extra explanation, fixing descriptions of functions to match names of parameters in code, adding a few separators, and fixing spelling -- while at it spell 'neighbor' using American spelling (and not as 'neighbour'). This is post-split cleanup. Signed-off-by: Jakub Narebski <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9a86dd5 commit e2895de

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

gitweb/static/js/blame_incremental.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @license GPLv2 or later
88
*/
99

10-
10+
/* ============================================================ */
1111
/*
1212
* This code uses DOM methods instead of (nonstandard) innerHTML
1313
* to modify page.
@@ -26,7 +26,7 @@
2626
*/
2727

2828

29-
/* ============================================================ */
29+
/* ............................................................ */
3030
/* utility/helper functions (and variables) */
3131

3232
var xhr; // XMLHttpRequest object
@@ -132,7 +132,7 @@ function writeTimeInterval() {
132132
}
133133

134134
/**
135-
* show an error message alert to user within page (in prohress info area)
135+
* show an error message alert to user within page (in progress info area)
136136
* @param {String} str: plain text error message (no HTML)
137137
*
138138
* @globals div_progress_info
@@ -182,7 +182,7 @@ function getColorNo(tr) {
182182

183183
var colorsFreq = [0, 0, 0];
184184
/**
185-
* return one of given possible colors (curently least used one)
185+
* return one of given possible colors (currently least used one)
186186
* example: chooseColorNoFrom(2, 3) returns 2 or 3
187187
*
188188
* @param {Number[]} arguments: one or more numbers
@@ -203,8 +203,8 @@ function chooseColorNoFrom() {
203203
}
204204

205205
/**
206-
* given two neigbour <tr> elements, find color which would be different
207-
* from color of both of neighbours; used to 3-color blame table
206+
* given two neighbor <tr> elements, find color which would be different
207+
* from color of both of neighbors; used to 3-color blame table
208208
*
209209
* @param {HTMLElement} tr_prev
210210
* @param {HTMLElement} tr_next
@@ -216,14 +216,14 @@ function findColorNo(tr_prev, tr_next) {
216216
var color_next = getColorNo(tr_next);
217217

218218

219-
// neither of neighbours has color set
219+
// neither of neighbors has color set
220220
// THEN we can use any of 3 possible colors
221221
if (!color_prev && !color_next) {
222222
return chooseColorNoFrom(1,2,3);
223223
}
224224

225-
// either both neighbours have the same color,
226-
// or only one of neighbours have color set
225+
// either both neighbors have the same color,
226+
// or only one of neighbors have color set
227227
// THEN we can use any color except given
228228
var color;
229229
if (color_prev === color_next) {
@@ -237,7 +237,7 @@ function findColorNo(tr_prev, tr_next) {
237237
return chooseColorNoFrom((color % 3) + 1, ((color+1) % 3) + 1);
238238
}
239239

240-
// neighbours have different colors
240+
// neighbors have different colors
241241
// THEN there is only one color left
242242
return (3 - ((color_prev + color_next) % 3));
243243
}
@@ -258,7 +258,7 @@ function isStartOfGroup(tr) {
258258

259259
/**
260260
* change colors to use zebra coloring (2 colors) instead of 3 colors
261-
* concatenate neighbour commit groups belonging to the same commit
261+
* concatenate neighbor commit groups belonging to the same commit
262262
*
263263
* @globals colorRe
264264
*/

gitweb/static/js/lib/common-lib.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@
1313
/* Padding */
1414

1515
/**
16-
* pad number N with nonbreakable spaces on the left, to WIDTH characters
16+
* pad INPUT on the left with STR that is assumed to have visible
17+
* width of single character (for example nonbreakable spaces),
18+
* to WIDTH characters
19+
*
1720
* example: padLeftStr(12, 3, '\u00A0') == '\u00A012'
1821
* ('\u00A0' is nonbreakable space)
1922
*
2023
* @param {Number|String} input: number to pad
2124
* @param {Number} width: visible width of output
2225
* @param {String} str: string to prefix to string, e.g. '\u00A0'
23-
* @returns {String} INPUT prefixed with (WIDTH - INPUT.length) x STR
26+
* @returns {String} INPUT prefixed with STR x (WIDTH - INPUT.length)
2427
*/
2528
function padLeftStr(input, width, str) {
2629
var prefix = '';
@@ -34,7 +37,7 @@ function padLeftStr(input, width, str) {
3437
}
3538

3639
/**
37-
* Pad INPUT on the left to SIZE width, using given padding character CH,
40+
* Pad INPUT on the left to WIDTH, using given padding character CH,
3841
* for example padLeft('a', 3, '_') is '__a'.
3942
*
4043
* @param {String} input: input value converted to string.
@@ -140,7 +143,8 @@ var maybeQuotedRe = /^\"(.*)\"$/;
140143
/**#@-*/
141144

142145
/**
143-
* unquote maybe git-quoted filename
146+
* unquote maybe C-quoted filename (as used by git, i.e. it is
147+
* in double quotes '"' if there is any escape character used)
144148
* e.g. 'aa' -> 'aa', '"a\ta"' -> 'a a'
145149
*
146150
* @param {String} str: git-quoted string

0 commit comments

Comments
 (0)