Index: trunk/extensions/MobileFrontend/javascripts/beta_opensearch.js |
— | — | @@ -105,25 +105,28 @@ |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | | - window.onload = function () { |
110 | | - u( search ).bind( 'keyup', |
111 | | - function() { |
| 109 | + var performSearch = function(ev) { |
| 110 | + ev.preventDefault(); |
112 | 111 | clearTimeout( timer ); |
113 | | - term = this.value; |
| 112 | + term = search.value; |
114 | 113 | if ( term.length < 1 ) { |
115 | 114 | results.innerHTML = ''; |
116 | 115 | } else { |
117 | 116 | term = encodeURIComponent( term ); |
118 | 117 | timer = setTimeout( function () { searchApi( term ); }, typingDelay ); |
119 | 118 | } |
120 | | - } ); |
121 | 119 | }; |
| 120 | + u( search ).bind( 'keyup', performSearch ); |
| 121 | + u( document.getElementById( 'searchForm' ) ).bind( 'submit', performSearch ); |
| 122 | + u( search ).bind( 'blur', performSearch ); // for opera mini etc |
122 | 123 | |
123 | 124 | function searchApi( term ) { |
124 | 125 | url = apiUrl + '?action=opensearch&limit=' + numResults + '&namespace=0&format=xml&search=' + term; |
125 | 126 | u.ajax( { url: url, |
126 | 127 | success: function(xml) { |
127 | | - writeResults( createObjectArray( xml ) ); |
| 128 | + if( u( document.body ).hasClass( 'full-screen-search' ) ) { |
| 129 | + writeResults( createObjectArray( xml ) ); |
| 130 | + } |
128 | 131 | } |
129 | 132 | } ); |
130 | 133 | } |
Index: trunk/extensions/MobileFrontend/templates/SearchTemplate.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | <div id='header'> |
35 | 35 | <div id='searchbox' {$logoDisplayNone}> |
36 | 36 | <img width="35" height="22" alt='Logo' id='logo' src='{$this->data['wgMobileFrontendLogo']}' {$logoDisplayNone} /> |
37 | | - <form action='{$scriptUrl}' class='search_bar' method='get' {$searchBoxDisplayNone}> |
| 37 | + <form id='searchForm' action='{$scriptUrl}' class='search_bar' method='get' {$searchBoxDisplayNone}> |
38 | 38 | <input type="hidden" value="Special:Search" name="title" /> |
39 | 39 | <div id="sq" class="divclearable"> |
40 | 40 | <input type="search" name="search" id="search" size="22" value="{$searchField}" autocorrect="off" autocomplete="off" autocapitalize="off" maxlength="1024" class="search" placeholder="{$placeholder}" /> |