| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
ve.ui.MWCategoryItemWidget = function VeUiMWCategoryItemWidget( config ) { |
| 28 |
|
| 29 |
config = ve.extendObject( { indicator: 'down' }, config ); |
| 30 |
|
| 31 |
|
| 32 |
ve.ui.MWCategoryItemWidget.super.call( this, config ); |
| 33 |
|
| 34 |
|
| 35 |
OO.ui.mixin.DraggableElement.call( this, config ); |
| 36 |
|
| 37 |
|
| 38 |
this.name = config.item.name; |
| 39 |
this.value = config.item.value; |
| 40 |
this.sortKey = config.item.sortKey || ''; |
| 41 |
this.metaItem = config.item.metaItem; |
| 42 |
this.isHidden = config.hidden; |
| 43 |
this.isMissing = config.missing; |
| 44 |
|
| 45 |
|
| 46 |
this.setLabel( config.redirectTo || this.value ); |
| 47 |
if ( config.redirectTo ) { |
| 48 |
ve.init.platform.linkCache.styleElement( mw.Title.newFromText( |
| 49 |
config.redirectTo, |
| 50 |
mw.config.get( 'wgNamespaceIds' ).category |
| 51 |
).getPrefixedText(), this.$label ); |
| 52 |
} else { |
| 53 |
ve.init.platform.linkCache.styleElement( this.name, this.$label ); |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
this.on( 'click', this.onButtonClick.bind( this ) ); |
| 58 |
|
| 59 |
this.$element.addClass( 've-ui-mwCategoryItemWidget' ); |
| 60 |
}; |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
OO.inheritClass( ve.ui.MWCategoryItemWidget, OO.ui.ButtonWidget ); |
| 65 |
|
| 66 |
OO.mixinClass( ve.ui.MWCategoryItemWidget, OO.ui.mixin.DraggableElement ); |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
ve.ui.MWCategoryItemWidget.prototype.onButtonClick = function () { |
| 83 |
this.emit( 'togglePopupMenu', this ); |
| 84 |
}; |