User:Proteins/unindent.js: Difference between revisions

Content deleted Content added
Proteins (talk | contribs)
loop over the DD elements twice
Proteins (talk | contribs)
code for skipping blank lines
Line 26:
var top_DL_node;
var top_DD_node;
 
var byte_count;
var num_child_nodes;
 
// Colors to help sighted people after the unindenting
Line 44 ⟶ 47:
temp_DD_element = DD_elements[DD_element_index];
 
// Skip empty DD elements
indent_level = 0;
num_child_nodes = temp_DD_element.childNodes.length;
if (num_child_nodes = 0) { continue; } // ignore empty DD elements
byte_count = temp_DD_element.replace(/(<([^>]+)>)/ig,"").replace(/\s/ig, "").length; // remove HTML tags
if (byte_count < 1) { continue; }
 
// Find the topmost DL element for this DD node
indent_level = 0;
top_DL_node = null;
top_DD_node = null;