/** * Live preview script for MediaWiki */ function doLivePreview( e ) { e.preventDefault(); var previewText = $j('#wpTextbox1').val(); var editToken = $j( '[name="wpEditToken"]' ).attr( 'value' ); var editTime = $j( '[name="wpEdittime"]' ).attr( 'value' ); var startTime = $j( '[name="wpStarttime"]' ).attr( 'value' ); var postData = { 'action' : 'submit', 'wpTextbox1' : previewText, 'wpPreview' : true, 'wpEditToken' : editToken, 'wpEdittime': editTime, 'wpStarttime': startTime, 'title' : wgPageName }; // Hide active diff, used templates, old preview if shown var copyElements = ['#wikiPreview', '.templatesUsed', '.hiddencats', '#catlinks']; var copySelector = copyElements.join(','); $j.each( copyElements, function(k,v) { $j(v).fadeOut('fast'); } ); // Display a loading graphic var loadSpinner = $j('
'); $j('#wikiPreview').before( loadSpinner ); var page = $j(''); page.load( wgScript+'?action=submit '+copySelector, postData, function() { for( var i=0; i