/*
* 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
' ).addClass( 'mw-mmv-mt-75' ).appendTo( $body );
this.createPreviewLink( $p );
}
/**
* Creates download split button. It is a link with the "download" property set plus an
* arrow that allows the user to select the image size desired. The "download" property
* triggers native browser downloading in browsers that support it. The fallback is the
* 'download' parameter which instructs the server to send the right headers so the browser
* downloads the file instead of just displaying it. If all this fails, the image will appear
* in another window/tab.
*
* @param {jQuery} $container
*/
createDownloadButton( $container ) {
this.$downloadButton = $( '' )
.attr( 'target', '_blank' )
.attr( 'download', '' )
.addClass( 'cdx-button cdx-button--weight-primary cdx-button--action-progressive cdx-button--fake-button cdx-button--fake-button--enabled' )
.html( '' + mw.message( 'multimediaviewer-download' ).text() )
.appendTo( $container );
}
/**
* Creates pulldown menu to select image sizes.
*
* @param {jQuery} $container
*/
createSizePulldownMenu( $container ) {
this.$downloadSizeMenu = this.utils.createSelectMenu(
[ 'original', 'small', 'medium', 'large', 'xl' ],
'original'
).appendTo( $container );
}
/**
* Creates preview link.
*
* @param {jQuery} $container
*/
createPreviewLink( $container ) {
this.$previewLink = $( '' )
.attr( 'target', '_blank' )
.addClass( 'cdx-docs-link' )
.html( mw.message( 'multimediaviewer-download-preview-link-title' ).text() )
.appendTo( $container );
}
createAttributionButton( $container ) {
[ this.$attributionInput, this.$attributionInputDiv ] = this.utils.createInputWithCopy(
mw.message( 'multimediaviewer-download-attribution-copy' ).text(), ''
);
const $header = $( ' ' )
.addClass( 'cdx-dialog__header__title' )
.text( mw.message( 'multimediaviewer-download-attribution' ).text() )
.appendTo( $header );
this.$attributionHowHeader = $( ' ' )
.addClass( 'mw-mmv-mb-75' )
.text( mw.message( 'multimediaviewer-download-attribution-cta-header' ).text() );
const $attributionTabs = $( '