SearchInputWidget: Support searching a namespaces besides 0
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.searchSuggest.js
index cbbd254..ce5f66a 100644 (file)
@@ -4,12 +4,12 @@
 ( function ( mw, $ ) {
        mw.searchSuggest = {
                // queries the wiki and calls response with the result
-               request: function ( api, query, response, maxRows ) {
+               request: function ( api, query, response, maxRows, namespace ) {
                        return api.get( {
                                formatversion: 2,
                                action: 'opensearch',
                                search: query,
-                               namespace: 0,
+                               namespace: namespace || 0,
                                limit: maxRows,
                                suggest: true
                        } ).done( function ( data, jqXHR ) {
                                cache: true,
                                highlightInput: true
                        } )
-                       .bind( 'paste cut drop', function () {
+                       .on( 'paste cut drop', function () {
                                // make sure paste and cut events from the mouse and drag&drop events
                                // trigger the keypress handler and cause the suggestions to update
                                $( this ).trigger( 'keypress' );