mediawiki-extensions-Visual.../modules/ve-mw/ui/commands/ve.ui.MWWikitextWarningCommand.js
James D. Forrester 122f49b2dd build: Bump file copyright notices for 2017
Change-Id: I3c20809e71cc0da58123e1b5f29c4f3aac945496
2017-01-03 08:58:33 -08:00

53 lines
1.1 KiB
JavaScript

/*!
* VisualEditor UserInterface MediaWiki WikitextWarningCommand class.
*
* @copyright 2011-2017 VisualEditor Team and others; see http://ve.mit-license.org
*/
/**
* Wikitext warning command.
*
* @class
* @extends ve.ui.Command
*
* @constructor
*/
ve.ui.MWWikitextWarningCommand = function VeUiMWWikitextWarningCommand() {
// Parent constructor
ve.ui.MWWikitextWarningCommand.super.call(
this, 'mwWikitextWarning'
);
this.warning = null;
};
/* Inheritance */
OO.inheritClass( ve.ui.MWWikitextWarningCommand, ve.ui.Command );
/* Methods */
/**
* @inheritdoc
*/
ve.ui.MWWikitextWarningCommand.prototype.execute = function () {
var command = this;
if ( this.warning && this.warning.isOpen ) {
return false;
}
mw.notify(
$( $.parseHTML( ve.init.platform.getParsedMessage( 'visualeditor-wikitext-warning' ) ) )
.filter( 'a' ).attr( 'target', '_blank' ).end(),
{
title: ve.msg( 'visualeditor-wikitext-warning-title' ),
tag: 'visualeditor-wikitext-warning'
}
).then( function ( message ) {
command.warning = message;
} );
return true;
};
/* Registration */
ve.ui.commandRegistry.register( new ve.ui.MWWikitextWarningCommand() );