Open main menu

Snippets/Parser information

< Snippets
How to use Snippets
List of Snippets
Crystal Clear action run.png
Parser information
Language(s): JavaScript
Compatible with: MediaWiki 1.11++ (Monobook; Vector)

DescriptionEdit

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

JavaScriptEdit

/**
 * 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 optionEdit

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 );
}