mediawiki.action.edit.preview: Disable if there is no #wpTextbox1
[lhc/web/wiklou.git] / resources / src / mediawiki.action / mediawiki.action.edit.preview.js
index 7e7fe91..84bde7d 100644 (file)
        $( 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 ) {
+               // Do not enable for ProofreadPage Index page editors, which have no textbox
+               if ( $( '#mw-userjsyoucanpreview' ).length || $( '#mw-usercssyoucanpreview' ).length || $( '#wpTextbox1' ).length === 0 ) {
                        return;
                }
 
                if ( !document.getElementById( 'wikiDiff' ) && document.getElementById( 'wikiPreview' ) ) {
                        $( '#wikiPreview' ).after(
                                $( '<div>' )
+                                       .hide()
                                        .attr( 'id', 'wikiDiff' )
                                        .html( '<table class="diff"><col class="diff-marker"/><col class="diff-content"/>' +
                                                '<col class="diff-marker"/><col class="diff-content"/><tbody/></table>' )