Index: trunk/phase3/includes/specials/SpecialSearch.php |
— | — | @@ -619,11 +619,21 @@ |
620 | 620 | if( $t != null && count($this->namespaces) === 1 ) { |
621 | 621 | $out .= wfMsgExt( 'searchmenu-prefix', array('parseinline'), $term ); |
622 | 622 | } |
623 | | - return Xml::openElement( 'fieldset', array('id' => 'mw-searchoptions','style' => 'margin:0em;') ) . |
| 623 | + return $this->powerSearchFocus() . |
| 624 | + Xml::openElement( 'fieldset', array('id' => 'mw-searchoptions','style' => 'margin:0em;') ) . |
624 | 625 | Xml::element( 'legend', null, wfMsg('powersearch-legend') ) . |
625 | 626 | $this->formHeader($term) . $out . |
626 | 627 | Xml::closeElement( 'fieldset' ); |
627 | 628 | } |
| 629 | + |
| 630 | + protected function searchFocus() { |
| 631 | + global $wgJsMimeType; |
| 632 | + return "<script type=\"$wgJsMimeType\">" . |
| 633 | + "hookEvent(\"load\", function() {" . |
| 634 | + "document.getElementById('searchText').focus();" . |
| 635 | + "});" . |
| 636 | + "</script>"; |
| 637 | + } |
628 | 638 | |
629 | 639 | protected function powerSearchFocus() { |
630 | 640 | global $wgJsMimeType; |
— | — | @@ -714,7 +724,8 @@ |
715 | 725 | global $wgScript; |
716 | 726 | $searchTitle = SpecialPage::getTitleFor( 'Search' ); |
717 | 727 | $searchable = SearchEngine::searchableNamespaces(); |
718 | | - $out = Xml::openElement( 'form', array( 'id' => 'search', 'method' => 'get', 'action' => $wgScript ) ); |
| 728 | + $out = $this->searchFocus(); |
| 729 | + $out .= Xml::openElement( 'form', array( 'id' => 'search', 'method' => 'get', 'action' => $wgScript ) ); |
719 | 730 | $out .= Xml::hidden( 'title', $searchTitle->getPrefixedText() ) . "\n"; |
720 | 731 | // If searching several, but not all namespaces, show what we are searching. |
721 | 732 | if( count($this->namespaces) > 1 && $this->namespaces !== array_keys($searchable) ) { |