( 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 ) {
}
/**
- * defines the location of autocomplete. Typically either
+ * Defines the location of autocomplete. Typically either
* header, which is in the top right of vector (for example)
* and content which identifies the main search bar on
- * Special:Search. Defaults to header for skins that don't set
+ * Special:Search. Defaults to header for skins that don't set
* explicitly.
*
* @ignore
+ * @param {Object} context
+ * @return {string}
*/
function getInputLocation( context ) {
return context.config.$region
* 'this' is the search input box (jQuery object)
*
* @ignore
+ * @param {Object} metadata
*/
function onAfterUpdate( metadata ) {
var context = this.data( 'suggestionsContext' );
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' );