$( document ).ready(function() { var styleCSS = ""; var count = 1; $("table:not(.dataTable)").each(function( i ) { if (! $(this).parent().hasClass( "table-scroll" ) ) { $(this).wrap( "
" ); } $(this).removeAttr( "border" ); $(this).removeAttr( "cellspacing" ); $(this).removeAttr( "cellpadding" ); $(this).removeAttr( "align" ); $(this).removeAttr( "width" ); }); $("table *").each(function( i ) { /* Swaps Width Attribute to Class */ if ( $( this )[0].hasAttribute("width") ) { var classWidth = $( this ).attr( "width" ); if ( classWidth.includes("%") ) { $( this ).addClass( ( "widthperc" + classWidth ) ); var additionalCSS = " .widthperc" + classWidth + " { width: " + classWidth + "; }"; if ( !styleCSS.includes( additionalCSS ) ) { styleCSS += additionalCSS; } } else { $( this ).addClass( ( "width" + classWidth ) ); var additionalCSS = " .width" + classWidth + " { width: " + classWidth + "px; }"; if ( !styleCSS.includes( additionalCSS ) ) { styleCSS += additionalCSS; } } $( this ).removeAttr( "width" ); } /* Removes Height Attribute */ if ( $( this )[0].hasAttribute("height") ) { $( this ).removeAttr( "height" ); } /* Swaps valign Attribute to Class */ if ( $( this )[0].hasAttribute("valign") ) { var vAlign = $( this ).attr( "valign" ); $( this ).addClass( ( "valign" + vAlign ) ); var additionalCSS = " .valign" + vAlign + " { vertical-align: " + vAlign + "; }"; if ( !styleCSS.includes( additionalCSS ) ) { styleCSS += additionalCSS; } $( this ).removeAttr( "valign" ); } /* Swaps align Attribute to Class */ if ( $( this )[0].hasAttribute("align") ) { var align = $( this ).attr( "align" ); $( this ).addClass( ( "align" + align ) ); var additionalCSS = " .align" + align + " { text-align: " + align + "; }"; if ( !styleCSS.includes( additionalCSS ) ) { styleCSS += additionalCSS; } $( this ).removeAttr( "align" ); } /* Swaps nowrap Attribute to Class */ if ( $( this )[0].hasAttribute("nowrap") ) { var nowrap = $( this ).attr( "nowrap" ); $( this ).addClass( ( "nowrap" + nowrap ) ); var additionalCSS = " .nowrap" + nowrap + " { white-space: " + nowrap + "; }"; if ( !styleCSS.includes( additionalCSS ) ) { styleCSS += additionalCSS; } $( this ).removeAttr( "nowrap" ); } }); var styleText = ""; var styleNode = $( styleText ); $("footer").after( styleNode ); });