Page MenuHomeWickedGov Phorge

ve.init.MWVESwitchPopupWidget.js
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

ve.init.MWVESwitchPopupWidget.js

/*!
* VisualEditor user interface MWVESwitchPopupWidget class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
mw.libs.ve = mw.libs.ve || {};
/**
* @class
* @extends OO.ui.PopupWidget
*
* @constructor
* @param {string} mode Current edit mode
* @param {Object} [config] Configuration options
*/
mw.libs.ve.SwitchPopupWidget = function MWLibsVESwitchPopupWidget( mode, config ) {
const prefix = mode === 'visual' ? 'visualeditor-mweditmodewt' : 'visualeditor-mweditmodeve',
option = mode === 'visual' ? 'visualeditor-hidevisualswitchpopup' : 'visualeditor-hidesourceswitchpopup';
// Parent constructor
mw.libs.ve.SwitchPopupWidget.super.call( this, $.extend( {
autoClose: true,
head: true,
// The following messages are used here:
// * visualeditor-mweditmodewt-popup-title
// * visualeditor-mweditmodeve-popup-title
label: mw.msg( prefix + '-popup-title' ),
padded: true
}, config ) );
// The following messages are used here:
// * visualeditor-mweditmodewt-popup-body
// * visualeditor-mweditmodeve-popup-body
let $content = $( '<p>' ).text( mw.msg( prefix + '-popup-body' ) );
if ( mw.user.isNamed() ) {
const showAgainCheckbox = new OO.ui.CheckboxInputWidget()
.on( 'change', ( value ) => {
const configValue = value ? '1' : '';
new mw.Api().saveOption( option, configValue );
mw.user.options.set( option, configValue );
} );
const showAgainLayout = new OO.ui.FieldLayout( showAgainCheckbox, {
align: 'inline',
label: mw.msg( 'visualeditor-mweditmodeve-showagain' )
} );
$content = $content.add( showAgainLayout.$element );
}
this.$body.append( $content );
this.$element
// HACK: Pretend to be a PopupTool
// TODO: Create upstream PopupListToolGroup
.addClass( 've-init-mw-switchPopupWidget' );
};
/* Inheritance */
OO.inheritClass( mw.libs.ve.SwitchPopupWidget, OO.ui.PopupWidget );

File Metadata

Mime Type
text/plain
Expires
Aug 18 2026, 06:20 (7 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
fe/8e/0e7cf971319a348a34f5f6cb18eb
Default Alt Text
ve.init.MWVESwitchPopupWidget.js (1 KB)

Event Timeline