path_coverage 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +112 -113
- data/lib/path_coverage/calls.rb +4 -11
- data/lib/path_coverage/card.rb +14 -0
- data/lib/path_coverage/condition.rb +8 -1
- data/lib/path_coverage/configuration.rb +1 -17
- data/lib/path_coverage/configuration_paths.rb +4 -2
- data/lib/path_coverage/console_summary.rb +15 -17
- data/lib/path_coverage/gaps.rb +12 -9
- data/lib/path_coverage/html/file.html +5 -5
- data/lib/path_coverage/html/index.html +3 -1
- data/lib/path_coverage/html/settings.js +50 -0
- data/lib/path_coverage/html/side.js +341 -432
- data/lib/path_coverage/html/style.css +330 -225
- data/lib/path_coverage/html/theme.js +27 -0
- data/lib/path_coverage/html_branch.rb +30 -0
- data/lib/path_coverage/html_cards.rb +111 -0
- data/lib/path_coverage/html_cells.rb +66 -0
- data/lib/path_coverage/html_file.rb +82 -68
- data/lib/path_coverage/html_index.rb +28 -29
- data/lib/path_coverage/html_index_head.rb +10 -30
- data/lib/path_coverage/html_labels.rb +23 -0
- data/lib/path_coverage/html_methods.rb +66 -0
- data/lib/path_coverage/html_nav.rb +50 -50
- data/lib/path_coverage/html_report.rb +45 -49
- data/lib/path_coverage/html_statements.rb +166 -0
- data/lib/path_coverage/html_syntax.rb +156 -0
- data/lib/path_coverage/html_template.rb +6 -0
- data/lib/path_coverage/html_tree.rb +36 -72
- data/lib/path_coverage/json_reader.rb +21 -14
- data/lib/path_coverage/json_writer.rb +26 -13
- data/lib/path_coverage/kernel.rb +29 -49
- data/lib/path_coverage/kinds/block.rb +2 -1
- data/lib/path_coverage/kinds/case.rb +7 -4
- data/lib/path_coverage/kinds/contains.rb +6 -4
- data/lib/path_coverage/kinds/safe.rb +5 -3
- data/lib/path_coverage/manifest.rb +2 -1
- data/lib/path_coverage/manifest_blocks.rb +3 -4
- data/lib/path_coverage/manifest_case.rb +2 -3
- data/lib/path_coverage/manifest_choices.rb +4 -3
- data/lib/path_coverage/manifest_folding.rb +1 -1
- data/lib/path_coverage/merge.rb +3 -3
- data/lib/path_coverage/method_statements.rb +300 -0
- data/lib/path_coverage/recorder.rb +12 -31
- data/lib/path_coverage/render.rb +19 -22
- data/lib/path_coverage/rewriter.rb +36 -55
- data/lib/path_coverage/site_tree.rb +9 -0
- data/lib/path_coverage/statement_arms.rb +161 -0
- data/lib/path_coverage/summary.rb +11 -15
- data/lib/path_coverage/totals.rb +6 -12
- data/lib/path_coverage/version.rb +1 -1
- data/lib/path_coverage/within_methods.rb +92 -0
- metadata +16 -11
- data/lib/path_coverage/html/toggle.js +0 -12
- data/lib/path_coverage/html_paths.rb +0 -138
- data/lib/path_coverage/path_gaps.rb +0 -41
- data/lib/path_coverage/path_manifest.rb +0 -110
|
@@ -1,53 +1,82 @@
|
|
|
1
|
-
//
|
|
2
|
-
// code,
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
1
|
+
// The behaviour of a file's page: its cards sit in the rail left
|
|
2
|
+
// of the code, one open at a time, level with its first line. A
|
|
3
|
+
// method's def number opens its card, unfolding its body; a loose
|
|
4
|
+
// site's button, outside every method, opens its lines' top card.
|
|
5
|
+
// The page's markup, from the Ruby, already marks every method's
|
|
6
|
+
// lines, numbers and rows; this only opens, closes and places.
|
|
7
7
|
(function () {
|
|
8
8
|
var code = document.querySelector('.code');
|
|
9
9
|
if (!code) { return; }
|
|
10
10
|
var box = code.parentElement;
|
|
11
|
-
var
|
|
11
|
+
var rail = document.querySelector('.rail');
|
|
12
|
+
var divider = document.querySelector('.divider');
|
|
12
13
|
var grids = Array.prototype.slice.call(document.querySelectorAll('.pathgrid'));
|
|
13
|
-
var ccRail = document.createElement('div');
|
|
14
|
-
ccRail.className = 'rail cc';
|
|
15
|
-
var pcRail = document.createElement('div');
|
|
16
|
-
pcRail.className = 'rail pc';
|
|
17
|
-
var bars = grids.map(function (grid) {
|
|
18
|
-
var bar = document.createElement('button');
|
|
19
|
-
bar.type = 'button';
|
|
20
|
-
bar.className = 'pathbar';
|
|
21
|
-
bar.setAttribute('data-status', grid.getAttribute('data-status'));
|
|
22
|
-
bar.setAttribute('aria-controls', grid.id);
|
|
23
|
-
bar.setAttribute('aria-expanded', 'false');
|
|
24
|
-
bar.title = grid.querySelector('.calls').title;
|
|
25
|
-
return bar;
|
|
26
|
-
});
|
|
27
|
-
// Each method's def line, lit from its def to its bar, so the
|
|
28
|
-
// two read as one bracket around the method.
|
|
29
|
-
var bands = grids.map(function (grid) {
|
|
30
|
-
var band = document.createElement('div');
|
|
31
|
-
band.className = 'methodband';
|
|
32
|
-
band.setAttribute('data-status', grid.getAttribute('data-status'));
|
|
33
|
-
return band;
|
|
34
|
-
});
|
|
35
14
|
|
|
36
|
-
//
|
|
37
|
-
function
|
|
38
|
-
return
|
|
15
|
+
// True for a top card, of sites outside every method.
|
|
16
|
+
function isTop(grid) {
|
|
17
|
+
return grid.classList.contains('top-level');
|
|
39
18
|
}
|
|
40
19
|
|
|
41
|
-
//
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
}
|
|
20
|
+
// A card's first and last lines.
|
|
21
|
+
function firstOf(grid) { return Number(grid.getAttribute('data-first')); }
|
|
22
|
+
function lastOf(grid) { return Number(grid.getAttribute('data-last')); }
|
|
45
23
|
|
|
46
24
|
// The number span of line n.
|
|
47
25
|
function lineno(n) {
|
|
48
26
|
return document.getElementById('L' + n);
|
|
49
27
|
}
|
|
50
28
|
|
|
29
|
+
// The row, a line or a loose site's block, holding line n.
|
|
30
|
+
function rowOf(n) {
|
|
31
|
+
return lineno(n).closest('.line, .block');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// The code span of line n, whether a line's own or one of a
|
|
35
|
+
// loose site's lines.
|
|
36
|
+
function srcOf(n) {
|
|
37
|
+
var number = lineno(n);
|
|
38
|
+
if (!number) { return null; }
|
|
39
|
+
var button = number.closest('button.lnum');
|
|
40
|
+
if (!button) { return number.parentElement.querySelector('.src'); }
|
|
41
|
+
var index = Array.prototype.indexOf.call(button.querySelectorAll('.lineno'), number);
|
|
42
|
+
return button.closest('.block').querySelectorAll('.srcs > .src')[index];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// The code of each method's lines, from its def to its end,
|
|
46
|
+
// which thickens its stripe while its card is open; none for a
|
|
47
|
+
// top card.
|
|
48
|
+
var methodSrcs = grids.map(function (grid) {
|
|
49
|
+
if (isTop(grid)) { return []; }
|
|
50
|
+
var srcs = [];
|
|
51
|
+
for (var n = firstOf(grid); n <= lastOf(grid); n++) { srcs.push(srcOf(n)); }
|
|
52
|
+
return srcs;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// The rows of each method's body, after its def line to its end,
|
|
56
|
+
// folded under its def line while its card is closed; a row
|
|
57
|
+
// holding its def line too is never folded. None for a top card.
|
|
58
|
+
var methodRows = grids.map(function (grid) {
|
|
59
|
+
if (isTop(grid)) { return []; }
|
|
60
|
+
var def = rowOf(firstOf(grid));
|
|
61
|
+
var rows = [];
|
|
62
|
+
for (var n = firstOf(grid) + 1; n <= lastOf(grid); n++) {
|
|
63
|
+
var row = rowOf(n);
|
|
64
|
+
if (row !== def && rows.indexOf(row) < 0) { rows.push(row); }
|
|
65
|
+
}
|
|
66
|
+
return rows;
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// The def number of each method's card, which opens it; null for
|
|
70
|
+
// a top card, which its site's button opens.
|
|
71
|
+
var defs = grids.map(function (grid) {
|
|
72
|
+
return isTop(grid) ? null : lineno(firstOf(grid));
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// The loose button opening each top card; null for a method's.
|
|
76
|
+
var buttons = grids.map(function (grid) {
|
|
77
|
+
return isTop(grid) ? document.querySelector('button.lnum[aria-controls="' + grid.id + '"]') : null;
|
|
78
|
+
});
|
|
79
|
+
|
|
51
80
|
// Element's top, middle and bottom relative to within's top.
|
|
52
81
|
function spot(element, within) {
|
|
53
82
|
var rect = element.getBoundingClientRect();
|
|
@@ -55,289 +84,136 @@
|
|
|
55
84
|
return { top: top, middle: top + rect.height / 2, bottom: top + rect.height };
|
|
56
85
|
}
|
|
57
86
|
|
|
58
|
-
// Opens
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
function openOnly(
|
|
62
|
-
pin(null);
|
|
87
|
+
// Opens grid alone, null closing all: a method's card opens its
|
|
88
|
+
// body, every other method's folded; its def number, or its
|
|
89
|
+
// site's button, says it is open.
|
|
90
|
+
function openOnly(open) {
|
|
63
91
|
clear();
|
|
64
|
-
box.style.minHeight = '';
|
|
65
|
-
trees.forEach(function (tree) {
|
|
66
|
-
tree.hidden = tree !== panel;
|
|
67
|
-
buttonOf(tree).setAttribute('aria-expanded', tree === panel ? 'true' : 'false');
|
|
68
|
-
});
|
|
69
92
|
grids.forEach(function (grid, i) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
93
|
+
var shown = grid === open;
|
|
94
|
+
grid.hidden = !shown;
|
|
95
|
+
methodSrcs[i].forEach(function (src) { src.classList.toggle('method-open', shown); });
|
|
96
|
+
(defs[i] || buttons[i]).setAttribute('aria-expanded', String(shown));
|
|
73
97
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
foldBodies(grids.indexOf(open));
|
|
99
|
+
document.body.toggleAttribute('data-open', open !== null);
|
|
100
|
+
place();
|
|
101
|
+
stickDef();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// True when the method of grids[inner] is defined inside that of
|
|
105
|
+
// grids[outer], eg a def inside a def.
|
|
106
|
+
function nests(inner, outer) {
|
|
107
|
+
return firstOf(grids[outer]) < firstOf(grids[inner]) && lastOf(grids[inner]) <= lastOf(grids[outer]);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Folds every method's body but that of grids[open], none for -1:
|
|
111
|
+
// its rows show, but for those of any method inside it, which stay
|
|
112
|
+
// folded under their def lines; and its def line shows, with those
|
|
113
|
+
// of the methods it is inside, though they lie in folded bodies.
|
|
114
|
+
function foldBodies(open) {
|
|
115
|
+
var shown = [];
|
|
116
|
+
if (open >= 0) {
|
|
117
|
+
shown = methodRows[open].filter(function (row) {
|
|
118
|
+
return !grids.some(function (grid, j) {
|
|
119
|
+
return nests(j, open) && methodRows[j].indexOf(row) >= 0;
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
grids.forEach(function (grid, j) {
|
|
123
|
+
if (j === open || nests(open, j)) { shown.push(rowOf(firstOf(grid))); }
|
|
124
|
+
});
|
|
100
125
|
}
|
|
126
|
+
methodRows.forEach(function (rows) {
|
|
127
|
+
rows.forEach(function (row) { row.classList.toggle('method-folded', shown.indexOf(row) < 0); });
|
|
128
|
+
});
|
|
101
129
|
}
|
|
102
130
|
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
131
|
+
// The narrowest the rail drags to, and the narrowest the code
|
|
132
|
+
// beside it is left.
|
|
133
|
+
var RAIL_MIN = 240;
|
|
134
|
+
var CODE_MIN = 320;
|
|
135
|
+
var RAIL_KEY = 'path_coverage.rail';
|
|
136
|
+
|
|
137
|
+
// Sets the rail to width pixels, kept within its bounds, and
|
|
138
|
+
// places the open card again beside it.
|
|
139
|
+
function setRail(width) {
|
|
140
|
+
var most = box.getBoundingClientRect().width - CODE_MIN;
|
|
141
|
+
var wide = Math.round(Math.max(RAIL_MIN, Math.min(most, width)));
|
|
142
|
+
document.body.style.setProperty('--rail', wide + 'px');
|
|
143
|
+
place();
|
|
144
|
+
return wide;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Dragging the divider sets the rail's width, kept in the
|
|
148
|
+
// browser, where it can be, for the next page.
|
|
149
|
+
divider.addEventListener('pointerdown', function (event) {
|
|
150
|
+
divider.setPointerCapture(event.pointerId);
|
|
151
|
+
divider.classList.add('dragging');
|
|
152
|
+
document.body.classList.add('dragging');
|
|
153
|
+
event.preventDefault();
|
|
154
|
+
});
|
|
155
|
+
divider.addEventListener('pointermove', function (event) {
|
|
156
|
+
if (!divider.classList.contains('dragging')) { return; }
|
|
157
|
+
setRail(event.clientX - box.getBoundingClientRect().left - 6);
|
|
158
|
+
});
|
|
159
|
+
divider.addEventListener('pointerup', function (event) {
|
|
160
|
+
divider.releasePointerCapture(event.pointerId);
|
|
161
|
+
divider.classList.remove('dragging');
|
|
162
|
+
document.body.classList.remove('dragging');
|
|
163
|
+
var wide = parseInt(document.body.style.getPropertyValue('--rail'), 10);
|
|
164
|
+
try { window.localStorage.setItem(RAIL_KEY, String(wide)); } catch (e) { /* this page only */ }
|
|
165
|
+
});
|
|
117
166
|
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
// one overflowing it would make the box scroll, sliding the
|
|
122
|
-
// code's first lines out of sight.
|
|
123
|
-
function placeTree(tree) {
|
|
124
|
-
var block = buttonOf(tree).closest('.block');
|
|
125
|
-
tree.style.top = '0px';
|
|
126
|
-
var line = spot(block.querySelector('.src'), ccRail).middle;
|
|
127
|
-
var row = spot(tree.querySelector('.site .row'), tree).middle;
|
|
128
|
-
tree.style.top = (line - row) + 'px';
|
|
129
|
-
box.style.minHeight = Math.ceil(spot(tree, box).bottom) + 'px';
|
|
167
|
+
// The rail's width kept from an earlier page, if any.
|
|
168
|
+
function keptRail() {
|
|
169
|
+
try { return parseInt(window.localStorage.getItem(RAIL_KEY), 10); } catch (e) { return NaN; }
|
|
130
170
|
}
|
|
131
171
|
|
|
132
|
-
// Sets an open
|
|
133
|
-
// first
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
//
|
|
172
|
+
// Sets an open card's top so its title row is level with its
|
|
173
|
+
// first line; its rows, and any fold open among them, flow down
|
|
174
|
+
// it. When its first line has scrolled up under the sticky
|
|
175
|
+
// header, the card slides down to stay just below it, but never
|
|
176
|
+
// past its last line. The rail stretches to the card's bottom,
|
|
177
|
+
// as the card, placed absolutely, adds no height of its own, so
|
|
178
|
+
// the box grows to show a card taller than the code.
|
|
138
179
|
function placeGrid(grid) {
|
|
139
|
-
var
|
|
140
|
-
var
|
|
141
|
-
var
|
|
142
|
-
var
|
|
143
|
-
var tall = rows.length * height;
|
|
180
|
+
var first = spot(lineno(firstOf(grid)), rail);
|
|
181
|
+
var last = spot(lineno(lastOf(grid)), rail);
|
|
182
|
+
var title = spot(grid.querySelector('.prow'), grid).middle;
|
|
183
|
+
var tall = grid.getBoundingClientRect().height;
|
|
144
184
|
var head = document.querySelector('.head').getBoundingClientRect().bottom;
|
|
145
|
-
var below = head -
|
|
146
|
-
var top = first.middle -
|
|
185
|
+
var below = head - rail.getBoundingClientRect().top + 8;
|
|
186
|
+
var top = first.middle - title;
|
|
147
187
|
top = Math.max(top, Math.min(below, last.bottom - tall));
|
|
148
188
|
grid.style.top = top + 'px';
|
|
149
|
-
|
|
150
|
-
rows.forEach(function (row, i) {
|
|
151
|
-
row.style.top = (i * height) + 'px';
|
|
152
|
-
});
|
|
189
|
+
rail.style.minHeight = (top + tall) + 'px';
|
|
153
190
|
}
|
|
154
191
|
|
|
155
|
-
// Places
|
|
156
|
-
|
|
157
|
-
if (panel.classList.contains('tree')) { placeTree(panel); } else { placeGrid(panel); }
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Sets each bar beside the lines from its def to its end, on
|
|
161
|
-
// the code pane's right edge, half into the gap before the
|
|
162
|
-
// rail.
|
|
163
|
-
// How many methods' lines enclose grid's: its bar sits one
|
|
164
|
-
// lane further in for each, like nested brackets.
|
|
165
|
-
function laneOf(grid) {
|
|
166
|
-
var first = Number(grid.getAttribute('data-first'));
|
|
167
|
-
var last = Number(grid.getAttribute('data-last'));
|
|
168
|
-
return grids.filter(function (other) {
|
|
169
|
-
var f = Number(other.getAttribute('data-first'));
|
|
170
|
-
var l = Number(other.getAttribute('data-last'));
|
|
171
|
-
return other !== grid && f <= first && last <= l;
|
|
172
|
-
}).length;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// The x of a bar's middle, from the code pane's right edge,
|
|
176
|
-
// for a method in lane.
|
|
177
|
-
function barInset(lane) {
|
|
178
|
-
return lane * 20;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// Sets each method's band over its def line, from the def's
|
|
182
|
-
// column to its bar; it scrolls with the code, so is placed
|
|
183
|
-
// again whenever the code scrolls.
|
|
184
|
-
function placeBands() {
|
|
185
|
-
var pane = code.getBoundingClientRect();
|
|
186
|
-
bands.forEach(function (band, i) {
|
|
187
|
-
var grid = grids[i];
|
|
188
|
-
var src = srcOf(grid.getAttribute('data-first'));
|
|
189
|
-
var text = src.firstChild;
|
|
190
|
-
var col = Number(grid.getAttribute('data-col'));
|
|
191
|
-
var range = document.createRange();
|
|
192
|
-
range.setStart(text, Math.min(col, text.length));
|
|
193
|
-
range.collapse(true);
|
|
194
|
-
var left = range.getBoundingClientRect().left - pane.left + code.scrollLeft;
|
|
195
|
-
var right = code.scrollLeft + code.clientWidth - barInset(laneOf(grid));
|
|
196
|
-
var line = src.getBoundingClientRect();
|
|
197
|
-
band.style.left = (left - 4) + 'px';
|
|
198
|
-
band.style.width = Math.max(0, right - left + 4) + 'px';
|
|
199
|
-
band.style.top = (line.top - pane.top + code.scrollTop) + 'px';
|
|
200
|
-
band.style.height = line.height + 'px';
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function placeBars() {
|
|
205
|
-
var edge = code.getBoundingClientRect().right - box.getBoundingClientRect().left;
|
|
206
|
-
placeBands();
|
|
207
|
-
bars.forEach(function (bar, i) {
|
|
208
|
-
bar.style.left = (edge - 8 - barInset(laneOf(grids[i]))) + 'px';
|
|
209
|
-
var first = spot(lineno(grids[i].getAttribute('data-first')), box);
|
|
210
|
-
var last = spot(lineno(grids[i].getAttribute('data-last')), box);
|
|
211
|
-
bar.style.top = first.top + 'px';
|
|
212
|
-
bar.style.height = (last.bottom - first.top) + 'px';
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Places the bars and whichever tree or grid is open.
|
|
192
|
+
// Places whichever card is open; with none open the rail is
|
|
193
|
+
// only as tall as the code.
|
|
217
194
|
function place() {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
if (!panel.hidden) { placeOne(panel); }
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// The trees in the left rail, the grids in the right, the bars
|
|
225
|
-
// on the code's right edge, nothing open.
|
|
226
|
-
function beside() {
|
|
227
|
-
box.insertBefore(ccRail, code);
|
|
228
|
-
box.appendChild(pcRail);
|
|
229
|
-
trees.forEach(function (tree) { ccRail.appendChild(tree); });
|
|
230
|
-
grids.forEach(function (grid) { pcRail.appendChild(grid); });
|
|
231
|
-
bars.forEach(function (bar) { box.appendChild(bar); });
|
|
232
|
-
bands.forEach(function (band) { code.appendChild(band); });
|
|
233
|
-
code.addEventListener('scroll', placeBands);
|
|
234
|
-
openOnly(null);
|
|
235
|
-
placeBars();
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// The code span of line n, whether a plain line or one of a
|
|
239
|
-
// site's lines.
|
|
240
|
-
function srcOf(n) {
|
|
241
|
-
var number = lineno(n);
|
|
242
|
-
if (!number) { return null; }
|
|
243
|
-
var button = number.closest('button.lnum');
|
|
244
|
-
if (!button) { return number.parentElement.querySelector('.src'); }
|
|
245
|
-
var index = Array.prototype.indexOf.call(button.querySelectorAll('.lineno'), number);
|
|
246
|
-
return button.closest('.block').querySelectorAll('.srcs > .src')[index];
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// [first, last] from a "first,last" attribute, null for "".
|
|
250
|
-
function span(text) {
|
|
251
|
-
return text ? text.split(',').map(Number) : null;
|
|
195
|
+
rail.style.minHeight = '';
|
|
196
|
+
grids.forEach(function (grid) { if (!grid.hidden) { placeGrid(grid); } });
|
|
252
197
|
}
|
|
253
198
|
|
|
199
|
+
// The code spans lit for the card row hovered.
|
|
254
200
|
var lit = [];
|
|
255
|
-
var chips = [];
|
|
256
|
-
var hot = [];
|
|
257
201
|
|
|
258
202
|
// Lights the code of every line in span, [first, last].
|
|
259
203
|
function light(lines) {
|
|
260
|
-
if (!lines) { return; }
|
|
261
204
|
for (var n = lines[0]; n <= lines[1]; n++) {
|
|
262
205
|
var src = srcOf(n);
|
|
263
206
|
if (src) { src.classList.add('lit'); lit.push(src); }
|
|
264
207
|
}
|
|
265
208
|
}
|
|
266
209
|
|
|
267
|
-
//
|
|
268
|
-
function chip(n, text) {
|
|
269
|
-
var number = lineno(n);
|
|
270
|
-
if (!number) { return; }
|
|
271
|
-
var nav = number.closest('.line, .block').querySelector('.nav');
|
|
272
|
-
nav.setAttribute('data-chip', text);
|
|
273
|
-
chips.push(nav);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// Undoes the lights and chips of the last path shown.
|
|
210
|
+
// Unlights the code lit.
|
|
277
211
|
function clear() {
|
|
278
212
|
lit.forEach(function (src) { src.classList.remove('lit'); });
|
|
279
|
-
chips.forEach(function (nav) { nav.removeAttribute('data-chip'); });
|
|
280
|
-
hot.forEach(function (cell) { cell.classList.remove('hot'); });
|
|
281
213
|
lit = [];
|
|
282
|
-
chips = [];
|
|
283
|
-
hot = [];
|
|
284
214
|
}
|
|
285
215
|
|
|
286
|
-
|
|
287
|
-
// decision it makes, its if lit with the arm taken and its
|
|
288
|
-
// end, T lighting the then arm, F the else (none without
|
|
289
|
-
// one), and a T or F chip in the gutter. Decisions after a
|
|
290
|
-
// path leaves early stay unlit.
|
|
291
|
-
function show(grid, col) {
|
|
292
|
-
clear();
|
|
293
|
-
grid.querySelectorAll('.prow').forEach(function (row) {
|
|
294
|
-
var cell = row.querySelectorAll('.pcell')[col];
|
|
295
|
-
cell.classList.add('hot');
|
|
296
|
-
hot.push(cell);
|
|
297
|
-
if (row.classList.contains('calls') || cell.classList.contains('ended')) { return; }
|
|
298
|
-
var taken = cell.classList.contains('true');
|
|
299
|
-
light(span(row.getAttribute('data-head')));
|
|
300
|
-
light(span(row.getAttribute(taken ? 'data-then' : 'data-else')));
|
|
301
|
-
light(span(row.getAttribute('data-end')));
|
|
302
|
-
chip(Number(row.getAttribute('data-line')), taken ? 'T' : 'F');
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// The pinned path, { grid, col }, shown whenever no other is
|
|
307
|
-
// hovered; null when none is pinned.
|
|
308
|
-
var pinned = null;
|
|
309
|
-
|
|
310
|
-
// The grid and column of a cell.
|
|
311
|
-
function columnOf(cell) {
|
|
312
|
-
var cells = Array.prototype.slice.call(cell.parentElement.querySelectorAll('.pcell'));
|
|
313
|
-
return { grid: cell.closest('.pathgrid'), col: cells.indexOf(cell) };
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// Pins column, or unpins with null, outlining the pinned
|
|
317
|
-
// column's cells.
|
|
318
|
-
function pin(column) {
|
|
319
|
-
document.querySelectorAll('.pcell.pinned').forEach(function (cell) {
|
|
320
|
-
cell.classList.remove('pinned');
|
|
321
|
-
});
|
|
322
|
-
pinned = column;
|
|
323
|
-
if (!column) { return; }
|
|
324
|
-
column.grid.querySelectorAll('.prow').forEach(function (row) {
|
|
325
|
-
row.querySelectorAll('.pcell')[column.col].classList.add('pinned');
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// Shows the pinned path, or nothing when none is pinned.
|
|
330
|
-
function showPinned() {
|
|
331
|
-
if (pinned) { show(pinned.grid, pinned.col); } else { clear(); }
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
pcRail.addEventListener('mouseover', function (event) {
|
|
335
|
-
var cell = event.target.closest('.pathgrid .pcell');
|
|
336
|
-
if (!cell) { return; }
|
|
337
|
-
var column = columnOf(cell);
|
|
338
|
-
show(column.grid, column.col);
|
|
339
|
-
});
|
|
340
|
-
pcRail.addEventListener('mouseleave', showPinned);
|
|
216
|
+
rail.addEventListener('mouseleave', clear);
|
|
341
217
|
|
|
342
218
|
// The code spans whose characters are marked, with the text
|
|
343
219
|
// each had before.
|
|
@@ -348,62 +224,12 @@
|
|
|
348
224
|
return text.match(/^\s*/)[0].length;
|
|
349
225
|
}
|
|
350
226
|
|
|
351
|
-
// Puts back every span marked as it was
|
|
227
|
+
// Puts back every span marked as it was.
|
|
352
228
|
function unmarkChars() {
|
|
353
229
|
markedSrcs.forEach(function (entry) { entry.src.innerHTML = entry.html; });
|
|
354
230
|
markedSrcs = [];
|
|
355
231
|
}
|
|
356
232
|
|
|
357
|
-
// Tints each site's own characters by its status, gaps when
|
|
358
|
-
// any of its paths was never taken, rather than its whole
|
|
359
|
-
// lines; where sites overlap, gaps wins.
|
|
360
|
-
function tintSites() {
|
|
361
|
-
var perLine = {};
|
|
362
|
-
document.querySelectorAll('.tree .site').forEach(function (site) {
|
|
363
|
-
var row = site.querySelector('.row[data-at]');
|
|
364
|
-
if (!row) { return; }
|
|
365
|
-
var at = row.getAttribute('data-at').split(',').map(Number);
|
|
366
|
-
var gaps = site.querySelector('.count.never') !== null;
|
|
367
|
-
for (var n = at[0]; n <= at[2]; n++) {
|
|
368
|
-
(perLine[n] = perLine[n] || []).push({
|
|
369
|
-
from: n === at[0] ? at[1] : -1, to: n === at[2] ? at[3] : Infinity,
|
|
370
|
-
status: gaps ? 'gaps' : 'covered'
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
Object.keys(perLine).forEach(function (n) {
|
|
375
|
-
var src = srcOf(n);
|
|
376
|
-
if (!src) { return; }
|
|
377
|
-
var text = src.textContent;
|
|
378
|
-
var marks = text.split('').map(function () { return null; });
|
|
379
|
-
perLine[n].forEach(function (span) {
|
|
380
|
-
// A continuation line (from -1) is tinted from its first
|
|
381
|
-
// character after the indent.
|
|
382
|
-
var from = span.from < 0 ? indentOf(text) : span.from;
|
|
383
|
-
for (var i = from; i < Math.min(span.to, text.length); i++) {
|
|
384
|
-
if (marks[i] !== 'gaps') { marks[i] = span.status; }
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
src.textContent = '';
|
|
388
|
-
var i = 0;
|
|
389
|
-
while (i < text.length) {
|
|
390
|
-
var j = i;
|
|
391
|
-
while (j < text.length && marks[j] === marks[i]) { j++; }
|
|
392
|
-
var part = text.slice(i, j);
|
|
393
|
-
if (marks[i]) {
|
|
394
|
-
var mark = document.createElement('mark');
|
|
395
|
-
mark.className = 'site';
|
|
396
|
-
mark.setAttribute('data-status', marks[i]);
|
|
397
|
-
mark.textContent = part;
|
|
398
|
-
src.appendChild(mark);
|
|
399
|
-
} else {
|
|
400
|
-
src.appendChild(document.createTextNode(part));
|
|
401
|
-
}
|
|
402
|
-
i = j;
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
|
-
|
|
407
233
|
// Marks the characters from line l1, column c1 to line l2,
|
|
408
234
|
// column c2, each line's part in a mark of its own.
|
|
409
235
|
function markChars(l1, c1, l2, c2) {
|
|
@@ -415,16 +241,67 @@
|
|
|
415
241
|
var from = n === l1 ? c1 : indentOf(text);
|
|
416
242
|
var to = n === l2 ? c2 : text.length;
|
|
417
243
|
markedSrcs.push({ src: src, html: src.innerHTML });
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
src.appendChild(document.createTextNode(text.slice(to)));
|
|
244
|
+
paint(src, function (i) { return i >= from && i < to ? 'chars' : null; }, function () {
|
|
245
|
+
var mark = document.createElement('mark');
|
|
246
|
+
mark.className = 'chars';
|
|
247
|
+
return mark;
|
|
248
|
+
});
|
|
424
249
|
}
|
|
425
250
|
reveal(document.querySelectorAll('mark.chars'));
|
|
426
251
|
}
|
|
427
252
|
|
|
253
|
+
// The colour class of each of src's characters, the class of the
|
|
254
|
+
// token span it is in, null for one in none.
|
|
255
|
+
function tokensOf(src) {
|
|
256
|
+
var tokens = [];
|
|
257
|
+
var walker = document.createTreeWalker(src, NodeFilter.SHOW_TEXT);
|
|
258
|
+
for (var node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
259
|
+
var parent = node.parentNode;
|
|
260
|
+
var css = parent !== src && parent.tagName === 'SPAN' ? parent.className : null;
|
|
261
|
+
for (var i = 0; i < node.length; i++) { tokens.push(css); }
|
|
262
|
+
}
|
|
263
|
+
return tokens;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Rebuilds src's code, each run of characters keyAt gives one key
|
|
267
|
+
// to in the element wrap makes of that key, the others bare, every
|
|
268
|
+
// character still in a span of its token's colour class.
|
|
269
|
+
function paint(src, keyAt, wrap) {
|
|
270
|
+
var text = src.textContent;
|
|
271
|
+
var tokens = tokensOf(src);
|
|
272
|
+
src.textContent = '';
|
|
273
|
+
var i = 0;
|
|
274
|
+
while (i < text.length) {
|
|
275
|
+
var j = i;
|
|
276
|
+
var key = keyAt(i);
|
|
277
|
+
while (j < text.length && keyAt(j) === key) { j++; }
|
|
278
|
+
var holder = key ? wrap(key) : src;
|
|
279
|
+
appendTokens(holder, text, tokens, i, j);
|
|
280
|
+
if (key) { src.appendChild(holder); }
|
|
281
|
+
i = j;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Appends text's characters i to j to holder, each run of one
|
|
286
|
+
// token class in a span of that class, the rest bare.
|
|
287
|
+
function appendTokens(holder, text, tokens, i, j) {
|
|
288
|
+
var k = i;
|
|
289
|
+
while (k < j) {
|
|
290
|
+
var m = k;
|
|
291
|
+
while (m < j && tokens[m] === tokens[k]) { m++; }
|
|
292
|
+
var part = text.slice(k, m);
|
|
293
|
+
if (tokens[k]) {
|
|
294
|
+
var span = document.createElement('span');
|
|
295
|
+
span.className = tokens[k];
|
|
296
|
+
span.textContent = part;
|
|
297
|
+
holder.appendChild(span);
|
|
298
|
+
} else {
|
|
299
|
+
holder.appendChild(document.createTextNode(part));
|
|
300
|
+
}
|
|
301
|
+
k = m;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
428
305
|
// The width of the code pane's left columns (gap arrows and
|
|
429
306
|
// line numbers), which code scrolls under.
|
|
430
307
|
var GUTTER = 108;
|
|
@@ -447,115 +324,147 @@
|
|
|
447
324
|
if (shift !== 0) { code.scrollBy({ left: shift, behavior: 'smooth' }); }
|
|
448
325
|
}
|
|
449
326
|
|
|
450
|
-
// Hovering a
|
|
451
|
-
// its operand, or of its operator's whole
|
|
327
|
+
// Hovering a row of a fold in a card marks in the code the
|
|
328
|
+
// characters of its operand, or of its operator's whole
|
|
329
|
+
// condition.
|
|
452
330
|
var markedRow = null;
|
|
453
|
-
|
|
454
|
-
var row = event.target.closest('.
|
|
331
|
+
rail.addEventListener('mouseover', function (event) {
|
|
332
|
+
var row = event.target.closest('.fold .row[data-at]');
|
|
455
333
|
if (row === markedRow) { return; }
|
|
456
334
|
markedRow = row;
|
|
457
335
|
if (!row) { unmarkChars(); return; }
|
|
458
336
|
var at = row.getAttribute('data-at').split(',').map(Number);
|
|
459
337
|
markChars(at[0], at[1], at[2], at[3]);
|
|
460
338
|
});
|
|
461
|
-
|
|
339
|
+
rail.addEventListener('mouseleave', function () {
|
|
462
340
|
markedRow = null;
|
|
463
341
|
unmarkChars();
|
|
464
342
|
});
|
|
465
343
|
|
|
466
|
-
//
|
|
467
|
-
// the
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
344
|
+
// Hovering a statement's row in a card lights its line in the
|
|
345
|
+
// code, scrolling the page only when that line is out of view.
|
|
346
|
+
var litRow = null;
|
|
347
|
+
rail.addEventListener('mouseover', function (event) {
|
|
348
|
+
var row = event.target.closest('.statements .prow[data-line]:not(.calls)');
|
|
349
|
+
if (row === litRow) { return; }
|
|
350
|
+
litRow = row;
|
|
351
|
+
clear();
|
|
352
|
+
if (!row) { return; }
|
|
353
|
+
var n = Number(row.getAttribute('data-line'));
|
|
354
|
+
light([n, n]);
|
|
355
|
+
// A number's scroll margin keeps it clear of the sticky header
|
|
356
|
+
// and the def line stuck below it.
|
|
357
|
+
lineno(n).scrollIntoView({ block: 'nearest', behavior: 'smooth' });
|
|
475
358
|
});
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
359
|
+
rail.addEventListener('mouseleave', function () { litRow = null; });
|
|
360
|
+
|
|
361
|
+
// A click on a site's row in a card unfolds that site's tree in
|
|
362
|
+
// the row's place, folding up any other open; a click on the row
|
|
363
|
+
// of the one open, or on its fold's first row, which stands in
|
|
364
|
+
// the row's place, folds it back.
|
|
365
|
+
rail.addEventListener('click', function (event) {
|
|
366
|
+
if (event.target.closest('.fold .site > .row:first-child')) { unfold(null); return; }
|
|
367
|
+
var row = event.target.closest('.statements .prow.site');
|
|
368
|
+
var fold = row && row.nextElementSibling;
|
|
369
|
+
if (!fold || !fold.classList.contains('fold')) { return; }
|
|
370
|
+
unfold(fold.hidden ? fold : null);
|
|
479
371
|
});
|
|
480
372
|
|
|
481
|
-
//
|
|
482
|
-
// site's
|
|
483
|
-
//
|
|
373
|
+
// Shows fold alone, null folding them all up, the arrow of each
|
|
374
|
+
// site's row pointing up while its fold shows; then places the
|
|
375
|
+
// open card again, as its height has changed.
|
|
376
|
+
function unfold(fold) {
|
|
377
|
+
rail.querySelectorAll('.fold').forEach(function (each) {
|
|
378
|
+
each.hidden = each !== fold;
|
|
379
|
+
var arrow = each.previousElementSibling.querySelector('.fold-arrow');
|
|
380
|
+
arrow.setAttribute('aria-expanded', String(each === fold));
|
|
381
|
+
});
|
|
382
|
+
place();
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// Opening one card closes the others, and a click never closes
|
|
386
|
+
// the one open, so the rail always shows one. A click on a def
|
|
387
|
+
// line opens its method's card; one on a loose site's lines opens
|
|
388
|
+
// their top card; a gutter arrow or a header jump opens the card
|
|
389
|
+
// at the line it jumps to.
|
|
484
390
|
document.addEventListener('click', function (event) {
|
|
485
|
-
var
|
|
486
|
-
if (
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
}
|
|
491
|
-
var
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
var number = line.querySelector('.lineno').getAttribute('data-line');
|
|
495
|
-
var method = grids.filter(function (g) { return g.getAttribute('data-first') === number; })[0];
|
|
496
|
-
if (method) { openOnly(method.hidden ? method : null); }
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
499
|
-
var block = event.target.closest('.block');
|
|
500
|
-
if (block && !event.target.closest('button, a')) {
|
|
501
|
-
block.querySelector('button[aria-controls]').click();
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
var button = event.target.closest('button.lnum');
|
|
505
|
-
if (button) {
|
|
506
|
-
var tree = document.getElementById(button.getAttribute('aria-controls'));
|
|
507
|
-
openOnly(tree.hidden ? null : tree);
|
|
508
|
-
return;
|
|
509
|
-
}
|
|
510
|
-
var arrow = event.target.closest('.nav a, a.jump');
|
|
511
|
-
if (arrow) {
|
|
512
|
-
var target = document.getElementById('tree-' + arrow.hash.slice(2));
|
|
513
|
-
if (target) { openOnly(target); }
|
|
514
|
-
}
|
|
391
|
+
var link = event.target.closest('.nav a, a.jump');
|
|
392
|
+
if (link) { openOnly(document.getElementById('paths-' + link.hash.slice(2))); return; }
|
|
393
|
+
if (event.target.closest('a')) { return; }
|
|
394
|
+
var loose = event.target.closest('.block');
|
|
395
|
+
var button = loose && loose.querySelector('button.lnum.loose');
|
|
396
|
+
if (button) { openOnly(document.getElementById(button.getAttribute('aria-controls'))); return; }
|
|
397
|
+
var row = event.target.closest('.line, .block');
|
|
398
|
+
var number = row && row.querySelector('.lineno.mdef');
|
|
399
|
+
if (number) { openOnly(grids[defs.indexOf(number)]); }
|
|
515
400
|
});
|
|
516
401
|
|
|
517
402
|
window.addEventListener('resize', place);
|
|
518
|
-
window.addEventListener('scroll', function () {
|
|
519
|
-
grids.forEach(function (grid) { if (!grid.hidden) { placeGrid(grid); } });
|
|
520
|
-
});
|
|
521
403
|
|
|
522
|
-
//
|
|
523
|
-
//
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
404
|
+
// The card of the innermost method whose def to end hold line n,
|
|
405
|
+
// or of the top card holding it, so a linked line in a body is
|
|
406
|
+
// never left folded away; null when none holds n.
|
|
407
|
+
function cardOf(n) {
|
|
408
|
+
var holding = grids.filter(function (grid) { return firstOf(grid) <= n && n <= lastOf(grid); });
|
|
409
|
+
return holding.length ? holding[holding.length - 1] : null;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// On a page at a linked line, eg #L8, opens the card holding it.
|
|
413
|
+
// Otherwise opens the first card with gaps, or, with none, the
|
|
414
|
+
// first card, its first line scrolled into view, so one is always
|
|
415
|
+
// open, every other method's body folded under its def line;
|
|
416
|
+
// opens nothing only on a page with no card at all.
|
|
417
|
+
function openFirst() {
|
|
418
|
+
var linked = /^#L(\d+)$/.exec(window.location.hash);
|
|
419
|
+
var own = linked && cardOf(Number(linked[1]));
|
|
420
|
+
if (own) { openOnly(own); return; }
|
|
421
|
+
var jump = document.querySelector('.jump-list a.jump');
|
|
422
|
+
var card = jump ? cardOf(Number(jump.hash.slice(2))) : grids[0];
|
|
423
|
+
if (!card) { openOnly(null); return; }
|
|
424
|
+
lineno(firstOf(card)).scrollIntoView({ block: 'center' });
|
|
425
|
+
openOnly(card);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// Keeps the header, the open card and its def line in view as the
|
|
429
|
+
// page scrolls, and as a pinch-zoomed view pans or zooms. Pinch
|
|
430
|
+
// zoom pans a lens over the page, which CSS sticky ignores, so
|
|
431
|
+
// the header is shifted down by the lens's pan; the card and def
|
|
432
|
+
// line then follow the header's drawn bottom.
|
|
433
|
+
function followView() {
|
|
434
|
+
var pan = window.visualViewport ? window.visualViewport.offsetTop : 0;
|
|
435
|
+
document.querySelector('.head').style.transform = pan > 0 ? 'translateY(' + pan + 'px)' : '';
|
|
436
|
+
place();
|
|
437
|
+
stickDef();
|
|
438
|
+
}
|
|
439
|
+
window.addEventListener('scroll', followView);
|
|
440
|
+
window.addEventListener('resize', stickDef);
|
|
441
|
+
if (window.visualViewport) {
|
|
442
|
+
window.visualViewport.addEventListener('scroll', followView);
|
|
443
|
+
window.visualViewport.addEventListener('resize', followView);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Keeps the def line of the open method in view: once it would
|
|
447
|
+
// scroll up under the sticky header, it is shifted down to sit
|
|
448
|
+
// just below it, over the body lines passing beneath, but never
|
|
449
|
+
// past the method's last line. The code pane scrolls sideways, so
|
|
450
|
+
// CSS sticky, which would stick within the pane, cannot do this.
|
|
451
|
+
function stickDef() {
|
|
452
|
+
grids.forEach(function (grid) {
|
|
453
|
+
var row = rowOf(firstOf(grid));
|
|
454
|
+
row.style.transform = '';
|
|
455
|
+
row.classList.remove('def-stuck');
|
|
456
|
+
if (grid.hidden) { return; }
|
|
457
|
+
var head = document.querySelector('.head').getBoundingClientRect().bottom;
|
|
458
|
+
var rect = row.getBoundingClientRect();
|
|
459
|
+
var last = lineno(lastOf(grid)).getBoundingClientRect();
|
|
460
|
+
var shift = Math.min(head - rect.top, last.bottom - rect.bottom);
|
|
461
|
+
if (shift <= 0) { return; }
|
|
462
|
+
row.style.transform = 'translateY(' + shift + 'px)';
|
|
463
|
+
row.classList.add('def-stuck');
|
|
553
464
|
});
|
|
554
465
|
}
|
|
555
466
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
tintSites();
|
|
560
|
-
beside();
|
|
467
|
+
var kept = keptRail();
|
|
468
|
+
if (kept > 0) { setRail(kept); }
|
|
469
|
+
openFirst();
|
|
561
470
|
})();
|