summaryrefslogtreecommitdiff
path: root/skins/common/preview.js
diff options
context:
space:
mode:
Diffstat (limited to 'skins/common/preview.js')
-rw-r--r--skins/common/preview.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/skins/common/preview.js b/skins/common/preview.js
index 234dd545..82b27bc1 100644
--- a/skins/common/preview.js
+++ b/skins/common/preview.js
@@ -9,28 +9,28 @@
var postData = $('#editform').formToArray();
postData.push( { 'name' : 'wpPreview', 'value' : '1' } );
-
+
// Hide active diff, used templates, old preview if shown
var copyElements = ['#wikiPreview', '.templatesUsed', '.hiddencats',
'#catlinks'];
var copySelector = copyElements.join(',');
-
+
$.each( copyElements, function(k,v) { $(v).fadeOut('fast'); } );
// Display a loading graphic
var loadSpinner = $('<div class="mw-ajax-loader"/>');
$('#wikiPreview').before( loadSpinner );
-
+
var page = $('<div/>');
var target = $('#editform').attr('action');
-
+
if ( !target ) {
target = window.location.href;
}
-
+
page.load( target + ' ' + copySelector, postData,
function() {
-
+
for( var i=0; i<copyElements.length; ++i) {
// For all the specified elements, find the elements in the loaded page
// and the real page, empty the element in the real page, and fill it
@@ -40,12 +40,12 @@
var newClasses = page.find( copyElements[i] ).attr('class');
$(copyElements[i]).attr( 'class', newClasses );
}
-
+
$.each( copyElements, function(k,v) {
// Don't belligerently show elements that are supposed to be hidden
$(v).fadeIn( 'fast', function() { $(this).css('display', ''); } );
} );
-
+
loadSpinner.remove();
$( mw ).trigger( 'LivePreviewDone', [copyElements] );