4 var config = mw.config.get( [ 'wgAction', 'wgCookiePrefix', 'wgCurRevisionId' ] ),
5 // This should match EditPage::POST_EDIT_COOKIE_KEY_PREFIX:
6 cookieKey = config.wgCookiePrefix + 'PostEditRevision' + config.wgCurRevisionId,
9 function showConfirmation( data ) {
11 if ( data.message === undefined ) {
12 data.message = $.parseHTML( mw.message( 'postedit-confirmation', data.user || mw.user ).escaped() );
16 '<div class="postedit-container">' +
17 '<div class="postedit">' +
18 '<div class="postedit-icon postedit-icon-checkmark postedit-content"></div>' +
19 '<a href="#" class="postedit-close">×</a>' +
24 if ( typeof data.message === 'string' ) {
25 $div.find( '.postedit-content' ).text( data.message );
26 } else if ( typeof data.message === 'object' ) {
27 $div.find( '.postedit-content' ).append( data.message );
31 .click( fadeOutConfirmation )
34 id = setTimeout( fadeOutConfirmation, 3000 );
37 function fadeOutConfirmation() {
39 $div.find( '.postedit' ).addClass( 'postedit postedit-faded' );
40 setTimeout( removeConfirmation, 500 );
45 function removeConfirmation() {
47 mw.hook( 'postEdit.afterRemoval' ).fire();
50 mw.hook( 'postEdit' ).add( showConfirmation );
52 if ( config.wgAction === 'view' && $.cookie( cookieKey ) === '1' ) {
53 $.cookie( cookieKey, null, { path: '/' } );
54 mw.config.set( 'wgPostEdit', true );
59 * @param {Object} [data]
60 * @param {string|jQuery|Array} [data.message] Message that listeners
61 * should use when displaying notifications. String for plain text,
62 * use array or jQuery object to pass actual nodes.
63 * @param {string|mw.user} [data.user=mw.user] User that made the edit.
65 mw.hook( 'postEdit' ).fire();
68 } ( mediaWiki, jQuery ) );