Index: trunk/phase3/skins/common/preview.js |
— | — | @@ -6,31 +6,31 @@ |
7 | 7 | e.preventDefault(); |
8 | 8 | |
9 | 9 | $( mw ).trigger( 'LivePreviewPrepare' ); |
10 | | - |
| 10 | + |
11 | 11 | var postData = $('#editform').formToArray(); |
12 | 12 | postData.push( { 'name' : 'wpPreview', 'value' : '1' } ); |
13 | | - |
| 13 | + |
14 | 14 | // Hide active diff, used templates, old preview if shown |
15 | 15 | var copyElements = ['#wikiPreview', '.templatesUsed', '.hiddencats', |
16 | 16 | '#catlinks']; |
17 | 17 | var copySelector = copyElements.join(','); |
18 | 18 | |
19 | 19 | $.each( copyElements, function(k,v) { $(v).fadeOut('fast'); } ); |
20 | | - |
| 20 | + |
21 | 21 | // Display a loading graphic |
22 | 22 | var loadSpinner = $('<div class="mw-ajax-loader"/>'); |
23 | 23 | $('#wikiPreview').before( loadSpinner ); |
24 | | - |
| 24 | + |
25 | 25 | var page = $('<div/>'); |
26 | 26 | var target = $('#editform').attr('action'); |
27 | | - |
| 27 | + |
28 | 28 | if ( !target ) { |
29 | 29 | target = window.location.href; |
30 | 30 | } |
31 | | - |
| 31 | + |
32 | 32 | page.load( target + ' ' + copySelector, postData, |
33 | 33 | function() { |
34 | | - |
| 34 | + |
35 | 35 | for( var i=0; i<copyElements.length; ++i) { |
36 | 36 | // For all the specified elements, find the elements in the loaded page |
37 | 37 | // and the real page, empty the element in the real page, and fill it |
— | — | @@ -40,12 +40,12 @@ |
41 | 41 | var newClasses = page.find( copyElements[i] ).attr('class'); |
42 | 42 | $(copyElements[i]).attr( 'class', newClasses ); |
43 | 43 | } |
44 | | - |
| 44 | + |
45 | 45 | $.each( copyElements, function(k,v) { |
46 | 46 | // Don't belligerently show elements that are supposed to be hidden |
47 | 47 | $(v).fadeIn( 'fast', function() { $(this).css('display', ''); } ); |
48 | 48 | } ); |
49 | | - |
| 49 | + |
50 | 50 | loadSpinner.remove(); |
51 | 51 | |
52 | 52 | $( mw ).trigger( 'LivePreviewDone', [copyElements] ); |