$this->edittime = $request->getVal( 'wpEdittime' );
$this->starttime = $request->getVal( 'wpStarttime' );
+
+ $this->scrolltop = htmlentities( $request->getVal( 'wpScrolltop' ) );
+
if( is_null( $this->edittime ) ) {
# If the form is incomplete, force to preview.
wfDebug( "$fname: Form data appears to be incomplete\n" );
$wgOut->addHTML( <<<END
$recreate
{$commentsubject}
-<textarea tabindex='1' accesskey="," name="wpTextbox1" rows='{$rows}'
+<textarea tabindex='1' accesskey="," name="wpTextbox1" id="wpTextbox1" rows='{$rows}'
cols='{$cols}'{$ew} $hidden>
END
. htmlspecialchars( $this->safeUnicodeOutput( $this->textbox1 ) ) .
$wgOut->addHTML( "
<input type='hidden' value=\"" . htmlspecialchars( $this->section ) . "\" name=\"wpSection\" />
<input type='hidden' value=\"{$this->starttime}\" name=\"wpStarttime\" />\n
-<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n" );
+<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n
+<input type='hidden' value=\"{$this->scrolltop}\" name=\"wpScrolltop\" id=\"wpScrolltop\" />\n" );
if ( $wgUser->isLoggedIn() ) {
/**
unhidetzbutton();
tabbedprefs();
akeytt();
+ scrollEditBox();
// Run any added-on functions
for ( var i = 0; i < onloadFuncts.length; i++ )
else
field.style.display = 'none';
}
+
+function scrollEditBox() {
+
+ var editBoxEl = document.getElementById("wpTextbox1");
+ var scrollTopEl = document.getElementById("wpScrolltop");
+ var editFormEl = document.getElementById("editform");
+
+ if ( editBoxEl && scrollTopEl ) {
+
+ if (scrollTopEl.value) editBoxEl.scrollTop = scrollTopEl.value;
+ editFormEl.onsubmit = function() {
+ document.getElementById("wpScrolltop").value = document.getElementById("wpTextbox1").scrollTop;
+ }
+ }
+}
+
+hookEvent( "load", scrollEditBox );
\ No newline at end of file