' )
.addClass( 'mw-mlb-permission-text' )
.appendTo( this.$box );
/**
* Original (HTML) version of the author's message
* This can be scary sometimes (huge tables, black text on dark purple background etc).
* @property {jQuery}
*/
this.$html = $( '
' )
.addClass( 'mw-mlb-permission-html' )
.appendTo( this.$box );
/**
* "Close" button (does not actually close the box, just makes it smaller).
* @property {jQuery}
*/
this.$close = $( '
' )
.addClass( 'mw-mlb-permission-close' )
.on( 'click', function() {
permission.shrink();
} )
.appendTo( this.$box );
}
oo.inheritClass( Permission, mw.mmv.ui.Element );
P = Permission.prototype;
/**
* Clear everything
*/
P.empty = function() {
this.$box.addClass( 'empty' );
this.$text.empty();
this.$html.empty();
};
/**
* Set permission text/html
* @param {string} permission the text or HTML code written by the image author
*/
P.set = function( permission ) {
this.$box.removeClass( 'empty' );
this.$text.html( permission );
this.whitelistHtml( this.$text );
this.$html.html( permission );
};
/**
* Enlarge the box, show HTML instead of text.
*/
P.grow = function() {
this.$box.addClass( 'full-size' )
.stop( true )
.animate( { backgroundColor: '#FFFFA0' }, 500)
.animate( { backgroundColor: '#FFFFFF' }, 500);
};
/**
* Limit the size of the box, show text only.
*/
P.shrink = function() {
this.$box.removeClass( 'full-size' );
};
mw.mmv.ui.Permission = Permission;
}( mediaWiki, jQuery, OO ) );