Merge "Move section ID fallbacks into headers themselves"
[lhc/web/wiklou.git] / resources / src / mediawiki.action / mediawiki.action.view.postEdit.js
index 87572ec..e0ab45a 100644 (file)
         * @member mw.hook
         */
 
-       var cookieVal,
-               config = mw.config.get( [ 'wgAction', 'wgCurRevisionId' ] ),
-               // This should match EditPage::POST_EDIT_COOKIE_KEY_PREFIX:
-               cookieKey = 'PostEditRevision' + config.wgCurRevisionId;
+       var postEdit = mw.config.get( 'wgPostEdit' );
 
        function showConfirmation( data ) {
                var $container, $popup, $content, timeoutId;
                        $content.append( data.message );
                }
 
-               $popup = $( '<div>' ).addClass( 'postedit mw-notification' ).append(
-                       $content,
-                       $( '<a>' ).addClass( 'postedit-close' ).attr( 'href', '#' ).text( '×' )
-               ).on( 'click', function ( e ) {
-                       e.preventDefault();
-                       clearTimeout( timeoutId );
-                       fadeOutConfirmation();
-               } );
+               $popup = $( '<div>' ).addClass( 'postedit mw-notification' ).append( $content )
+                       .click( function () {
+                               clearTimeout( timeoutId );
+                               fadeOutConfirmation();
+                       } );
 
                $container = $( '<div>' ).addClass( 'postedit-container' ).append( $popup );
                timeoutId = setTimeout( fadeOutConfirmation, 3000 );
 
        mw.hook( 'postEdit' ).add( showConfirmation );
 
-       // Only when viewing wiki pages, that exist
-       // (E.g. not on special pages or non-view actions)
-       if ( config.wgCurRevisionId && config.wgAction === 'view' ) {
-               cookieVal = mw.cookie.get( cookieKey );
-               if ( cookieVal ) {
-                       mw.config.set( 'wgPostEdit', true );
-
-                       mw.hook( 'postEdit' ).fire( {
-                               // The following messages can be used here:
-                               // postedit-confirmation-saved
-                               // postedit-confirmation-created
-                               // postedit-confirmation-restored
-                               message: mw.msg(
-                                       'postedit-confirmation-' + cookieVal,
-                                       mw.user
-                               )
-                       } );
-
-                       mw.cookie.set( cookieKey, null );
-               }
+       if ( postEdit ) {
+               mw.hook( 'postEdit' ).fire( {
+                       // The following messages can be used here:
+                       // postedit-confirmation-saved
+                       // postedit-confirmation-created
+                       // postedit-confirmation-restored
+                       message: mw.msg(
+                               'postedit-confirmation-' + postEdit,
+                               mw.user
+                       )
+               } );
        }
 
 }( mediaWiki, jQuery ) );