MediaWiki:Gadget-codeAnchors.js

var PCM = mw.config.get( 'wgPageContentModel' ); $( 'pre.source-' + PCM ).find( 'span.coMULTI' ).not( ':contains( "\\n" )' ).each( function {	var anchorID = $( this ).html.slice( $( this ).html.indexOf( '/*' ) + 2, $( this ).html.indexOf( '*/' ) );	anchorID = $.trim( anchorID ).replace( / /g, '_' );	if ( anchorID.length !== 0 ) {		$( this ).attr( 'id ', encodeURIComponent( anchorID ).replace( /%/g, '.' ) ).css( 'background-color', '#FFDDDD' );	} } );