3 * - rollback confirmation prompt
4 * - firing the postEdit hook upon a successful rollback edit
7 // If a rollback was successful, RollbackAction.php will export wgRollbackSuccess
8 const wgRollbackSuccess = mw.config.get( 'wgRollbackSuccess' );
9 if ( wgRollbackSuccess ) {
10 mw.loader.using( 'mediawiki.action.view.postEdit', () => {
11 // wgCurRevisionId is set to the revision of the rollback
12 // in OutputPage::getJSVars. wgRevisionId is 0, since we're looking at
13 // the success page for the rollback and not the content of the page.
14 // It might make sense to display a success message in a toast, like other
15 // implementations of the postEdit hook, but for now we just want to
16 // enable code that relies on postEdit firing to know that an edit
18 mw.hook( 'postEdit' ).fire();
22 if ( Number( mw.user.options.get( 'showrollbackconfirmation' ) ) !== 1 ) {
23 // Support both 1 or "1" (T54542)
27 function postRollback( url ) {
33 .appendTo( document.body )
37 $( '#mw-content-text' ).confirmable( {
39 confirm: mw.msg( 'rollback-confirmation-confirm' ),
40 yes: mw.msg( 'rollback-confirmation-yes' ),
41 no: mw.msg( 'rollback-confirmation-no' )
43 delegate: '.mw-rollback-link a[data-mw="interface"]',
44 handler: function ( e ) {
46 postRollback( $( this ).attr( 'href' ) );