summaryrefslogtreecommitdiff
path: root/resources/src/mediawiki.action/mediawiki.action.edit.js
blob: 01a25f3b8516b556a0cbd18efabde5bf37f0fbaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*!
 * Scripts for action=edit at domready
 */
jQuery( function ( $ ) {
	var editBox, scrollTop, $editForm;

	// Make sure edit summary does not exceed byte limit
	$( '#wpSummary' ).byteLimit( 255 );

	// Restore the edit box scroll state following a preview operation,
	// and set up a form submission handler to remember this state.
	editBox = document.getElementById( 'wpTextbox1' );
	scrollTop = document.getElementById( 'wpScrolltop' );
	$editForm = $( '#editform' );
	if ( $editForm.length && editBox && scrollTop ) {
		if ( scrollTop.value ) {
			editBox.scrollTop = scrollTop.value;
		}
		$editForm.submit( function () {
			scrollTop.value = editBox.scrollTop;
		} );
	}
} );