MediaWiki:Gadget-intersection.js

$(function {	var links = $("#catlinks ul a");	if (links.length <= 1) return;	links.before('');	$("#catlinks ul").last.append('Find similar pages ');	mw.util.addCSS('#catlinks li.intersect-item {border-left: none}');	$("#intersect-button").click(function { var outList = "", outCount = 0; $("#catlinks .intersect-checkbox:checked + a").each(function {			outList += (outCount++ ? '::' : '') + $(this).text;		}); if (outCount == 0) { alert("You must select at least one category to find similar pages."); return; } else if (outCount == 1) { window.location = mw.util.getUrl('Category:' + outList); } else { window.location = mw.util.getUrl('Intersection:' + outList); }		$(this).text("Redirecting..."); }); });