Snippets/Top icons

How to use Snippets
List of Snippets
Top icons
Language(s): JavaScript , CSS
Compatible with: MediaWiki 1.22+ (Vector; Monobook)

Description

edit
Please use page indicators instead. Top icons is a snippet to emulate this functionality on older installations before MediaWiki 1.25.

Icons on the top right of the article. Use class="Top_icon_raw" in the icon templates to trigger it. No styles should be set (so no position, float, clear, margin, padding etc.) the script will take care of this.

JavaScript

edit
/**
 * Icons on the top right of the article.
 * See also CSS
 *
 * @source https://www.mediawiki.org/wiki/Snippets/Top_icons
 * @author Krinkle
 * @version 6
 */
mw.hook( 'wikipage.content' ).add( function ( $content ) {
	$content.find( '.Top_icon_raw' )
		.removeClass( 'Top_icon_raw' )
		.addClass( 'Top_icon_dynamic' )
		.prependTo( '#firstHeading' );
} );

Stylesheet

edit
/**
 * Icons on the top right of the article.
 * See also JS
 *
 * @source https://www.mediawiki.org/wiki/Snippets/Top_icons
 * @author Krinkle
 * @version 6
 */
/* Hide without javascript */
.Top_icon_raw {
	display: none;
}
/* With JavaScript */
.Top_icon_dynamic {
	float: right;
	padding-left: 10px;
	font-size: 50%;
	width: auto !important;
}
.Top_icon_raw p, .Top_icon_dynamic p {
	padding: 0;
	margin: 0;
}