미디어위키:Gadget-CreatePageUw.js: 두 판 사이의 차이

식물 vs 좀비 위키
둘러보기로 이동 검색으로 이동
편집 요약 없음
편집 요약 없음
9번째 줄: 9번째 줄:
}
}


var revealTimer = window.setTimeout(
function initializeCreatePageUw() {
revealCreatePage,
var input = document.getElementById(
2000
'mw-input-wptitle'
);
 
function revealCreatePage() {
window.clearTimeout( revealTimer );
document.body.classList.add(
'pvz-createpage-ready'
);
);
}


function initializeCreatePageUw() {
if ( !input ) {
try {
return;
var input = document.getElementById(
}
'mw-input-wptitle'
);


if ( !input ) {
input.placeholder =
return;
'새로 재배할 문서의 제목을 입력하세요';
}


input.placeholder =
input.setAttribute(
'새로 재배할 문서의 제목을 입력하세요';
'aria-label',
'새로 재배할 문서의 제목을 입력하세요'
);


input.setAttribute(
if (
'aria-label',
document.querySelector(
'새로 재배할 문서의 제목을 입력하세요'
'.pvz-createpage-sprout'
);
)
) {
return;
}


if (
var imageBox =
document.querySelector(
document.createElement( 'div' );
'.pvz-createpage-sprout'
)
) {
return;
}


var imageBox =
imageBox.className =
document.createElement( 'div' );
'pvz-createpage-sprout';


imageBox.className =
var image =
'pvz-createpage-sprout';
document.createElement( 'img' );


var image =
image.src = mw.util.getUrl(
document.createElement( 'img' );
'Special:Redirect/file/Sprout_PvZ2.png'
);


image.src = mw.util.getUrl(
image.alt = '';
'Special:Redirect/file/Sprout_PvZ2.png'
image.className = 'pvz-design-critical';
);


image.alt = '';
imageBox.appendChild( image );


imageBox.appendChild( image );
var fieldLayout = input.closest(
 
'.oo-ui-fieldLayout'
var fieldLayout = input.closest(
);
'.oo-ui-fieldLayout'
);


var insertionTarget =
var insertionTarget =
fieldLayout || input.parentElement;
fieldLayout || input.parentElement;


if (
if (
insertionTarget &&
insertionTarget &&
insertionTarget.parentNode
insertionTarget.parentNode
) {
) {
insertionTarget.parentNode.insertBefore(
insertionTarget.parentNode.insertBefore(
imageBox,
imageBox,
insertionTarget
insertionTarget
);
}
} finally {
window.requestAnimationFrame(
revealCreatePage
);
);
}
}

2026년 7월 25일 (토) 00:43 판

( function () {
	'use strict';

	if (
		mw.config.get( 'wgCanonicalSpecialPageName' ) !==
		'CreatePage'
	) {
		return;
	}

	function initializeCreatePageUw() {
		var input = document.getElementById(
			'mw-input-wptitle'
		);

		if ( !input ) {
			return;
		}

		input.placeholder =
			'새로 재배할 문서의 제목을 입력하세요';

		input.setAttribute(
			'aria-label',
			'새로 재배할 문서의 제목을 입력하세요'
		);

		if (
			document.querySelector(
				'.pvz-createpage-sprout'
			)
		) {
			return;
		}

		var imageBox =
			document.createElement( 'div' );

		imageBox.className =
			'pvz-createpage-sprout';

		var image =
			document.createElement( 'img' );

		image.src = mw.util.getUrl(
			'Special:Redirect/file/Sprout_PvZ2.png'
		);

		image.alt = '';
		image.className = 'pvz-design-critical';

		imageBox.appendChild( image );

		var fieldLayout = input.closest(
			'.oo-ui-fieldLayout'
		);

		var insertionTarget =
			fieldLayout || input.parentElement;

		if (
			insertionTarget &&
			insertionTarget.parentNode
		) {
			insertionTarget.parentNode.insertBefore(
				imageBox,
				insertionTarget
			);
		}
	}

	if ( document.readyState === 'loading' ) {
		document.addEventListener(
			'DOMContentLoaded',
			initializeCreatePageUw,
			{ once: true }
		);
	} else {
		initializeCreatePageUw();
	}
}() );