Using Special:PagePreparation on https://www.mediawiki.org/wiki/OAuth/For_Developers results in a page with multiple diffs if you click prepare multiple times...
When the button is clicked, it should probably be disabled/similar until the request has come back...
And/or it shouldn't just append the diff onto the bottom... The latest should win.
$.when( getPageContent( pageName ) ).done( function ( content ) { pageContent = content; pageContent = pageContent.trim(); pageContent = cleanupTags( pageContent ); pageContent = addLanguageBar( pageContent ); pageContent = addTranslateTags( pageContent ); pageContent = addNewLines( pageContent ); pageContent = fixInternalLinks( pageContent ); pageContent = doTemplates( pageContent ); pageContent = doFiles( pageContent ); pageContent = doCategories( pageContent ); pageContent = postPreparationCleanup( pageContent ); pageContent = pageContent.trim(); getDiff( pageName, pageContent ).done( function ( diff ) { if ( diff === undefined ) { $messageDiv.text( mw.msg( 'pp-diff-error' ) ).removeClass( 'hide' ); return; } $( '.diff tbody' ).append( diff ); $( '.divDiff' ).removeClass( 'hide' ); if ( diff !== '' ) { $messageDiv.text( mw.msg( 'pp-prepare-message' ) ).removeClass( 'hide' ); $( '#action-prepare' ).addClass( 'hide' ); $( '#action-save' ).removeClass( 'hide' ); $( '#action-cancel' ).removeClass( 'hide' ); } else { $messageDiv.text( mw.msg( 'pp-already-prepared-message' ) ).removeClass( 'hide' ); } } ); } );
This also seems to show an even more exacerbated version of the issues raised in T342651: Special:PagePreparation should handled pages with translation markup better (or do nothing)/T245811: PagePreparation doesn't detect languages tag already in page.