Module:Sprite/doc

This module allows sections of an image to be displayed, to reduce on HTTP connections as well as the general slowness that comes from using.

Usage
To set this up, you should at least have a settings table and an IDs table. See Module:ItemSprite and Module:ItemSprite/IDs, for example. The settings table can be loaded in other modules so they can easily use the sprites, and the IDs will be loaded once on a page for efficiency.

Each sprite in the sprite sheet is assigned a number starting at 1, going from left to right, top to bottom. However, this isn't particularly useful, because you would have to remember which number is which image, so we assign names to each number in the IDs table.

Settings

 * name
 * This is used as part of the classname if the sprite uses a stylesheet ( -sprite), or as part of the image name if an image isn't set.


 * image
 * The image to use as the sprite sheet. Unnecessary if the name is set and the image is called Sprite.png, or if the sprite uses as stylesheet.


 * ids
 * The page where the IDs table is kept.


 * sheetsize
 * This is the width of the sprite sheet in pixels. Note that the module only cares about the width of the sprite sheet. The height can be any size, allowing the sheet to easily be extended as needed.


 * size
 * This is the width and height of the sprite in pixels, if it is square.


 * width
 * height
 * These are the width and height of the sprite in pixels, if it is rectangle.


 * origSize
 * origWidth
 * origHeight
 * If you're using a thumbnailed size as the default size, then these are the original width and height of the sprite, otherwise doesn't need to be set.


 * thumbnails
 * This is a table, the keys of which should contain the thumbnail sizes that are supported by this sprite, this is only useful if the sprite uses a stylesheet. The module will calculate the closest larger or exact thumbnail that matches the set size and add the class sprite-size-, for styling.


 * pos
 * This is the default position used if no ID/position is specified, or if the ID specified isn't assigned a position. The page that this occurs on will also be added to Category:Pages with missing sprites.


 * link
 * This is what the sprite should link to. Should generally be left empty so it links to the same name as the ID.


 * align
 * What vertical-align should be used.


 * class
 * What additional classes should be added to the sprite.


 * text
 * What text should be displayed after the sprite. Should generally be left empty so it is the same as the ID.


 * textstyle
 * Styling added to the text.


 * title
 * The tooltip shown when hovering over the sprite.


 * css
 * Additional styling added to the sprite.


 * stylesheet
 * Set if the styling for the sprite is done in a stylesheet (e.g.: MediaWiki:Common.css).

The settings you set in the settings table are the "default" settings, and can be overwritten when using the sprite. When the sprite is set to use a stylesheet, the styling for these defaults are expected to be correctly set in the stylesheet, and any thing that overwrites the default will use inline styling to overwrite the stylesheet.

Functions
Most modules/templates should use the sprite function. The base function usually shouldn't be used anywhere, unless your module is handling the IDs/linking/text itself.

Dependencies

 * Module:ProcessArgs