Index: trunk/extensions/LuceneSearch/LuceneSearch_body.php |
— | — | @@ -140,7 +140,10 @@ |
141 | 141 | $wgOut->addWikiText(wfMsg('searchresulttext')); |
142 | 142 | $wgOut->addHTML($this->showShortDialog($q)); |
143 | 143 | |
144 | | - if ($q !== false && strlen($q) > 0) { |
| 144 | + if ($q === false || strlen($q) == 0) { |
| 145 | + // No search active. Put input focus in the search box. |
| 146 | + $wgOut->addHTML( $this->makeFocusJS() ); |
| 147 | + } else { |
145 | 148 | if (!($wgRequest->getText('fulltext'))) { |
146 | 149 | $t = SearchEngine::getNearMatch($q); |
147 | 150 | if(!is_null($t)) { |
— | — | @@ -610,6 +613,12 @@ |
611 | 614 | return "<br /><br />\n<form id=\"powersearch\" method=\"get\" " . |
612 | 615 | "action=\"$action\">\n{$ret}\n</form>\n"; |
613 | 616 | } |
| 617 | + |
| 618 | + function makeFocusJS() { |
| 619 | + return "<script type='text/javascript'>" . |
| 620 | + "document.getElementById('lsearchbox').focus();" . |
| 621 | + "</script>"; |
| 622 | + } |
614 | 623 | |
615 | 624 | function makeSuggestJS() { |
616 | 625 | global $wgScript, $wgArticlePath; |