Merge "support for interwikis in experimental JS preview"
authorCatrope <roan.kattouw@gmail.com>
Thu, 23 Aug 2012 21:04:52 +0000 (21:04 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 23 Aug 2012 21:04:52 +0000 (21:04 +0000)
skins/common/preview.js

index 9e76ca0..de4bcff 100644 (file)
@@ -12,7 +12,7 @@
 
                // Hide active diff, used templates, old preview if shown
                var copyElements = ['#wikiPreview', '.templatesUsed', '.hiddencats',
-                                                       '#catlinks'];
+                                                       '#catlinks', '#p-lang'];
                var copySelector = copyElements.join(',');
 
                $.each( copyElements, function(k,v) { $(v).fadeOut('fast'); } );
        };
 
        $(document).ready( function() {
-               $('#wpPreview').click( doLivePreview );
+               // construct space for interwiki links if missing
+               // (it is usually not shown when action=edit, but shown if action=submit)
+               if ( !document.getElementById( 'p-lang' ) && document.getElementById( 'p-tb' ) ) {
+                       // we need not hide this, because it's empty anyway
+                       $( '#p-tb' ).after( $( '<div>' ).attr( 'id', 'p-lang' ) );
+               }
+
+               $( '#wpPreview' ).click( doLivePreview );
        } );
 }) ( jQuery );