| Current File : /home/jvzmxxx/wiki1/extensions/VisualEditor/lib/ve/src/ui/pages/ve.ui.SpecialCharacterPage.js |
/*!
* VisualEditor user interface SpecialCharacterPage class.
*
* @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* MediaWiki meta dialog Languages page.
*
* @class
* @extends OO.ui.PageLayout
*
* @constructor
* @param {string} name Unique symbolic name of page
* @param {Object} [config] Configuration options
*/
ve.ui.SpecialCharacterPage = function VeUiSpecialCharacterPage( name, config ) {
var character, characterNode, characters, $characters, charactersNode;
// Parent constructor
ve.ui.SpecialCharacterPage.super.apply( this, arguments );
this.label = config.label;
this.icon = config.icon;
characters = config.characters;
$characters = $( '<div>' ).addClass( 've-ui-specialCharacterPage-characters' );
charactersNode = $characters[ 0 ];
// The body of this loop is executed a few thousand times when opening
// ve.ui.SpecialCharacterDialog, avoid jQuery wrappers.
for ( character in characters ) {
characterNode = document.createElement( 'div' );
characterNode.className = 've-ui-specialCharacterPage-character';
if ( characters[ character ].titleMsg ) {
characterNode.setAttribute( 'title', ve.msg( characters[ character ].titleMsg ) );
}
characterNode.textContent = character;
$.data( characterNode, 'character', characters[ character ] );
charactersNode.appendChild( characterNode );
}
this.$element
.addClass( 've-ui-specialCharacterPage' )
.append( $( '<h3>' ).text( name ), $characters );
};
/* Inheritance */
OO.inheritClass( ve.ui.SpecialCharacterPage, OO.ui.PageLayout );
/* Methods */
/**
* @inheritdoc
*/
ve.ui.SpecialCharacterPage.prototype.setupOutlineItem = function () {
// Parent method
ve.ui.SpecialCharacterPage.super.prototype.setupOutlineItem.apply( this, arguments );
this.outlineItem.setLabel( this.label );
};