-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.js
executable file
·38 lines (34 loc) · 1.31 KB
/
functions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/** highlight/unset the row of a table **/
function set_row(idx) {
var table = document.getElementById('user-grades');
var rowsize = table.rows[idx].cells.length;
for (var i = 0; i < rowsize; i++) {
if (table.rows[idx].cells[i]) {
if (table.rows[idx].cells[i].className.search(/hmarked/) != -1) {
table.rows[idx].cells[i].className = table.rows[idx].cells[i].className.replace(' hmarked', '');
} else {
table.rows[idx].cells[i].className += ' hmarked';
}
}
}
}
/** highlight/unset the column of a table **/
function set_col(col,gradecelloffset) {
var table = document.getElementById('user-grades');
//highlight the column header
flip_vmarked(table,2,col);
//add any grade cell offset (due to colspans) then iterate down the table
col += gradecelloffset;
for (var row = 3; row < table.rows.length; row++) {
flip_vmarked(table,row,col);
}
}
function flip_vmarked(table,row,col) {
if (table.rows[row].cells[col]) {
if (table.rows[row].cells[col].className.search(/vmarked/) != -1) {
table.rows[row].cells[col].className = table.rows[row].cells[col].className.replace(' vmarked', '');
} else {
table.rows[row].cells[col].className += ' vmarked';
}
}
}