X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.widgets%2Fmw.widgets.SearchInputWidget.js;h=e821ce8fdca423bfe231a05e09da55ea948be340;hp=194f7149debf5b15ace3441e7834760a961b0a60;hb=fe94275c8fcfc248a5eae857dde7c5772d993ab5;hpb=f72345f57c8869b7426124cbe0218ab967fa42e4 diff --git a/resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js b/resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js index 194f7149de..e821ce8fdc 100644 --- a/resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js +++ b/resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js @@ -4,7 +4,7 @@ * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ -( function ( $, mw ) { +( function () { /** * Creates a mw.widgets.SearchInputWidget object. @@ -33,8 +33,7 @@ icon: 'search', maxLength: undefined, performSearchOnClick: true, - dataLocation: 'header', - namespace: 0 + dataLocation: 'header' }, config ); // Parent constructor @@ -187,9 +186,13 @@ */ mw.widgets.SearchInputWidget.prototype.getOptionsFromData = function ( data ) { var items = [], + titles = data.data[ 1 ], + descriptions = data.data[ 2 ], + urls = data.data[ 3 ], self = this; - $.each( data.data[ 1 ], function ( i, result ) { + // eslint-disable-next-line no-restricted-properties + $.each( titles, function ( i, result ) { items.push( new mw.widgets.TitleOptionWidget( self.getOptionWidgetData( result, @@ -197,10 +200,9 @@ // the parent's API query. { data: result, - // data[ 3 ][ i ] is the link for this result - url: data.data[ 3 ][ i ], - imageUrl: null, - description: null, + url: urls[ i ], + imageUrl: null, // The JSON 'opensearch' API doesn't have images + description: descriptions[ i ], missing: false, redirect: false, disambiguation: false @@ -246,4 +248,4 @@ return items; }; -}( jQuery, mediaWiki ) ); +}() );