1// wait for page to be loaded to run 2jQuery(document).ready(function() { 3 4 // select all p tags and loop through them 5 jQuery('p').each(function() { 6 7 // check if the p element contains only blank space using the trim method 8 // then remove it 9 var pHTML = jQuery(this).html(); 10 if( jQuery.trim( pHTML ) == '' || pHTML == ' ') { 11 jQuery(this).hide(); 12 } 13 14 /* but what if this paragraph has children? */ 15 var children = jQuery(this).children(); 16 17 // if this paragraph has children 18 if (children) { 19 20 //loop through each child 21 var counter = 0; 22 23 24 for (i = 0; i < children.length; i++) { 25 26 // Get child HTML 27 var child = children[i]; 28 var childHTML = jQuery(child).html(); 29 30 //is this child empty? 31 if (jQuery.trim( childHTML ) == '' || childHTML == ' ') { 32 // yes, add 1 to the counter 33 counter++; 34 } 35 36 // are all the children empty? 37 // check if counter is equal to children.length 38 if ( counter == children.length) { 39 jQuery(this).hide(); 40 } 41 42 43 } 44 } 45 46 47 }); 48 49 // Failsafes unhide HTML elements which are commonly "empty" 50 jQuery('p').has('area').show(); 51 jQuery('p').has('base').show(); 52 jQuery('p').has('br').show(); 53 jQuery('p').has('button').show(); 54 jQuery('p').has('canvas').show(); 55 jQuery('p').has('col').show(); 56 jQuery('p').has('command').show(); 57 jQuery('p').has('embed').show(); 58 jQuery('p').has('form').show(); 59 jQuery('p').has('hr').show(); 60 jQuery('p').has('iframe').show(); 61 jQuery('p').has('img').show(); 62 jQuery('p').has('input').show(); 63 jQuery('p').has('keygen').show(); 64 jQuery('p').has('link').show(); 65 jQuery('p').has('meta').show(); 66 jQuery('p').has('object').show(); 67 jQuery('p').has('param').show(); 68 jQuery('p').has('select').show(); 69 jQuery('p').has('source').show(); 70 jQuery('p').has('textarea').show(); 71 jQuery('p').has('track').show(); 72 jQuery('p').has('video').show(); 73 jQuery('p').has('wbr').show(); 74 75});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.