mediawiki.action.edit.preview: Combine two the consecutive .push
[lhc/web/wiklou.git] / resources / src / mediawiki.action / mediawiki.action.edit.preview.js
index 5cd4a7e..013d34f 100644 (file)
@@ -41,6 +41,7 @@
 
                copySelectors = [
                        // Main
+                       '.mw-indicators',
                        '#firstHeading',
                        '#wikiPreview',
                        '#wikiDiff',
                                        diffHtml = query.pages[ query.pageids[ 0 ] ]
                                                .revisions[ 0 ].diff[ '*' ];
                                        $wikiDiff.find( 'table.diff tbody' ).html( diffHtml );
+                                       mw.hook( 'wikipage.diff' ).fire( $wikiDiff.find( 'table.diff' ) );
                                } catch ( e ) {
                                        // "result.blah is undefined" error, ignore
                                        mw.log.warn( e );
                        $wikiDiff.hide();
 
                        $.extend( postData, {
-                               prop: 'text|displaytitle|modules|jsconfigvars|categorieshtml|templates|langlinks|limitreporthtml',
+                               prop: 'text|indicators|displaytitle|modules|jsconfigvars|categorieshtml|templates|langlinks|limitreporthtml',
                                text: $textbox.textSelection( 'getContents' ),
                                pst: true,
                                preview: true,
                                                response.parse.modulestyles
                                        ) );
                                }
+
+                               newList = [];
+                               $.each( response.parse.indicators, function ( i, indicator ) {
+                                       newList.push(
+                                               $( '<div>' )
+                                                       .addClass( 'mw-indicator' )
+                                                       .attr( 'id', mw.util.escapeId( 'mw-indicator-' + indicator.name ) )
+                                                       .html( indicator[ '*' ] )
+                                                       .get( 0 ),
+                                               // Add a whitespace between the <div>s because
+                                               // they get displayed with display: inline-block
+                                               document.createTextNode( '\n' )
+                                       );
+                               } );
+                               $( '.mw-indicators' ).empty().append( newList );
+
                                if ( response.parse.displaytitle ) {
                                        $displaytitle = $( $.parseHTML( response.parse.displaytitle ) );
                                        $( '#firstHeading' ).msg(