-
Notifications
You must be signed in to change notification settings - Fork 0
/
table1.js
59 lines (50 loc) · 1.4 KB
/
table1.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
document.onready = function()
{
$.get('decompression_tables.json', function(tables)
{
//tables = JSON.parse(tables);
var table = tables[0];
console.log(table);
$('.name').html(table.name);
var tr = $('<tr></tr>');
var th = $('<th></th>');
tr.append(th);
table.columns.forEach(function(column)
{
var th = $('<th>' + column.depth + '</th>');
tr.append(th);
});
$('#table1').append(tr);
var altColor = true;
for (var row = 0; row < 26; ++row)
{
var tr = $('<tr></tr>');
if (altColor)
{
tr.addClass('alt-row-color');
}
altColor = !altColor;
var td = $(
'<td>' + String.fromCharCode('A'.charCodeAt(0) + row) + '</td>'
);
td.addClass('letter');
tr.append(td);
for (var col = 0; col < table.columns.length; ++col)
{
if (row >= table.columns[col].rows.length)
{
var td = $('<td></td>');
}
else
{
var r = table.columns[col].rows[row];
var td = $('<td>' + r.min + '</td>');
r.ss && td.addClass('saftey-stop-required');
r.limit && td.addClass('no-decompression-limit');
}
tr.append(td);
}
$('#table1').append(tr);
}
});
};