MediaWiki:Gadget-codeBacklinks.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.co1, span.coMULTI").each(function{	var codeComment = $(this).html.substr($(this).html.indexOf(""));	while(codeComment.indexOf("[[") !== -1 && codeComment.indexOf("") !== -1){		var wikiLink = codeComment.slice(codeComment.indexOf("") +2, codeComment.indexOf(""));		codeComment = codeComment.substr(codeComment.indexOf("]]") +2); console.log("Found a wikilink to:\n\t %s", wikiLink);	} 	codeComment = $(this).html; console.info(codeComment + " means " + codeComment.indexOf(/(about|mail|view source|irc|telnet|gopher|[fh]t?tp)(s)?:([\S]*)/i));	while(codeComment.indexOf(/(about|mail|view source|irc|telnet|gopher|[fh]t?tp)(s)?:([\S]*)/i) !== -1){		var urlLink = codeComment.match(/(about|mail|view source|irc|telnet|gopher|[fh]t?tp)(s)?:([\S]*)/i);		codeComment = codeComment.substr(urlLink.length); console.log("Found a raw link to:\n\t %s", urlLink); } });

// single line no link // single line single link (1) // single line double unspaced links (1)single line double unspaced links (2) // single line double spaced links (1) -- single line double spaced links (2) /* multi line no link */ /* multi-line multi-line single link (1) */ /* multi-line double unspaced links multi-line double unspaced links (1)multi-line double unspaced links (2) */ /* multi-line multi-line double spaced links (1) -- multi-line double spaced links (2) */ /* multi-line //no link around single line */ /* multi-line //multi-line single link around single line (1) around single line */ /* multi-line //double unspaced links around single line (1)double unspaced links around single line (2) around single line */ /* multi-line //double spaced links around single line (1) -- double spaced links around single line (2) around single line */ // single line in front of multi-line /* no link */ // single line in front of multi-line single link /* single line in front of multi-line single link (1) */ // single line in front of multi-line double unspaced links /* single line in front of multi-line double unspaced links (1)single line in front of multi-line double unspaced links (2) */ // single line in front of multi-line double spaced links /* single line in front of multi-line double spaced links (1) -- single line in front of multi-line double spaced links (2) */ /* http://ddowiki.com/edit/MediaWiki:Gadget-codeBacklinks.js#alone */ // http://ddowiki.com/edit/MediaWiki:Gadget-codeBacklinks.js#1 http://ddowiki.com/edit/MediaWiki:Gadget-codeBacklinks.js#02 http://ddowiki.com/edit/MediaWiki:Gadget-codeBacklinks.js#003