(bug 8618) support for summary preview in live preview
authorMatmaRex <matma.rex@gmail.com>
Thu, 9 Aug 2012 16:16:27 +0000 (18:16 +0200)
committerMatmaRex <matma.rex@gmail.com>
Thu, 23 Aug 2012 21:12:33 +0000 (23:12 +0200)
We have to check for the existence of .mw-summary-preview and add it if
it's missing.

See change Idda2e6f7 for more details; this change is analogous.

Change-Id: I4f4f91ed3b51a54b645bca9697c2840b717bddf6

skins/common/preview.js

index de4bcff..a332a8e 100644 (file)
@@ -12,7 +12,7 @@
 
                // Hide active diff, used templates, old preview if shown
                var copyElements = ['#wikiPreview', '.templatesUsed', '.hiddencats',
-                                                       '#catlinks', '#p-lang'];
+                                                       '#catlinks', '#p-lang', '.mw-summary-preview'];
                var copySelector = copyElements.join(',');
 
                $.each( copyElements, function(k,v) { $(v).fadeOut('fast'); } );
                        $( '#p-tb' ).after( $( '<div>' ).attr( 'id', 'p-lang' ) );
                }
 
+               // construct space for summary preview if missing
+               if ( $( '.mw-summary-preview' ).length === 0 ) {
+                       $( '.editCheckboxes' ).before( $( '<div>' ).addClass( 'mw-summary-preview' ) );
+               }
+
                $( '#wpPreview' ).click( doLivePreview );
        } );
 }) ( jQuery );