| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
function CeMWPingNode() { |
| 13 |
|
| 14 |
CeMWPingNode.super.apply( this, arguments ); |
| 15 |
|
| 16 |
|
| 17 |
ve.ce.FocusableNode.call( this ); |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
OO.inheritClass( CeMWPingNode, ve.ce.LeafNode ); |
| 23 |
|
| 24 |
OO.mixinClass( CeMWPingNode, ve.ce.FocusableNode ); |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
CeMWPingNode.static.name = 'mwPing'; |
| 29 |
|
| 30 |
CeMWPingNode.static.tagName = 'span'; |
| 31 |
|
| 32 |
CeMWPingNode.static.deleteCommandName = 'insertAndOpenMWUsernameCompletions'; |
| 33 |
|
| 34 |
CeMWPingNode.static.getDescription = function ( model ) { |
| 35 |
return model.getAttribute( 'user' ); |
| 36 |
}; |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
CeMWPingNode.prototype.initialize = function () { |
| 44 |
const model = this.getModel(), |
| 45 |
prefix = mw.msg( 'discussiontools-replywidget-mention-prefix' ), |
| 46 |
suffix = mw.msg( 'discussiontools-replywidget-mention-suffix' ), |
| 47 |
user = model.getAttribute( 'user' ), |
| 48 |
title = mw.Title.makeTitle( mw.config.get( 'wgNamespaceIds' ).user, user ); |
| 49 |
|
| 50 |
|
| 51 |
CeMWPingNode.super.prototype.initialize.call( this ); |
| 52 |
|
| 53 |
|
| 54 |
const $link = $( '<a>' ) |
| 55 |
.addClass( 'ext-discussiontools-ce-mwPingNode' ) |
| 56 |
.attr( { |
| 57 |
href: title.getUrl(), |
| 58 |
title: user |
| 59 |
} ) |
| 60 |
.text( model.getAttribute( 'user' ) ); |
| 61 |
|
| 62 |
ve.init.platform.linkCache.styleElement( |
| 63 |
title.getPrefixedText(), |
| 64 |
$link |
| 65 |
); |
| 66 |
|
| 67 |
this.$element.append( |
| 68 |
prefix, |
| 69 |
$link, |
| 70 |
suffix |
| 71 |
); |
| 72 |
}; |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
ve.ce.nodeFactory.register( CeMWPingNode ); |