Template:Inlinespoiler

From Monarchists.Wiki

{{{1}}}

Template documentation[view] [edit] [history] [purge]

Syntax[edit]

{{Spoiler
|hovertext=
|1=
}}

Type {{spoiler|text}} to produce text.

Type {{spoiler|hovertext=Your cursor is hovering above a spoiler. Click to display/hide.|text}} to produce text.

TypeType {{spoiler|[[text]]}} to produce text.

TypeType {{spoiler|[[text does not exist]]}} to produce text does not exist.

This works for all types of texts, whether unlinked, blue linked, or red linked. All will be visible if the area affected is clicked. It will work the same on external links, and it will hide everything except for the external link arrow icon.

The template puts a white overlay over text and all types of links.

This template is an originally created MediaWiki equivalent to the spoiler code for text used on TV Tropes.org and should function in an equivalent manner.

Template's code[edit]

This template uses the following CSS based template code:

<span class="spoiler spoilerhidden" title="{{{hovertext|This is a spoiler. Click to display or hide.}}}">{{{1}}}</span>

CSS required to make this template function[edit]

This template depends on the following CSS and JavaScript, respectively, being implemented in the common.css and common.js files, respectively, on your MediaWiki installation:

.spoilerhidden, .spoilerhidden a, spoilerhidden a:visited, .spoilerhidden .new, .spoilerhidden .external, .spoilerhidden .extiw {
	color: #fff !important;
	background-image: none;
}
$(function(){
	$(".spoiler").click(function(){
		$(this).toggleClass("spoilerhidden");
	});
	$('.spoiler a').click( function (e) {
		if( $(this).parents('.spoilerhidden').length ) {
			e.preventDefault();
		}
	});
});

Copy and paste the CSS to your MediaWiki:Common.css file and the JavaScript to your MediaWiki:Common.js file for this template to work.

See also[edit]