MediaWiki:Gadget-codeAnchors.js

var PCM = mw.config.get( "wgTitle" ).substr(mw.config.get( "wgTitle" ).lastIndexOf(".")); if(PCM === ".js"){ PCM = "javascript"; }else if(PCM === ".css"){ PCM = "css"; } $("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", "#FDD");	} });