미디어위키:Gadget-CreatePageUw.js: 두 판 사이의 차이
식물 vs 좀비 위키
잔글 Brokey님이 미디어위키:CreatePageUw.js 문서를 넘겨주기를 만들지 않고 미디어위키:Gadget-CreatePageUw.js 문서로 이동했습니다 |
편집 요약 없음 |
||
| 2번째 줄: | 2번째 줄: | ||
'use strict'; | 'use strict'; | ||
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) !== 'CreatePage' ) { | if ( | ||
mw.config.get( 'wgCanonicalSpecialPageName' ) !== | |||
'CreatePage' | |||
) { | |||
return; | return; | ||
} | } | ||
var revealTimer = window.setTimeout( | |||
revealCreatePage, | |||
2000 | |||
); | |||
function revealCreatePage() { | |||
window.clearTimeout( revealTimer ); | |||
document.body.classList.add( | |||
'pvz-createpage-ready' | |||
document.body.classList.add( 'pvz-createpage- | |||
); | ); | ||
} | |||
function initializeCreatePageUw() { | |||
try { | |||
var input = document.getElementById( | |||
'mw-input-wptitle' | |||
var | |||
' | |||
); | ); | ||
if ( | if ( !input ) { | ||
return; | |||
} | } | ||
input.placeholder = | |||
'새로 재배할 문서의 제목을 입력하세요'; | |||
input.setAttribute( | |||
'aria-label', | |||
' | '새로 재배할 문서의 제목을 입력하세요' | ||
); | ); | ||
if ( | |||
document.querySelector( | |||
'.pvz-createpage-sprout' | |||
) | |||
) { | |||
return; | |||
} | |||
var imageBox = | |||
var | 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 = ''; | |||
imageBox.appendChild( image ); | |||
var fieldLayout = input.closest( | |||
'.oo-ui-fieldLayout' | |||
); | |||
var insertionTarget = | |||
fieldLayout || input.parentElement; | |||
if ( | |||
insertionTarget && | |||
insertionTarget.parentNode | |||
) { | |||
insertionTarget.parentNode.insertBefore( | |||
imageBox, | |||
insertionTarget | |||
); | |||
} | |||
} finally { | |||
window.requestAnimationFrame( | |||
revealCreatePage | |||
); | ); | ||
} | } | ||
