Content deleted Content added
check that the basic loop is OK before going on |
begin to add code to main loop over diff table data |
||
Line 43:
var mw_diff_ntitle4 = "";
var num_diff_context_lines = 0;
var intermediate_revisions = "";
var num_line_numbers = 0;
var
var
var
var
var num_additions = 0;
Line 151 ⟶ 152:
// Loop over the rows in the difference table
intermediate_revisions = "";
for (table_row_index=0; table_row_index<num_diff_table_rows; table_row_index++) {
temp_table_row = diff_table_rows[table_row_index];
Line 160 ⟶ 162:
if (!num_table_row_data) { continue; }
line_number_flag = 0;
num_diff_addlines = 0;
num_diff_deletedlines = 0;
num_diff_context_lines = 0;
num_diff_undefined_lines = 0;
for (table_datum_index=0; table_datum_index<num_table_row_data; table_datum_index++) {
temp_table_datum = table_row_data[table_datum_index];
if (!temp_table_datum) { continue; }
if (temp_table_datum.className == "diff-lineno") {
if (line_number_flag == 0) {
line_number_flag = 1;
} else if (line_number_flag == 1) {
line_number_flag = 2;
} else if (line_number_flag == 2) {
// ignore this table_datum as anomalous
// there should be only two line numbers in any table row
} else {
alert_string = "ERROR: Line_number_flag = " + line_number_flag + " in datum " + table_datum_index + " of diff table row " + table_row_index + ".\n";
window.alert(alert_string);
return;
}
} else if (temp_table_datum.className == "diff-multi") {
if (temp_table_datum.firstChild.nodeType == 3) {
intermediate_revisions = temp_table_datum.firstChild.data;
}
} else if (temp_table_datum.className == "diff-context") {
num_diff_context_lines++;
} else if (temp_table_datum.className == "diff-addedline") {
num_diff_addedlines++;
} else if (temp_table_datum.className == "diff-deletedline") {
num_diff_addedlines++;
} else if (temp_table_datum.className == "diff-marker") {
// do nothing
} else {
num_diff_undefined_lines++;
} // closes classification of the table datum
} // closes loop over the data within a table row
} // closes loop over the table rows
|