From: Brion Vibber Date: Wed, 10 Dec 2003 10:30:14 +0000 (+0000) Subject: Only emit the javascript to set editbox focus when we're really editing X-Git-Tag: 1.3.0beta1~1268 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=03022828cec84831a82d9ef147687b299b67268e;p=lhc%2Fweb%2Fwiklou.git Only emit the javascript to set editbox focus when we're really editing --- diff --git a/includes/EditPage.php b/includes/EditPage.php index db9f17d7a3..ef6f6afa29 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -288,6 +288,7 @@ class EditPage { $editsummary="{$summary}:
"; } + $wgOut->setOnloadHandler( "document.editform.wpTextbox1.focus()" ); $wgOut->addHTML( "
diff --git a/includes/OutputPage.php b/includes/OutputPage.php index e7df1a236f..cdd84c2dca 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -12,6 +12,7 @@ class OutputPage { var $mDTopen, $mLastSection; # Used for processing DL, PRE var $mLanguageLinks, $mSupressQuickbar; + var $mOnloadHandler; function OutputPage() { @@ -19,7 +20,8 @@ class OutputPage { $this->mKeywords = $this->mLinktags = array(); $this->mHTMLtitle = $this->mPagetitle = $this->mBodytext = $this->mLastSection = $this->mRedirect = $this->mLastModified = - $this->mSubtitle = $this->mDebugtext = $this->mRobotpolicy = ""; + $this->mSubtitle = $this->mDebugtext = $this->mRobotpolicy = + $this->mOnloadHandler = ""; $this->mIsarticle = $this->mPrintable = true; $this->mSupressQuickbar = $this->mDTopen = $this->mPrintable = false; $this->mLanguageLinks = array(); @@ -94,6 +96,8 @@ class OutputPage { function isArticle() { return $this->mIsarticle; } function setPrintable() { $this->mPrintable = true; } function isPrintable() { return $this->mPrintable; } + function setOnloadHandler( $js ) { $this->mOnloadHandler = $js; } + function getOnloadHandler() { return $this->mOnloadHandler; } function getLanguageLinks() { global $wgTitle, $wgLanguageCode; diff --git a/includes/Skin.php b/includes/Skin.php index ad3c704f7d..4853b2a4f6 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -168,14 +168,7 @@ class Skin { $a += array ("ondblclick" => $s); } - if($action=="edit") { # set focus in edit box - $foc = "document.editform.wpTextbox1.focus()"; - if($a['onload']) { - $a['onload'] .= ";$foc"; - } else { - $a['onload'] = $foc; - } - } + $a['onload'] = $wgOut->getOnloadHandler(); return $a; }