Snippets/Top icons

From MediaWiki.org
Jump to: navigation, search
How to use Snippets
List of Snippets
Crystal Clear action run.png
Top icons
Language(s): javascript, css
Compatible with:

MediaWiki 1.17+ (Vector; Monobook)

Description[edit | edit source]

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 | edit source]

/**
 * Icons on the top right of the article.
 * See also CSS
 *
 * @source www.mediawiki.org/wiki/Snippets/Top_icons
 * @version 5
 */
$( function ( $ ) {
	$( '.Top_icon_raw' )
		.removeClass( 'Top_icon_raw' )
		.addClass( 'Top_icon_dynamic' )
		.prependTo( '#firstHeading' );
} );

Stylesheet[edit | edit source]

/**
 * Icons on the top right of the article.
 * See also JS
 *
 * @source www.mediawiki.org/wiki/Snippets/Top_icons
 * @version 5
 */
/* 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;
}