Content deleted Content added
flip sign of the conditional |
visual refinement of the output when the script is repeated on the same article |
||
Line 19:
var num_DD_elements = 0;
var DD_element_index = 0;
var num_unindented_DD_elements = 0;
var num_higher_level_DD_elements = 0;
var top_node;
Line 52 ⟶ 54:
// First-pass loop colors the links and adds the level to the beginning
diagnostic_string = "";
num_unindented_DD_elements = 0;
num_higher_level_DD_elements = 0;
for (DD_element_index=0; DD_element_index<num_DD_elements; DD_element_index++) {
temp_DD_element = DD_elements[DD_element_index];
child_node = temp_DD_element.firstChild;
if (child_node) {
if ((child_node.nodeType == 3) && (child_node.data.match(/^\(Indent\s\d+\)/))) {
continue;
} // add "(Indent #)" to beginning if it isn't there already
}
num_sub_DL_elements = temp_DD_element.getElementsByTagName("DL").length;
Line 97 ⟶ 109:
parent_node = parent_node.parentNode;
} // closes loop climbing up the document tree
if (indent_level > 2) { num_higher_level_DD_elements++; }
if (indent_level > 0) {
Line 137 ⟶ 151:
// window.alert(diagnostic_string);
// Prevents repeated applications of the script from changing the colors
if (num_higher_level_DD_elements == 0) { return; }
// Second-pass loop changes the document tree structure
|