업데이트 README.md, .github/README.en.md
[liberty-mw-skin.git] / js / table.js
blobde7efea9848a4b7a8297113f0ec39d149f647508
1 ( function () {
2         function tablewrap() {
3                 var z = document.getElementById( 'mw-content-text' ).clientWidth,
4                         x = document.querySelectorAll( '#mw-content-text table' ),
5                         i, y;
6                 for ( i = x.length; i--; ) {
7                         y = document.createElement( 'div' );
8                         y.className = 'liberty-table-wrapper';
9                         if ( x[ i ].clientWidth > z && x[ i ].parentNode.className !== 'liberty-table-wrapper' ) {
10                                 x[ i ].parentNode.insertBefore( y, x[ i ] );
11                                 y.appendChild( x[ i ] );
12                         } else if ( x[ i ].clientWidth < z && x[ i ].parentNode.className === 'liberty-table-wrapper' ) {
13                                 x[ i ].parentNode.parentNode.insertBefore( x[ i ], x[ i ].parentNode );
14                                 x[ i ].nextSibling.remove();
15                         }
16                 }
17         }
18         window.onresize = function () {
19                 tablewrap();
20         };
21         window.onload = function () {
22                 tablewrap();
23         };
24 }() );