diff --git a/modules/ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js b/modules/ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js index 5416908485..4e5167930a 100644 --- a/modules/ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js +++ b/modules/ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js @@ -148,7 +148,7 @@ // The following messages are used here: // * minoredit // * watchthis - var $label = $( '' ).append( mw.message( options[ 'label-message' ] ).parseDom() ); + var $label = mw.message( options[ 'label-message' ] ).parseDom(); var config = $.extend( { accessKey: accesskey, @@ -178,7 +178,7 @@ checkboxFields.push( new OO.ui.FieldLayout( checkbox, { align: 'inline', - label: $label.contents(), + label: $label, title: title, invisibleLabel: !!options.invisibleLabel, // * ve-ui-mwSaveDialog-field-wpMinoredit diff --git a/modules/ve-mw/ui/contextitems/ve.ui.MWIncludesContextItem.js b/modules/ve-mw/ui/contextitems/ve.ui.MWIncludesContextItem.js index a22446c3f3..309946599b 100644 --- a/modules/ve-mw/ui/contextitems/ve.ui.MWIncludesContextItem.js +++ b/modules/ve-mw/ui/contextitems/ve.ui.MWIncludesContextItem.js @@ -46,23 +46,25 @@ ve.ui.MWIncludesContextItem.static.modelClasses = [ /* Methods */ ve.ui.MWIncludesContextItem.prototype.getLabelMessage = function () { - var map = { - 'mw:Includes/NoInclude': mw.message( 'visualeditor-includes-noinclude-start' ).text(), - 'mw:Includes/NoInclude/End': mw.message( 'visualeditor-includes-noinclude-end' ).text(), - 'mw:Includes/OnlyInclude': mw.message( 'visualeditor-includes-onlyinclude-start' ).text(), - 'mw:Includes/OnlyInclude/End': mw.message( 'visualeditor-includes-onlyinclude-end' ).text(), - 'mw:Includes/IncludeOnly': mw.message( 'visualeditor-includes-includeonly' ).text() - }; - return map[ this.model.getAttribute( 'type' ) ]; + var key = { + 'mw:Includes/NoInclude': 'visualeditor-includes-noinclude-start', + 'mw:Includes/NoInclude/End': 'visualeditor-includes-noinclude-end', + 'mw:Includes/OnlyInclude': 'visualeditor-includes-onlyinclude-start', + 'mw:Includes/OnlyInclude/End': 'visualeditor-includes-onlyinclude-end', + 'mw:Includes/IncludeOnly': 'visualeditor-includes-includeonly' + }[ this.model.getAttribute( 'type' ) ]; + // eslint-disable-next-line mediawiki/msg-doc + return key ? mw.message( key ).text() : ''; }; ve.ui.MWIncludesContextItem.prototype.getDescriptionMessage = function () { - var map = { - 'mw:Includes/NoInclude': mw.message( 'visualeditor-includes-noinclude-description' ).parseDom(), - 'mw:Includes/OnlyInclude': mw.message( 'visualeditor-includes-onlyinclude-description' ).parseDom(), - 'mw:Includes/IncludeOnly': mw.message( 'visualeditor-includes-includeonly-description' ).parseDom() - }; - return map[ this.model.getAttribute( 'type' ) ] || ''; + var key = { + 'mw:Includes/NoInclude': 'visualeditor-includes-noinclude-description', + 'mw:Includes/OnlyInclude': 'visualeditor-includes-onlyinclude-description', + 'mw:Includes/IncludeOnly': 'visualeditor-includes-includeonly-description' + }[ this.model.getAttribute( 'type' ) ]; + // eslint-disable-next-line mediawiki/msg-doc + return key ? mw.message( key ).parseDom() : ''; }; /** diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWDismissibleMessageWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWDismissibleMessageWidget.js index eff11993be..81808eeb2c 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWDismissibleMessageWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWDismissibleMessageWidget.js @@ -14,13 +14,13 @@ * @cfg {mw.Message} message Message to display */ ve.ui.MWDismissibleMessageWidget = function VeUiMWDismissibleMessageWidget( config ) { - var $label = config.message.parseDom(); - // eslint-disable-next-line no-jquery/variable-pattern - config.label = $label; + config.label = config.message.parseDom(); // Parent constructor ve.ui.MWDismissibleMessageWidget.super.call( this, config ); + ve.targetLinksToNewWindow( this.$label[ 0 ] ); + // Properties this.messageKey = config.message.key; delete config.message; @@ -32,8 +32,6 @@ ve.ui.MWDismissibleMessageWidget = function VeUiMWDismissibleMessageWidget( conf } ) .connect( this, { click: 'onDismissClick' } ); - ve.targetLinksToNewWindow( this.$element[ 0 ] ); - this.$element .addClass( 've-ui-dismissibleMessageWidget' ) .prepend( dismissButton.$element );