Post-edit confirmation: ensure consistent font-size across skins
[lhc/web/wiklou.git] / resources / mediawiki.action / mediawiki.action.edit.preview.js
index cddf6cc..0566a87 100644 (file)
@@ -12,6 +12,7 @@
 
                e.preventDefault();
 
+               // Deprecated: Use mw.hook instead
                $( mw ).trigger( 'LivePreviewPrepare' );
 
                $wikiPreview = $( '#wikiPreview' );
@@ -78,7 +79,7 @@
 
                // Load new preview data.
                // TODO: This should use the action=parse API instead of loading the entire page
-               // Though that requires figuring out how to conver that raw data into proper HTML.
+               // Though that requires figuring out how to convert that raw data into proper HTML.
                $previewDataHolder.load( targetUrl + ' ' + copySelectors.join( ',' ), postData, function () {
                        var i, $from;
                        // Copy the contents of the specified elements from the loaded page to the real page.
                                        .attr( 'class', $from.attr( 'class' ) );
                        }
 
+                       // Deprecated: Use mw.hook instead
+                       $( mw ).trigger( 'LivePreviewDone', [copySelectors] );
+
+                       mw.hook( 'wikipage.content' ).fire( $wikiPreview );
+
                        $spinner.remove();
                        $copyElements.animate( {
                                opacity: 1
                        }, 'fast' );
-
-                       $( mw ).trigger( 'LivePreviewDone', [copySelectors] );
                } );
        }
 
-       $( document ).ready( function () {
+       $( function () {
+               // Do not enable on user .js/.css pages, as there's no sane way of "previewing"
+               // the scripts or styles without reloading the page.
+               if ( $( '#mw-userjsyoucanpreview' ).length || $( '#mw-usercssyoucanpreview' ).length ) {
+                       return;
+               }
+
                // The following elements can change in a preview but are not output
                // by the server when they're empty until the preview reponse.
                // TODO: Make the server output these always (in a hidden state), so we don't