X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fsrc%2Fmediawiki.action%2Fmediawiki.action.view.postEdit.js;h=5e859ac8a03c26ffbc5f0da8d11e23bb14468962;hb=ee56f00ddf0609082f8ae9a4dc3e6e1b6f54ddfd;hp=87572ecf8bca55b18db312130e2c30b4f4110098;hpb=2dd58ade75d15a5895c0c010e17b6f729a0f72fe;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js index 87572ecf8b..5e859ac8a0 100644 --- a/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js +++ b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js @@ -22,10 +22,7 @@ * @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; @@ -41,7 +38,12 @@ data = data || {}; if ( data.message === undefined ) { - data.message = $.parseHTML( mw.message( 'postedit-confirmation-saved', data.user || mw.user ).escaped() ); + data.message = $.parseHTML( mw.message( + mw.config.get( 'wgEditSubmitButtonLabelPublish' ) ? + 'postedit-confirmation-published' : + 'postedit-confirmation-saved', + data.user || mw.user + ).escaped() ); } $content = $( '
' ).addClass( 'postedit-icon postedit-icon-checkmark postedit-content' ); @@ -51,14 +53,11 @@ $content.append( data.message ); } - $popup = $( '
' ).addClass( 'postedit mw-notification' ).append( - $content, - $( '' ).addClass( 'postedit-close' ).attr( 'href', '#' ).text( '×' ) - ).on( 'click', function ( e ) { - e.preventDefault(); - clearTimeout( timeoutId ); - fadeOutConfirmation(); - } ); + $popup = $( '
' ).addClass( 'postedit mw-notification' ).append( $content ) + .click( function () { + clearTimeout( timeoutId ); + fadeOutConfirmation(); + } ); $container = $( '
' ).addClass( 'postedit-container' ).append( $popup ); timeoutId = setTimeout( fadeOutConfirmation, 3000 ); @@ -68,26 +67,17 @@ 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 ) );