Gamepedia Help Wiki
m (tt-code)
No edit summary
Line 1: Line 1:
{{stub}}
 
 
{{Extension infobox
 
{{Extension infobox
 
| name = Category Intersection
 
| name = Category Intersection
Line 12: Line 11:
 
==Intersection namespace==
 
==Intersection namespace==
 
The Intersection namespace is automatically created when the extension is enabled.
 
The Intersection namespace is automatically created when the extension is enabled.
  +
  +
==Usage==
  +
<pre>[[Intersection:<category1>::<category2>::<category3>]]</pre>
  +
  +
'''Example:''' [[Intersection:Editing::Guides]]
   
 
==Gadget==
 
==Gadget==

Revision as of 15:53, 20 February 2019

Catisect, also known as Category Intersection, is an extension that allows for the searching of category intersections.

Intersection namespace

The Intersection namespace is automatically created when the extension is enabled.

Usage

[[Intersection:<category1>::<category2>::<category3>]]

Example: Intersection:Editing::Guides

Gadget

Category Intersection also uses a gadget that allows the selection of categories directly from an article. The Gadget extension needs to be enabled and the following pages need to be created/added to for the gadget to work.

Definition of the gadget

MediaWiki:Gadgets-definition

* intersection[ResourceLoader]|intersection.js

Javascript for the gadget

MediaWiki:Gadget-intersection.js

$(function() {
	var links = $("#catlinks ul a");
	if (links.length <= 1) return;
	links.before('<input type="checkbox" checked="checked" class="intersect-checkbox" />');
	$("#catlinks ul").last().append('<li class="intersect-item"><button type="button" id="intersect-button">Find similar pages</button></li>');
	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.wikiGetlink('Category:' + outList);
		} else {
			window.location = mw.util.wikiGetlink('Intersection:' + outList);
		}
		$(this).text("Redirecting...");
	});
});

Text on the Preferences page Gadgets tab

MediaWiki:Gadget-intersection

Enable the Category Intersection (Catisect) gadget

Button and styling

The default installation of this extension and the accompanying gadget add a button to the Category links (#catlinks) section of the wiki page. The text shown on the button is defined in the javascript shown above ("Find similar pages"), and the button itself can be styled using the button selector. Unstyled buttons are rectangular with a light grey background.

view of the category links section when this is enabled

End users

For users to be able to benefit from this Extension and associated gadget, they must enable it via their personal user Preferences, on the Gadgets tab.