미디어위키:Liberty.js: 두 판 사이의 차이

편집 요약 없음
태그: 수동 되돌리기
편집 요약 없음
1번째 줄: 1번째 줄:
/* 이 자바스크립트 설정은 리버티 스킨을 사용하는 사용자에게 적용됩니다 */
/* 이 자바스크립트 설정은 리버티 스킨을 사용하는 사용자에게 적용됩니다 */
( function () {
function tablewrap() {
var z = document.getElementById( 'mw-content-text' ).clientWidth,
x = document.querySelectorAll( '#mw-content-text table' ),
i, y;
for ( i = x.length; i--; ) {
y = document.createElement( 'div' );
y.className = 'liberty-table-wrapper';
if ( x[ i ].clientWidth > z && x[ i ].parentNode.className !== 'liberty-table-wrapper' ) {
x[ i ].parentNode.insertBefore( y, x[ i ] );
y.appendChild( x[ i ] );
} else if ( x[ i ].clientWidth < z && x[ i ].parentNode.className === 'liberty-table-wrapper' ) {
x[ i ].parentNode.parentNode.insertBefore( x[ i ], x[ i ].parentNode );
x[ i ].nextSibling.remove();
}
}
}
window.onresize = function () {
tablewrap();
};
window.onload = function () {
tablewrap();
};
}() );

2025년 1월 13일 (월) 16:18 판

/* 이 자바스크립트 설정은 리버티 스킨을 사용하는 사용자에게 적용됩니다 */
( function () {
	function tablewrap() {
		var z = document.getElementById( 'mw-content-text' ).clientWidth,
			x = document.querySelectorAll( '#mw-content-text table' ),
			i, y;
		for ( i = x.length; i--; ) {
			y = document.createElement( 'div' );
			y.className = 'liberty-table-wrapper';
			if ( x[ i ].clientWidth > z && x[ i ].parentNode.className !== 'liberty-table-wrapper' ) {
				x[ i ].parentNode.insertBefore( y, x[ i ] );
				y.appendChild( x[ i ] );
			} else if ( x[ i ].clientWidth < z && x[ i ].parentNode.className === 'liberty-table-wrapper' ) {
				x[ i ].parentNode.parentNode.insertBefore( x[ i ], x[ i ].parentNode );
				x[ i ].nextSibling.remove();
			}
		}
	}
	window.onresize = function () {
		tablewrap();
	};
	window.onload = function () {
		tablewrap();
	};
}() );