EditPage: Optimise loading of mediawiki.toolbar module
[lhc/web/wiklou.git] / resources / src / mediawiki.action / mediawiki.action.edit.js
1 /*!
2 * Scripts for action=edit at domready
3 */
4 jQuery( function ( $ ) {
5 var editBox, scrollTop, $editForm;
6
7 // Make sure edit summary does not exceed byte limit
8 $( '#wpSummary' ).byteLimit( 255 );
9
10 // Restore the edit box scroll state following a preview operation,
11 // and set up a form submission handler to remember this state.
12 editBox = document.getElementById( 'wpTextbox1' );
13 scrollTop = document.getElementById( 'wpScrolltop' );
14 $editForm = $( '#editform' );
15 if ( $editForm.length && editBox && scrollTop ) {
16 if ( scrollTop.value ) {
17 editBox.scrollTop = scrollTop.value;
18 }
19 $editForm.submit( function () {
20 scrollTop.value = editBox.scrollTop;
21 } );
22 }
23 } );