' )
.addClass( 'mw-mmv-permission-html' )
.appendTo( this.$box );
/**
* "Close" button (does not actually close the box, just makes it smaller).
* @property {jQuery}
*/
this.$close = $( '
' )
.addClass( 'mw-mmv-permission-close' )
.on( 'click', function () {
permission.shrink();
} )
.appendTo( this.$box );
/**
* Panel scroller from the metadata panel object.
* @property {mw.mmv.ui.MetadataPanelScroller}
*/
this.scroller = scroller;
}
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( this.htmlUtils.htmlToTextWithLinks( permission ) );
this.$text.append( this.$fader );
this.$html.html( permission );
};
/**
* Enlarge the box, show HTML instead of text.
*
* @fires mmv-permission-grow
*/
P.grow = function () {
mw.mmv.actionLogger.log( 'terms-open' );
this.$box.addClass( 'full-size' )
.stop( true )
.animate( { backgroundColor: '#FFFFA0' }, 500 )
.animate( { backgroundColor: '#FFFFFF' }, 500 );
this.$container.trigger( 'mmv-permission-grow' );
};
/**
* Limit the size of the box, show text only.
*
* @fires mmv-permission-shrink
*/
P.shrink = function () {
this.$box.removeClass( 'full-size' );
this.$container.trigger( 'mmv-permission-shrink' );
};
/**
* Returns whether the box is full-size.
*
* @return {boolean}
*/
P.isFullSize = function () {
return this.$box.hasClass( 'full-size' );
};
mw.mmv.ui.Permission = Permission;
}( mediaWiki, jQuery, OO ) );