( function( $ ) { // Remove Empty Containers function initRemoveEmpty( $elem ) { $( $elem ).each( function() { var $this = $( this ); if ( $this.html().replace(/\s| /g, '' ).length == 0 ) { $this.remove(); } } ); } initRemoveEmpty( $( '.post-content---ct_cr > *' ) ); initRemoveEmpty( $( '.main-navi---a' ) ); initRemoveEmpty( $( '.menu-item' ) ); // Widget Content $( '.widget-content---ct_cr > *' ).each( function() { var $this = $( this ); if ( $this.html().replace(/\s| /g, '' ).length == 0 ) { $this.closest( '.widget' ).addClass( 'widget--zero-length' ); } } ); $( '.widget_categories .widget-content---ct_cr > *:has( .cat-item-none )' ).each( function() { var $this = $( this ); $this.closest( '.widget' ).addClass( 'widget--empty' ); } ); // Private and Protected Post Titles ( function() { var $main = $( '#main' ), $privatePostTitle = $main.find( $( '.main-post-title---l:contains("Private:")' ) ), $protectedPostTitle = $main.find( $( '.main-post-title---l:contains("Protected:")' ) ); $privatePostTitle.html( function( _, html ) { return html.split("Private:").join("Private:"); } ); $protectedPostTitle.html( function( _, html ) { return html.split("Protected:").join("Protected:"); } ); } )(); } )( jQuery );