- var isMobile = OO.ui.isMobile();
-
- // Default to unframed on mobile
- config = $.extend( { framed: !isMobile }, config );
- // Change back buttons to icon only on mobile
- if (
- isMobile &&
- (
- config.flags === 'back' ||
- ( Array.isArray( config.flags ) && config.flags.indexOf( 'back' ) !== -1 )
- )
- ) {
+ function checkFlag( flag ) {
+ return config.flags === flag ||
+ ( Array.isArray( config.flags ) && config.flags.indexOf( flag ) !== -1 );
+ }
+
+ // Default to unframed.
+ config = $.extend( { framed: true }, config );
+ if ( checkFlag( 'close' ) ) {
+ // Change close buttons to icon only.
+ $.extend( config, {
+ icon: 'close',
+ invisibleLabel: true
+ } );
+ } else if ( OO.ui.isMobile() && checkFlag( 'back' ) ) {
+ // Change back buttons to icon only.