| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
ve.ui.LanguageResultWidget = function VeUiLanguageResultWidget( config ) { |
| 17 |
|
| 18 |
ve.ui.LanguageResultWidget.super.call( this, config ); |
| 19 |
|
| 20 |
|
| 21 |
this.$element.addClass( 've-ui-languageResultWidget' ); |
| 22 |
this.name = new OO.ui.LabelWidget( { classes: [ 've-ui-languageResultWidget-name' ] } ); |
| 23 |
this.otherMatch = new OO.ui.LabelWidget( { classes: [ 've-ui-languageResultWidget-otherMatch' ] } ); |
| 24 |
this.setLabel( this.otherMatch.$element.add( this.name.$element ) ); |
| 25 |
}; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
OO.inheritClass( ve.ui.LanguageResultWidget, OO.ui.OptionWidget ); |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
ve.ui.LanguageResultWidget.prototype.updateLabel = function ( query, matchedProperty, compare ) { |
| 43 |
const data = this.getData(); |
| 44 |
|
| 45 |
if ( matchedProperty === 'name' ) { |
| 46 |
this.name.setHighlightedQuery( data.name, query, compare ); |
| 47 |
} else { |
| 48 |
this.name.setLabel( data.name ); |
| 49 |
} |
| 50 |
if ( matchedProperty === 'code' || matchedProperty === 'autonym' ) { |
| 51 |
this.otherMatch.setHighlightedQuery( data[ matchedProperty ], query, compare ); |
| 52 |
} else { |
| 53 |
this.otherMatch.setLabel( data.code ); |
| 54 |
} |
| 55 |
|
| 56 |
return this; |
| 57 |
}; |