mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-09-29 13:17:35 +00:00
Merge "Rename setRepoInlineStyle to setInlineStyle"
This commit is contained in:
commit
7b79d7a073
|
@ -104,7 +104,7 @@
|
||||||
* @param {string} key some name to identify the style
|
* @param {string} key some name to identify the style
|
||||||
* @param {string|null} style a CSS snippet (set to null to delete the given style)
|
* @param {string|null} style a CSS snippet (set to null to delete the given style)
|
||||||
*/
|
*/
|
||||||
EP.setRepoInlineStyle = function ( key, style ) {
|
EP.setInlineStyle = function ( key, style ) {
|
||||||
|
|
||||||
if ( !this.$inlineStyles ) {
|
if ( !this.$inlineStyles ) {
|
||||||
this.$inlineStyles = [];
|
this.$inlineStyles = [];
|
||||||
|
|
|
@ -420,13 +420,13 @@
|
||||||
// This horror exists because the CSS uses a :before pseudo-class to
|
// This horror exists because the CSS uses a :before pseudo-class to
|
||||||
// define the repo icon. This is the only way to override it.
|
// define the repo icon. This is the only way to override it.
|
||||||
if ( favIcon ) {
|
if ( favIcon ) {
|
||||||
this.setRepoInlineStyle( 'repoDisplay',
|
this.setInlineStyle( 'repoDisplay',
|
||||||
'.mw-mmv-image-links li.mw-mmv-repo-li:before {' +
|
'.mw-mmv-image-links li.mw-mmv-repo-li:before {' +
|
||||||
'background-image: url("' + favIcon + '");' +
|
'background-image: url("' + favIcon + '");' +
|
||||||
'}'
|
'}'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.setRepoInlineStyle( 'repoDisplay', null );
|
this.setInlineStyle( 'repoDisplay', null );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$repoLi.removeClass( 'empty' );
|
this.$repoLi.removeClass( 'empty' );
|
||||||
|
|
|
@ -208,7 +208,7 @@
|
||||||
this.buttons.$descriptionPage.addClass( 'mw-mmv-stripe-button-commons' );
|
this.buttons.$descriptionPage.addClass( 'mw-mmv-stripe-button-commons' );
|
||||||
} else {
|
} else {
|
||||||
this.buttons.$descriptionPage.addClass( 'mw-mmv-stripe-button-dynamic' );
|
this.buttons.$descriptionPage.addClass( 'mw-mmv-stripe-button-dynamic' );
|
||||||
this.setRepoInlineStyle( 'stripe-button-description-page',
|
this.setInlineStyle( 'stripe-button-description-page',
|
||||||
'.mw-mmv-stripe-button-dynamic:before {' +
|
'.mw-mmv-stripe-button-dynamic:before {' +
|
||||||
'background-image: url("' + repoInfo.favIcon + '");' +
|
'background-image: url("' + repoInfo.favIcon + '");' +
|
||||||
'}'
|
'}'
|
||||||
|
@ -229,7 +229,7 @@
|
||||||
this.buttons.$descriptionPage.attr( { href: null, title: null, 'original-title': null } )
|
this.buttons.$descriptionPage.attr( { href: null, title: null, 'original-title': null } )
|
||||||
.removeClass( 'mw-mmv-stripe-button-dynamic mw-mmv-stripe-button-commons' );
|
.removeClass( 'mw-mmv-stripe-button-dynamic mw-mmv-stripe-button-commons' );
|
||||||
$( '.mw-mmv-stripe-button-dynamic-before' ).remove();
|
$( '.mw-mmv-stripe-button-dynamic-before' ).remove();
|
||||||
this.setRepoInlineStyle( 'stripe-button-description-page', null );
|
this.setInlineStyle( 'stripe-button-description-page', null );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,17 +15,17 @@
|
||||||
$( document ).trigger( new $.Event( 'mmv-foo' ) );
|
$( document ).trigger( new $.Event( 'mmv-foo' ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit.test( 'setRepoInlineStyle()', 3, function ( assert ) {
|
QUnit.test( 'setInlineStyle()', 3, function ( assert ) {
|
||||||
var element = new mw.mmv.ui.Element( $( '<div>' ) ),
|
var element = new mw.mmv.ui.Element( $( '<div>' ) ),
|
||||||
$testDiv = $( '<div id="mmv-testdiv">!!!</div>' ).appendTo( '#qunit-fixture' );
|
$testDiv = $( '<div id="mmv-testdiv">!!!</div>' ).appendTo( '#qunit-fixture' );
|
||||||
|
|
||||||
assert.ok( $testDiv.is( ':visible' ), 'Test div is visible' );
|
assert.ok( $testDiv.is( ':visible' ), 'Test div is visible' );
|
||||||
|
|
||||||
element.setRepoInlineStyle( 'test', '#mmv-testdiv { display: none; }' );
|
element.setInlineStyle( 'test', '#mmv-testdiv { display: none; }' );
|
||||||
|
|
||||||
assert.ok( !$testDiv.is( ':visible' ), 'Test div is hidden by inline style' );
|
assert.ok( !$testDiv.is( ':visible' ), 'Test div is hidden by inline style' );
|
||||||
|
|
||||||
element.setRepoInlineStyle( 'test', null );
|
element.setInlineStyle( 'test', null );
|
||||||
|
|
||||||
assert.ok( $testDiv.is( ':visible' ), 'Test div is visible again' );
|
assert.ok( $testDiv.is( ':visible' ), 'Test div is visible again' );
|
||||||
} );
|
} );
|
||||||
|
|
Loading…
Reference in a new issue