User:Proteins/unindent.js: Difference between revisions

Content deleted Content added
Proteins (talk | contribs)
m proper conditional
Proteins (talk | contribs)
improve code for counting prose size
Line 27:
var top_DD_node;
 
var byte_countuntagged_text;
var num_child_nodesbyte_count = 0;
var num_child_nodes = 0;
 
// Colors to help sighted people after the unindenting
Line 50 ⟶ 51:
num_child_nodes = temp_DD_element.childNodes.length;
if (!num_child_nodes) { continue; } // ignore empty DD elements
 
byte_countuntagged_text = temp_DD_element.innerHTML.replace(/(<([^>]+)>)/ig,"").replace(/\s/ig, "").length; // remove HTML tags
byte_count = untagged_text.replace(/\s/ig, "").length; // remove whitespaces
if (byte_count < 1) { continue; }