Snippets/Parser information

How to use Snippets
List of Snippets
Parser information
Language(s): JavaScript
Compatible with: MediaWiki 1.11++ (Monobook; Vector)

Description edit

Make "NewPP parser report" and "Saved in parser cache with key" HTML comments visible at the bottom of the page.

JavaScript edit

/**
 * Parser information: Uncomment the parser reports and parser cache informations
 *
 * @source: https://www.mediawiki.org/wiki/Snippets/Parser_information
 * @rev: 2
 */
$( '#bodyContent' ).contents().filter( function() {
	if ( this.nodeType == 8 )  {
		return ( this.data.indexOf( 'Saved' ) > 0 ||
			this.data.indexOf( 'NewPP' ) > 0 );
	} else {
		return false;
	}
}).replaceWith( function() {
  return $( '<pre></pre>' ).text( this.data );
});

URL option edit

MediaWiki version:
1.17
/**
 * Parser information: Uncomment the parser reports and parser cache informations
 *
 * @source: https://www.mediawiki.org/wiki/Snippets/Parser_information
 * @rev: 2
 */
function ShowParseInfo(){
	$( '#bodyContent' ).contents().filter( function() {
		if ( this.nodeType == 8 )  {
			return ( this.data.indexOf( 'Saved' ) > 0 ||
				this.data.indexOf( 'NewPP' ) > 0 );
		} else {
			return false;
		}
	}).replaceWith( function() {
		return $( '<pre></pre>' ).text( this.data );
	});
}
if ( mw.util.getParamValue('debug') == 'true' ) {
	$(document).ready( ShowParseInfo );
}