mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-12 09:27:36 +00:00
Merge "Makes the size information (WxH) in Embed lighter"
This commit is contained in:
commit
a72ca59a09
|
@ -109,11 +109,12 @@ $messages['en'] = array(
|
|||
'multimediaviewer-embed-via' => 'Via $1.',
|
||||
|
||||
// Embed size choices
|
||||
'multimediaviewer-default-embed-size' => 'Default thumbnail size',
|
||||
'multimediaviewer-original-embed-size' => 'Original size - $1 × $2 px',
|
||||
'multimediaviewer-large-embed-size' => 'Large - $1 × $2 px',
|
||||
'multimediaviewer-medium-embed-size' => 'Medium - $1 × $2 px',
|
||||
'multimediaviewer-small-embed-size' => 'Small - $1 × $2 px',
|
||||
'multimediaviewer-default-embed-dimensions' => 'Default thumbnail size',
|
||||
'multimediaviewer-original-embed-dimensions' => 'Original size $1',
|
||||
'multimediaviewer-large-embed-dimensions' => 'Large $1',
|
||||
'multimediaviewer-medium-embed-dimensions' => 'Medium $1',
|
||||
'multimediaviewer-small-embed-dimensions' => 'Small $1',
|
||||
'multimediaviewer-embed-dimensions' => '- $1 × $2 px',
|
||||
);
|
||||
|
||||
/** Message documentation (Message documentation)
|
||||
|
@ -318,16 +319,19 @@ Each of the parameters could be either plain text or a link.',
|
|||
'multimediaviewer-embed-via' => 'Source information (e. g. "via Flickr"), used when generating wikitext/HTML to reuse the image.
|
||||
$1 is source (probably a website or institution name)',
|
||||
'multimediaviewer-default-embed-size' => 'Text of size selector option which will generate wikitext for a thumbnail without explicit size.',
|
||||
'multimediaviewer-original-embed-size' => 'Text of size selector option which will generate wikitext for a thumbnail with the original (full) size.
|
||||
* $1 - width in pixels
|
||||
* $2 - height in pixels',
|
||||
'multimediaviewer-large-embed-size' => 'Text of size selector option which will generate wikitext for a thumbnail with small size.
|
||||
* $1 - width in pixels
|
||||
* $2 - height in pixels',
|
||||
'multimediaviewer-medium-embed-size' => 'Text of size selector option which will generate wikitext for a thumbnail with medium size.
|
||||
* $1 - width in pixels
|
||||
* $2 - height in pixels',
|
||||
'multimediaviewer-small-embed-size' => 'Text of size selector option which will generate wikitext for a thumbnail with large size.
|
||||
'multimediaviewer-original-embed-dimensions' => 'Text of size selector option which will generate wikitext for a thumbnail with the original (full) size.
|
||||
* $1 - thumbnail dimensions, defined by the following message:
|
||||
** {{msg-mw|Multimediaviewer-embed-dimensions}}',
|
||||
'multimediaviewer-large-embed-dimensions' => 'Text of size selector option which will generate wikitext for a thumbnail with small size.
|
||||
* $1 - thumbnail dimensions, defined by the following message:
|
||||
** {{msg-mw|Multimediaviewer-embed-dimensions}}',
|
||||
'multimediaviewer-medium-embed-dimensions' => 'Text of size selector option which will generate wikitext for a thumbnail with medium size.
|
||||
* $1 - thumbnail dimensions, defined by the following message:
|
||||
** {{msg-mw|Multimediaviewer-embed-dimensions}}',
|
||||
'multimediaviewer-small-embed-dimensions' => 'Text of size selector option which will generate wikitext for a thumbnail with large size.
|
||||
* $1 - thumbnail dimensions, defined by the following message:
|
||||
** {{msg-mw|Multimediaviewer-embed-dimensions}}',
|
||||
'multimediaviewer-embed-dimensions' => 'Dimensions for a given size selector option which will generate wikitext for a thumbnail.
|
||||
* $1 - width in pixels
|
||||
* $2 - height in pixels',
|
||||
);
|
||||
|
|
|
@ -498,11 +498,12 @@ call_user_func( function() {
|
|||
'multimediaviewer-embed-license',
|
||||
'multimediaviewer-embed-via',
|
||||
|
||||
'multimediaviewer-default-embed-size',
|
||||
'multimediaviewer-original-embed-size',
|
||||
'multimediaviewer-large-embed-size',
|
||||
'multimediaviewer-medium-embed-size',
|
||||
'multimediaviewer-small-embed-size',
|
||||
'multimediaviewer-default-embed-dimensions',
|
||||
'multimediaviewer-original-embed-dimensions',
|
||||
'multimediaviewer-large-embed-dimensions',
|
||||
'multimediaviewer-medium-embed-dimensions',
|
||||
'multimediaviewer-small-embed-dimensions',
|
||||
'multimediaviewer-embed-dimensions',
|
||||
),
|
||||
), $moduleInfo( 'mmv/ui' ) );
|
||||
|
||||
|
|
|
@ -138,6 +138,10 @@
|
|||
* @param {jQuery} $container
|
||||
*/
|
||||
EP.createSizePulldownMenus = function( $container ) {
|
||||
var placeholderDimensions = $( '<span>' )
|
||||
.addClass( 'mw-mlb-embed-dimensions' )
|
||||
.text( mw.message( 'multimediaviewer-embed-dimensions', 0, 0 ).text() ).get( 0 ).outerHTML;
|
||||
|
||||
// Wikitext sizes pulldown menu
|
||||
this.embedWtSizeSwitch = new oo.ui.InlineMenuWidget( {
|
||||
classes: [ 'mw-mlb-embed-size', 'active' ]
|
||||
|
@ -147,7 +151,8 @@
|
|||
|
||||
this.embedWtSizeSwitch.getMenu().addItems( [
|
||||
this.embedWtSizeChoices.default = new oo.ui.MenuItemWidget( { name: 'default' }, {
|
||||
label: mw.message( 'multimediaviewer-default-embed-size' ).text()
|
||||
label: mw.message( 'multimediaviewer-default-embed-dimensions' ).text(),
|
||||
autoFitLabel: false
|
||||
} ),
|
||||
|
||||
this.embedWtSizeChoices.small = new oo.ui.MenuItemWidget( {
|
||||
|
@ -156,7 +161,8 @@
|
|||
width: null
|
||||
},
|
||||
{
|
||||
label: mw.message( 'multimediaviewer-small-embed-size', 0, 0 ).text(),
|
||||
label: $( '<span>' ).html( mw.message( 'multimediaviewer-small-embed-dimensions', placeholderDimensions ).text() ),
|
||||
autoFitLabel: false
|
||||
} ),
|
||||
|
||||
this.embedWtSizeChoices.medium = new oo.ui.MenuItemWidget( {
|
||||
|
@ -165,7 +171,8 @@
|
|||
width: null
|
||||
},
|
||||
{
|
||||
label: mw.message( 'multimediaviewer-medium-embed-size', 0, 0 ).text()
|
||||
label: $( '<span>' ).html( mw.message( 'multimediaviewer-medium-embed-dimensions', placeholderDimensions ).text() ),
|
||||
autoFitLabel: false
|
||||
} ),
|
||||
|
||||
this.embedWtSizeChoices.large = new oo.ui.MenuItemWidget( {
|
||||
|
@ -174,7 +181,8 @@
|
|||
width: null
|
||||
},
|
||||
{
|
||||
label: mw.message( 'multimediaviewer-large-embed-size', 0, 0 ).text()
|
||||
label: $( '<span>' ).html( mw.message( 'multimediaviewer-large-embed-dimensions', placeholderDimensions ).text() ),
|
||||
autoFitLabel: false
|
||||
} )
|
||||
] );
|
||||
|
||||
|
@ -194,7 +202,8 @@
|
|||
width: null
|
||||
},
|
||||
{
|
||||
label: mw.message( 'multimediaviewer-small-embed-size', 0, 0 ).text(),
|
||||
label: $( '<span>' ).html( mw.message( 'multimediaviewer-small-embed-dimensions', placeholderDimensions ).text() ),
|
||||
autoFitLabel: false
|
||||
} ),
|
||||
|
||||
this.embedHtmlSizeChoices.medium = new oo.ui.MenuItemWidget( {
|
||||
|
@ -203,7 +212,8 @@
|
|||
width: null
|
||||
},
|
||||
{
|
||||
label: mw.message( 'multimediaviewer-medium-embed-size', 0, 0 ).text()
|
||||
label: $( '<span>' ).html( mw.message( 'multimediaviewer-medium-embed-dimensions', placeholderDimensions ).text() ),
|
||||
autoFitLabel: false
|
||||
} ),
|
||||
|
||||
this.embedHtmlSizeChoices.large = new oo.ui.MenuItemWidget( {
|
||||
|
@ -212,7 +222,8 @@
|
|||
width: null
|
||||
},
|
||||
{
|
||||
label: mw.message( 'multimediaviewer-large-embed-size', 0, 0 ).text()
|
||||
label: $( '<span>' ).html( mw.message( 'multimediaviewer-large-embed-dimensions', placeholderDimensions ).text() ),
|
||||
autoFitLabel: false
|
||||
} ),
|
||||
|
||||
this.embedHtmlSizeChoices.original = new oo.ui.MenuItemWidget( {
|
||||
|
@ -221,7 +232,8 @@
|
|||
width: null
|
||||
},
|
||||
{
|
||||
label: mw.message( 'multimediaviewer-original-embed-size', 0, 0 ).text()
|
||||
label: $( '<span>' ).html( mw.message( 'multimediaviewer-original-embed-dimensions', placeholderDimensions ).text() ),
|
||||
autoFitLabel: false
|
||||
} )
|
||||
] );
|
||||
|
||||
|
@ -563,7 +575,7 @@
|
|||
* @param {OO.ui.MenuItemWidget[]} options
|
||||
*/
|
||||
EP.updateMenuOptions = function ( sizes, options ) {
|
||||
var i, option, data;
|
||||
var i, option, data, dimensions, $label;
|
||||
|
||||
for ( i = 0; i < options.length; i++ ) {
|
||||
option = options[i];
|
||||
|
@ -579,13 +591,18 @@
|
|||
data.width = sizes[data.name].width;
|
||||
data.height = sizes[data.name].height;
|
||||
|
||||
option.setLabel(
|
||||
dimensions = $( '<span>' )
|
||||
.addClass( 'mw-mlb-embed-dimensions' )
|
||||
.text( mw.message( 'multimediaviewer-embed-dimensions', data.width, data.height ).text() ).get( 0 ).outerHTML;
|
||||
|
||||
$label = $( '<span>' ).html(
|
||||
mw.message(
|
||||
'multimediaviewer-' + data.name + '-embed-size',
|
||||
data.width,
|
||||
data.height
|
||||
'multimediaviewer-' + data.name + '-embed-dimensions',
|
||||
dimensions
|
||||
).text()
|
||||
);
|
||||
|
||||
option.setLabel( $label );
|
||||
} else if ( data.width && data.height ) {
|
||||
option.setDisabled( true );
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
@switch-color: #f2f2f2;
|
||||
@active-switch-color: #666666;
|
||||
@embed-dimensions-color: #aaaaaa;
|
||||
|
||||
.mw-mlb-embed-text-html,
|
||||
.mw-mlb-embed-text-wt {
|
||||
|
@ -37,3 +38,7 @@
|
|||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.mw-mlb-embed-dimensions {
|
||||
color: @embed-dimensions-color;
|
||||
}
|
|
@ -257,7 +257,7 @@
|
|||
assert.ok( embed.embedFileInfo, 'embedFileInfo correctly set.' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'updateMenuOptions():', 3, function ( assert ) {
|
||||
QUnit.test( 'updateMenuOptions():', 6, function ( assert ) {
|
||||
var embed = new mw.mmv.ui.reuse.Embed( $qf ),
|
||||
options = embed.embedHtmlSizeSwitch.getMenu().getItems(),
|
||||
width = 700,
|
||||
|
@ -266,7 +266,7 @@
|
|||
oldMessage = mw.message;
|
||||
|
||||
mw.message = function( messageKey ) {
|
||||
assert.ok( messageKey.match(/^multimediaviewer-(small|medium|original)/), 'messageKey passed correctly.' );
|
||||
assert.ok( messageKey.match(/^multimediaviewer-(small|medium|original|embed-dimensions)/), 'messageKey passed correctly.' );
|
||||
|
||||
return { text: $.noop };
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue