2 * Scripts for action=edit at domready
8 * Fired when the editform is added to the edit page
10 * Similar to the {@link mw.hook#event-wikipage_content wikipage.content hook}
11 * $editForm can still be detached when this hook is fired.
13 * @event wikipage_editform
15 * @param {jQuery} $editForm The most appropriate element containing the
16 * editform, usually #editform.
20 var editBox, scrollTop, $editForm;
22 // Make sure edit summary does not exceed byte limit
23 $( '#wpSummary' ).byteLimit( 255 );
25 // Restore the edit box scroll state following a preview operation,
26 // and set up a form submission handler to remember this state.
27 editBox = document.getElementById( 'wpTextbox1' );
28 scrollTop = document.getElementById( 'wpScrolltop' );
29 $editForm = $( '#editform' );
30 mw.hook( 'wikipage.editform' ).fire( $editForm );
31 if ( $editForm.length && editBox && scrollTop ) {
32 if ( scrollTop.value ) {
33 editBox.scrollTop = scrollTop.value;
35 $editForm.submit( function () {
36 scrollTop.value = editBox.scrollTop;
40 }( mediaWiki, jQuery ) );