mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-14 01:57:02 +00:00
2f8b3e0d96
Change-Id: Ie92dab7411116d3410195c3fb0a3513c664c0c30
53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface MediaWiki WikitextWarningCommand class.
|
|
*
|
|
* @copyright 2011-2015 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 () {
|
|
if ( this.warning && this.warning.isOpen ) {
|
|
return false;
|
|
}
|
|
var command = this;
|
|
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() );
|