| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
const { Config } = require( 'mmv.bootstrap' ); |
| 19 |
const Utils = require( './mmv.ui.utils.js' ); |
| 20 |
const { UiElement } = require( 'mmv' ); |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
class Share extends UiElement { |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
constructor( $container ) { |
| 30 |
super( $container ); |
| 31 |
|
| 32 |
Utils.createHeader( mw.msg( 'multimediaviewer-share-tab' ) ) |
| 33 |
.appendTo( $container ); |
| 34 |
|
| 35 |
const $body = $( '<div>' ) |
| 36 |
.addClass( 'cdx-dialog__body mw-mmv-pt-0' ) |
| 37 |
.appendTo( $container ); |
| 38 |
|
| 39 |
[ this.$pageInput, this.$pageInputDiv ] = Utils.createInputWithCopy( |
| 40 |
mw.msg( 'multimediaviewer-reuse-copy-share' ), |
| 41 |
mw.msg( 'multimediaviewer-reuse-loading-placeholder' ) |
| 42 |
); |
| 43 |
this.$pageInput.attr( 'title', mw.msg( 'multimediaviewer-share-explanation' ) ); |
| 44 |
this.$pageInputDiv.appendTo( $body ); |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
show() { |
| 51 |
super.show(); |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
set( image ) { |
| 59 |
const url = image.descriptionUrl + Config.getMediaHash( image.title ); |
| 60 |
this.$pageInput.val( url ); |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
empty() { |
| 67 |
this.$pageInput.val( '' ); |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
module.exports = Share; |