From: Kaldari Date: Fri, 31 Aug 2012 23:53:21 +0000 (+0000) Subject: Merge "(bug 25830) fix JS preview causing the page to "jump"" X-Git-Tag: 1.31.0-rc.0~22498 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/supprimer.php?a=commitdiff_plain;h=40edd09eb94a05e768eb4ec3fba482a7ddbe39cc;p=lhc%2Fweb%2Fwiklou.git Merge "(bug 25830) fix JS preview causing the page to "jump"" --- 40edd09eb94a05e768eb4ec3fba482a7ddbe39cc diff --cc skins/common/preview.js index 823d46781b,292255815b..0053b5ee4d --- a/skins/common/preview.js +++ b/skins/common/preview.js @@@ -7,15 -9,32 +9,32 @@@ $( 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 = $('
');