/* * This file is part of the MediaWiki extension MultimediaViewer. * * MultimediaViewer 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. * * MultimediaViewer 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 MultimediaViewer. If not, see . */ /* global OO, LightboxInterface */ ( function ( mw, $, oo, MLBInterface ) { var LIP; function LightboxInterface() { MLBInterface.call( this ); this.initializeInterface(); } oo.inheritClass( LightboxInterface, MLBInterface ); LIP = LightboxInterface.prototype; LIP.load = function ( image ) { var hashFragment = '#mediaviewer/' + mw.mediaViewer.currentImageFilename + '/' + mw.mediaViewer.lightbox.currentIndex; mw.mediaViewer.ui = this; mw.mediaViewer.registerLogging(); if ( !this.comingFromPopstate ) { history.pushState( {}, '', hashFragment ); } MLBInterface.prototype.load.call( this, image ); }; LIP.initializeInterface = function () { this.$postDiv.css( 'top', ( $( window ).height() - 64 ) + 'px' ); this.initializeHeader(); this.initializeButtons(); this.initializeImage(); this.initializeImageMetadata(); this.initializeAboutLinks(); this.initializeNavigation(); }; LIP.initializeHeader = function () { this.$closeButton.detach(); this.$fullscreenButton.detach(); this.$titleDiv = $( '
' ) .addClass( 'mw-mlb-title-contain' ) .appendTo( this.$controlBar ); this.$postDiv.append( this.$controlBar ); this.initializeTitleAndCredit(); this.initializeLicense(); }; LIP.initializeTitleAndCredit = function () { this.$titleAndCredit = $( '
' ) .addClass( 'mw-mlb-title-credit' ) .appendTo( this.$titleDiv ); this.initializeTitle(); this.initializeCredit(); }; LIP.initializeTitle = function () { this.$titlePara = $( '

' ) .addClass( 'mw-mlb-title-para' ) .appendTo( this.$titleAndCredit ); this.$title = $( '' ) .addClass( 'mw-mlb-title' ) .appendTo( this.$titlePara ); }; LIP.initializeCredit = function () { this.$source = $( '' ) .addClass( 'mw-mlb-source' ); this.$author = $( '' ) .addClass( 'mw-mlb-author' ); this.$credit = $( '

' ) .addClass( 'mw-mlb-credit empty' ) .html( mw.message( 'multimediaviewer-credit', this.$author.get( 0 ).outerHTML, this.$source.get( 0 ).outerHTML ).plain() ) .appendTo( this.$titleAndCredit ); }; LIP.initializeLicense = function () { this.$license = $( '' ) .addClass( 'mw-mlb-license empty' ) .prop( 'href', '#' ) .appendTo( this.$titlePara ); }; LIP.initializeButtons = function () { this.$mwControls = $( '

' ) .addClass( 'mw-mlb-controls' ) // Note we aren't adding the fullscreen button here. // Fullscreen causes some funky issues with UI redraws, // and we aren't sure why, but it's not really necessary // with the new interface anyway - it's basically fullscreen // already! .append( this.$closeButton ) .appendTo( this.$main ); }; LIP.initializeImage = function () { this.$imageDiv .addClass( 'empty' ); }; LIP.initializeImageMetadata = function () { this.$imageMetadata = $( '
' ) .addClass( 'mw-mlb-image-metadata' ) .appendTo( this.$postDiv ); this.initializeImageDesc(); this.initializeImageLinks(); }; LIP.initializeImageDesc = function () { this.$imageDescDiv = $( '
' ) .addClass( 'mw-mlb-image-desc-div empty' ) .appendTo( this.$imageMetadata ); this.$imageDesc = $( '

' ) .addClass( 'mw-mlb-image-desc' ) .appendTo( this.$imageDescDiv ); }; LIP.initializeImageLinks = function () { this.$imageLinkDiv = $( '

' ) .addClass( 'mw-mlb-image-links-div' ) .appendTo( this.$imageMetadata ); this.$imageLinks = $( '