zanhecht / randomincategory

randomincategory.toolforge.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

 <html>
	<head>
		<title>RandomInCategory Documentation</title>
		<link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />
		<style>
		body {
			font: 14px sans-serif;
			color: #202122;
		}

		h1 {
			font: 2em 'Linux Libertine','Georgia','Times',serif;
			color: #000;
			line-height: 1.3;
			margin-bottom:7.2px;
			border-bottom: 1px solid #a2a9b1;
			display: block;
		}
		
		code {
			color: #000;
			background-color: #f8f9fa;
			border: 1px solid #eaecf0;
			border-radius: 2px;
			padding: 1px 4px;
		}
		
		a:visited {
			color: #0b0080;
		}
		a {
			text-decoration: none;
			color: #0645ad;
			background: none;
		}
		</style>
	</head>
	<body>
		<h1>Random page in category</h1>
		<p>
			<small>
				Tool created by <a href=https://en.wikipedia.org/wiki/User:Ahecht>Ahecht</a>. Source available at <a href="/source.php">source.php</a> or on <a href="https://github.com/zanhecht/randomincategory">GitHub</a>.
			</small>
		<p>
			The <a href="/RandomInCategory">RandomInCategory</a> tool is a replacement for <a href="https://en.wikipedia.org/wiki/Special:RandomInCategory">Special:RandomInCategory</a> that actually chooses a page randomly. Includes options for filtering results by namespace and type. To use on a wiki, replace <code>[[Special:RandomInCategory/CATEGORY_NAME]]</code> with <code>[[toolforge:RandomInCategory/CATEGORY_NAME]]</code> or <code>[[toolforge:RandomInCategory/CATEGORY_NAME&OPTIONAL_PARAMETERS]]</code>. 
		</p>
		<p>
			Multiple categories can be specified by adding the <code>category2=</code>, <code>category3=</code>, etc. parameters to the url, e.g. <code>[[toolforge:RandomInCategory/Fish&category2=Whales&category3=Crabs&category4=Plankton]]</code>. 
		</p>
		<p>
			By default, the script assumes the category is from <a href="https://en.wikipedia.org/wiki/">en.wikipedia.org</a>. This can be overridden by adding the <code>server=</code> parameters to the url, e.g. <code>&server=commons.wikimedia.org</code>. Do not include "https://" in the site name. The server must at one of the following Wikimedia-owned domains:
		</p>
		<ul>
			<li>mediawiki.org</li>
			<li>toolforge.org</li>
			<li>wikibooks.org</li>
			<li>wikidata.org</li>
			<li>wikimedia.org</li>
			<li>wikinews.org</li>
			<li>wikipedia.org</li>
			<li>wikiquote.org</li>
			<li>wikisource.org</li>
			<li>wikiversity.org</li>
			<li>wikivoyage.org</li>
			<li>wiktionary.org</li>
		</ul>
		<p>
			Results can be filtered by namespace and type by adding the <code>namespace=</code> and <code>type=</code> parameters to the url, e.g. <code>&namespace=2|118&type=page</code>. These parameters are documented as <code>cmnamespace</code> and <code>cmtype</code> at <a href="https://www.mediawiki.org/wiki/API:Categorymembers">https://www.mediawiki.org/wiki/API:Categorymembers</a>, but the "|" between namespaces can optionally be replaced with a ";" or "!" for compatibility with wikilinks.
		</p>
		<p>
			For performance reasons, the list of items is cached for 10 minutes. To manually refresh the cache, set the <code>purge=</code> parameter to any value. Also, any categories with more than 100,000 pages will either redirect to <a href="https://en.wikipedia.org/wiki/Special:RandomInCategory">Special:RandomInCategory</a> or, if multiple categories were requested, return an error message.
		</p>
		<p>
			Set the <code>returntype=</code> parameter to <code>article</code> or <code>subject</code> to return the associated subject page if the randomly chosen page is a talk page. Similarly, <code>returntype=talk</code> will return the associated talk page if the randomly chosen page is a subject page. If the associated page does not exist, the original randomly chosen page will be returned.
		</p>
		<p>
			The script will return the URL of the article and other debugging data instead of actually performing the redirect if the <code>debug=</code> parameter is set to any value.
		</p>
		<p>
			Any other parameters in the URL will be passed on to the target page.
		<p>
			<h4>Examples:</h4>
			<dl>
				<dt>Pending enwiki AFC Drafts in Draft: or User: namespaces:</dt>
				<dd><a href="/Pending_AfC_submissions?server=en.wikipedia.org&namespace=2|118&type=page">/Pending_AfC_submissions?server=en.wikipedia.org&namespace=2|118&type=page</a></dd>
				<dt>Categories about US States:</dt>
				<dd><a href="/States_of_the_United_States?&type=subcat">/States_of_the_United_States?&type=subcat</a></dd>
				<dt>Featured pictures on Wikimedia Commons:</dt>
				<dd><a href="/Featured_pictures_on_Wikimedia_Commons?server=commons.wikimedia.org&type=file">/Featured_pictures_on_Wikimedia_Commons?server=commons.wikimedia.org&type=file</a></dd>
				<dt>Page with the Wikiproject Medicine banner on its talk page:</dt>
				<dd><a href="/All WikiProject Medicine articles?returntype=article">/All WikiProject Medicine articles?returntype=article</a></dd>
				<dt>Edit an article about a primary color:</dt>
				<dd><a href="/Primary_colors?type=page&action=edit">/Primary_colors?type=page&action=edit</a></dd>
			</dl>
		</p>
		
		<hr />
		
		<p>
			<small>
				The MIT License
			</small>
		</p>
		<p>
			<small>
				Copyright &copy; 2020-2024 <a href="https://en.wikipedia.org/wiki/User:Ahecht">Ahecht</a>
			</small>
		</p>
		<p>
			<small>
				Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 			</small>
		</p>
		<p>
			<small>
				The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
			</small>
		</p>
		<p>
			<small>
				THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
			</small>
		</p>
	</body>
</html>

About

randomincategory.toolforge.org

License:MIT License


Languages

Language:PHP 100.0%