Difference between revisions of "Team:Czech Republic/Template:Scripts"

Line 34: Line 34:
  
 
<script>
 
<script>
window.onload = function(){
+
jQuery(document).ready(function() {
        window.document.body.onload = removeEmpty;
+
    jQuery('p').each(function() {
};
+
        var $this = jQuery(this);
 
+
         if($this.html().replace(/\s|&nbsp;/g, '').length == 0) {
function removeEmpty()
+
             $this.remove();
{
+
var paragraphs = document.getElementsByTagName("p");
+
for (var i = 0, len = paragraphs.length; i < len; i++) {
+
    var elem = paragraphs[i];
+
    if (elem.childElementCount == 0) {
+
         if (elem.textContent.trim() == '') {
+
             elem.parentNode.removeChild(elem);
+
            i--;
+
            len--;
+
 
         }
 
         }
     }
+
     });
}
+
});
}
+
 
</script>
 
</script>
  

Revision as of 07:06, 10 September 2015