From 1a7a7d21eba16ef4268ab09918ec946df7d322b9 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 12 Dec 2008 04:23:28 +0000 Subject: [PATCH] Tweak JS focusing --- includes/specials/SpecialSearch.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 880af73f14..55990309ec 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -131,6 +131,7 @@ class SpecialSearch { $filePrefix = $wgContLang->getFormattedNsText(NS_FILE).':'; if( '' === trim( $term ) || $filePrefix === trim( $term ) ) { + $wgOut->addHTML( $this->searchAdvanced ? $this->powerSearchFocus() : $this->searchFocus() ); // Empty query -- straight view of search form wfProfileOut( __METHOD__ ); return; @@ -269,6 +270,9 @@ class SpecialSearch { $wgOut->addWikiMsg( 'search-nonefound' ); } $wgOut->addHtml( "" ); + if( $totalRes === 0 ) { + $wgOut->addHTML( $this->searchAdvanced ? $this->powerSearchFocus() : $this->searchFocus() ); + } if( $numSQL || $this->offset ) { $wgOut->addHTML( "

{$prevnext}

\n" ); @@ -619,8 +623,7 @@ class SpecialSearch { if( $t != null && count($this->namespaces) === 1 ) { $out .= wfMsgExt( 'searchmenu-prefix', array('parseinline'), $term ); } - return $this->powerSearchFocus() . - Xml::openElement( 'fieldset', array('id' => 'mw-searchoptions','style' => 'margin:0em;') ) . + return Xml::openElement( 'fieldset', array('id' => 'mw-searchoptions','style' => 'margin:0em;') ) . Xml::element( 'legend', null, wfMsg('powersearch-legend') ) . $this->formHeader($term) . $out . Xml::closeElement( 'fieldset' ); @@ -724,8 +727,7 @@ class SpecialSearch { global $wgScript; $searchTitle = SpecialPage::getTitleFor( 'Search' ); $searchable = SearchEngine::searchableNamespaces(); - $out = $this->searchFocus(); - $out .= Xml::openElement( 'form', array( 'id' => 'search', 'method' => 'get', 'action' => $wgScript ) ); + $out = Xml::openElement( 'form', array( 'id' => 'search', 'method' => 'get', 'action' => $wgScript ) ); $out .= Xml::hidden( 'title', $searchTitle->getPrefixedText() ) . "\n"; // If searching several, but not all namespaces, show what we are searching. if( count($this->namespaces) > 1 && $this->namespaces !== array_keys($searchable) ) { -- 2.20.1