/*
* This file is part of the MediaWiki extension MediaViewer.
*
* MediaViewer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* MediaViewer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MediaViewer. If not, see .
*/
( function ( mw, $, oo ) {
var P;
/**
* A box to display additional terms or remarks from the image author.
* (Typically comes from the Permission field of the {{Information}} template.)
* It has two states: when closed, it just shows some text, when open, it shows the HTML
* block supplied by the author in its full beauty.
*
* @class mw.mmv.ui.Permission
* @extends mw.mmv.ui.Element
* @constructor
* @param {jQuery} $container
* @param {mw.mmv.ui.MetadataPanelScroller} scroller
*/
function Permission( $container, scroller ) {
var permission = this;
mw.mmv.ui.Element.call( this, $container );
/** @property {mw.mmv.HtmlUtils} htmlUtils - */
this.htmlUtils = new mw.mmv.HtmlUtils();
/**
* Contains everything else.
* @property {jQuery}
*/
this.$box = $( '
' )
.text( mw.message( 'multimediaviewer-permission-title' ).text() )
.appendTo( this.$box );
/**
* Plain-text version of the author's message
* This is just the text parsed out from the original markup, it might not make much sense
* (e.g. if the original is a HTML table)
* @property {jQuery}
*/
this.$text = $( '
' )
.addClass( 'mw-mmv-permission-text' )
.appendTo( this.$box )
.on( 'click', '.mw-mmv-permission-text-viewmore', function ( e ) {
e.preventDefault();
permission.grow();
permission.scroller.toggle( 'up' );
} );
/**
* A helper element to fade off text
* @property {jQuery}
*/
this.$fader = $( '