diff --git a/VisualEditor.php b/VisualEditor.php index df108ac9c6..996de4955e 100644 --- a/VisualEditor.php +++ b/VisualEditor.php @@ -182,6 +182,9 @@ $wgResourceModules += array( 'tooltip-ca-editsource', 'tooltip-ca-ve-edit', 'visualeditor-ca-editsource-section', + 'postedit-confirmation-created', + 'postedit-confirmation-restored', + 'postedit-confirmation-saved', ), 'position' => 'top', ), @@ -232,9 +235,6 @@ $wgResourceModules += array( 'summary-preview', // Messages needed by VE in init phase only (rest go below) - 'postedit-confirmation-created', - 'postedit-confirmation-restored', - 'postedit-confirmation-saved', 'visualeditor-loadwarning', 'visualeditor-loadwarning-token', 'visualeditor-savedialog-identify-anon', diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js index 05b4263870..5efaae863a 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js +++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js @@ -474,9 +474,12 @@ } $( function () { + var currentUri = new mw.Uri( location.href ), + isSection; + if ( init.isAvailable ) { if ( isViewPage && uri.query.veaction === 'edit' ) { - var isSection = uri.query.vesection !== undefined; + isSection = uri.query.vesection !== undefined; init.showLoading(); ve.track( 'mwedit.init', { type: isSection ? 'section' : 'page', mechanism: 'url' } ); @@ -493,5 +496,17 @@ if ( userPrefEnabled ) { init.setupSkin(); } + + if ( currentUri.query.venotify ) { + // The following messages can be used here: + // postedit-confirmation-saved + // postedit-confirmation-created + // postedit-confirmation-restored + mw.hook( 'postEdit' ).fire( { + message: mw.msg( 'postedit-confirmation-' + currentUri.query.venotify, mw.user ) + } ); + + delete currentUri.query.venotify; + } } ); }() ); diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js index cd1c625c56..f1b3da98e3 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js @@ -98,18 +98,6 @@ ve.init.mw.ViewPageTarget = function VeInitMwViewPageTarget() { sanityCheckComplete: 'updateToolbarSaveButtonState' } ); - if ( currentUri.query.venotify ) { - // The following messages can be used here: - // postedit-confirmation-saved - // postedit-confirmation-created - // postedit-confirmation-restored - mw.hook( 'postEdit' ).fire( { - message: ve.msg( 'postedit-confirmation-' + currentUri.query.venotify, mw.user ) - } ); - - delete currentUri.query.venotify; - } - if ( history.replaceState ) { // This is to stop the back button breaking when it's supposed to take us back out // of VE. It used to only be called when venotify is used. FIXME: there should be