| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
mw.libs.ve = mw.libs.ve || {}; |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
mw.libs.ve.WelcomeDialog = function VeInitWelcomeDialog( config ) { |
| 19 |
|
| 20 |
mw.libs.ve.WelcomeDialog.super.call( this, config ); |
| 21 |
|
| 22 |
this.$element |
| 23 |
.addClass( 've-init-mw-welcomeDialog' ); |
| 24 |
}; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
OO.inheritClass( mw.libs.ve.WelcomeDialog, OO.ui.MessageDialog ); |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
mw.libs.ve.WelcomeDialog.static.name = 'welcome'; |
| 33 |
|
| 34 |
mw.libs.ve.WelcomeDialog.static.size = 'medium'; |
| 35 |
|
| 36 |
mw.libs.ve.WelcomeDialog.static.actions = [ |
| 37 |
{ |
| 38 |
action: 'switch-wte', |
| 39 |
label: OO.ui.deferMsg( 'visualeditor-welcomedialog-switch' ), |
| 40 |
modes: [ 'visual' ] |
| 41 |
}, |
| 42 |
{ |
| 43 |
action: 'switch-ve', |
| 44 |
label: OO.ui.deferMsg( 'visualeditor-welcomedialog-switch-ve' ), |
| 45 |
modes: [ 'source' ] |
| 46 |
}, |
| 47 |
{ |
| 48 |
action: 'accept', |
| 49 |
label: OO.ui.deferMsg( 'visualeditor-welcomedialog-action' ), |
| 50 |
flags: [ 'progressive', 'primary' ], |
| 51 |
modes: [ 'visual', 'source', 'noswitch' ] |
| 52 |
} |
| 53 |
]; |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
mw.libs.ve.WelcomeDialog.prototype.getSetupProcess = function ( data ) { |
| 59 |
|
| 60 |
data = $.extend( { |
| 61 |
title: mw.msg( 'visualeditor-welcomedialog-title', mw.user, mw.config.get( 'wgSiteName' ) ), |
| 62 |
message: $( '<span>' ) |
| 63 |
.addClass( 've-init-mw-welcomeDialog-content' ) |
| 64 |
.append( |
| 65 |
$( document.createTextNode( mw.msg( 'visualeditor-welcomedialog-content' ) ) ), |
| 66 |
$( '<br>' ), |
| 67 |
$( document.createTextNode( mw.msg( 'visualeditor-welcomedialog-content-thanks' ) ) ) |
| 68 |
) |
| 69 |
}, data ); |
| 70 |
|
| 71 |
return mw.libs.ve.WelcomeDialog.super.prototype.getSetupProcess.call( this, data ) |
| 72 |
.next( () => { |
| 73 |
this.switchable = data.switchable; |
| 74 |
this.editor = data.editor; |
| 75 |
|
| 76 |
this.actions.setMode( this.switchable ? this.editor : 'noswitch' ); |
| 77 |
} ); |
| 78 |
}; |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
mw.libs.ve.WelcomeDialog.prototype.getActionProcess = function ( action ) { |
| 84 |
if ( action === 'switch-wte' ) { |
| 85 |
return new OO.ui.Process( () => { |
| 86 |
this.close( { action: 'switch-wte' } ); |
| 87 |
} ); |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
return mw.libs.ve.WelcomeDialog.super.prototype.getActionProcess.call( this, action ); |
| 92 |
}; |