$( mw ).trigger( 'LivePreviewPrepare' );
+ var $wikiPreview = $( '#wikiPreview' );
+
+ $( '#mw-content-text' ).css( 'position', 'relative' );
+
+ if ( $wikiPreview.is( ':visible' ) ) {
+ previewShowing = true;
+ }
+
+ // show #wikiPreview if it's hidden (if it is hidden, it's also empty, so nothing changes in the rendering)
+ // to be able to scroll to it
+ $wikiPreview.show();
+
+ // Jump to where the preview will appear
+ $wikiPreview[0].scrollIntoView();
+
var postData = $('#editform').formToArray();
- postData.push( { 'name' : 'wpPreview', 'value' : '1' } );
+ postData.push( { 'name' : e.target.name, 'value' : '1' } );
// Hide active diff, used templates, old preview if shown
- var copyElements = ['#wikiPreview', '.templatesUsed', '.hiddencats',
- '#catlinks'];
+ var copyElements = ['#wikiPreview', '#wikiDiff', '.templatesUsed', '.hiddencats',
+ '#catlinks', '#p-lang', '.mw-summary-preview'];
var copySelector = copyElements.join(',');
- $.each( copyElements, function(k,v) { $(v).fadeOut('fast'); } );
+ $.each( copyElements, function( k, v ) {
+ $( v ).fadeTo( 'fast', 0.4 );
+ } );
// Display a loading graphic
var loadSpinner = $('<div class="mw-ajax-loader"/>');