| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
( function () { |
| 7 |
|
| 8 |
const wgRollbackSuccess = mw.config.get( 'wgRollbackSuccess' ); |
| 9 |
if ( wgRollbackSuccess ) { |
| 10 |
mw.loader.using( 'mediawiki.action.view.postEdit', () => { |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
mw.hook( 'postEdit' ).fire(); |
| 19 |
} ); |
| 20 |
} |
| 21 |
|
| 22 |
if ( Number( mw.user.options.get( 'showrollbackconfirmation' ) ) !== 1 ) { |
| 23 |
|
| 24 |
return; |
| 25 |
} |
| 26 |
|
| 27 |
function postRollback( url ) { |
| 28 |
$( '<form>' ) |
| 29 |
.attr( { |
| 30 |
action: url, |
| 31 |
method: 'post' |
| 32 |
} ) |
| 33 |
.appendTo( document.body ) |
| 34 |
.trigger( 'submit' ); |
| 35 |
} |
| 36 |
|
| 37 |
$( '#mw-content-text' ).confirmable( { |
| 38 |
i18n: { |
| 39 |
confirm: mw.msg( 'rollback-confirmation-confirm' ), |
| 40 |
yes: mw.msg( 'rollback-confirmation-yes' ), |
| 41 |
no: mw.msg( 'rollback-confirmation-no' ) |
| 42 |
}, |
| 43 |
delegate: '.mw-rollback-link a[data-mw="interface"]', |
| 44 |
handler: function ( e ) { |
| 45 |
e.preventDefault(); |
| 46 |
postRollback( $( this ).attr( 'href' ) ); |
| 47 |
} |
| 48 |
} ); |
| 49 |
|
| 50 |
}() ); |