// basic helpers
function add_button(parent_td, label, disabled, onclick) {
// add button to td to run onclick (after updating dat_lines from inputs,
- // and followed by calling taint and update_form
+ // and followed by calling taint and update_form)
const btn = document.createElement("button");
parent_td.appendChild(btn);
btn.textContent = label;
btn.type = "button"; // otherwise will act as form submit
btn.disabled = disabled;
btn.onclick = function() {
- let n_lines_jumped = 0;
+ let n_rows_jumped = 0; // to ignore table rows not representing dat_lines
for (let i = 0; i < table.rows.length; i++) {
const row = table.rows[i];
if (row.classList.contains('warning')) {
- n_lines_jumped++;
+ n_rows_jumped++;
continue;
};
for (const input of table.rows[i].querySelectorAll('td input')) {
- const line_to_update = dat_lines[i - n_lines_jumped];
+ const line_to_update = dat_lines[i - n_rows_jumped];
if (input.name.endsWith('comment')) {
line_to_update.comment = input.value;
} else if (input.name.endsWith('error')) {
}
}
}
- onclick();
- taint();
- update_form();
+ onclick();
+ taint();
+ update_form();
};
}
function add_td(tr, colspan=1) {