Template:Icon

From MafiaWiki
Jump to: navigation, search
Template documentation (for the above template, sometimes hidden or invisible)

Template for displaying small icons.

Usage

{{icon|name of icon}}

Parameters

Requiredx14px
{{#replace:{{#replace:{{#replace:{{#replace:<unnamed 1>|| }}| >> | up to }}| // | or }}| ++ |, }}

Which icon should be displayed. See below for the list of available options.

Optionalx14px
(default: "normal")
{{#replace:{{#replace:{{#replace:{{#replace:<unnamed 2>|| }}| >> | up to }}| // | or }}| ++ |, }}

Specifies size of the icon. Can either be set to one of the presets below or directly given as a px value (same syntax as for setting image size of a normal file link).

The presets are:

  • normal: Icons will be displayed at 14px height.
  • big: Icons will be displayed at 20px height.
Optionalx14px
{{#replace:{{#replace:{{#replace:{{#replace:link|| }}| >> | up to }}| // | or }}| ++ |, }}

Page the icon should link to (without enclosing "[[]]").

Optionalx14px
{{#replace:{{#replace:{{#replace:{{#replace:tooltip|| }}| >> | up to }}| // | or }}| ++ |, }}

Tooltip text displayed when hovering over the icon. Overrides the icon's default text.

Available icons

Name(s) Icon
ability Abilityx14px
ac, shieldbronze Armor classx14px
action, ap Action pointsx14px
attack, crosshair Attackx14px
caravan, cards Cardsx14px
chance, percent Chancex14px
check, yes Yes
checkbrown, temporary Temporary
companion Companionx14px
confidence Confidencex14px
cross, no No
cut Cut contentx14px
damage Damagex14px
dead Deadx14px
defense, dr, shieldsilver Damage resistancex14px
detect, detection, eye Detectionx14px
dial, dialogue Dialoguex14px
distance, range Distancex14px
doctor Doctorx14px
dt, shieldgold Damage thresholdx14px
effect Effectx14px
Name(s) Icon
electrical Electricalx14px
emp EMPx14px
enslave Can be enslavedx14px
essential Essentialx14px
experience, xp Experience pointsx14px
explosion Explosionx14px
fire Firex14px
fist Fistx14px
gamerscore Xbox Live gamerscorex14px
gas Gasx14px
gun Gunx14px
group Groupx14px
healing, healing rate Healing ratex14px
health, heart, hp Health pointsx14px
image Imagex14px
info Informationx14px
laser Laserx14px
level Levelx14px
mac Macintosh Classic or Mac OS Xx14px
macclassic Macintosh Classic (≤ MacOS 9)x14px
melee Meleex14px
Name(s) Icon
merchant Merchantx14px
neutral Neutralx14px
optional Optionalx14px
pc PCx14px
plasma Plasmax14px
poison Poisonx14px
ps3 PlayStation 3x14px
ps3trophy PlayStation 3 trophyx14px
radiation Radiationx14px
repair Repairx14px
repeat Repeatx14px
required Requiredx14px
semi-required Sometimes required or at least one requiredx14px
sequence Sequencex14px
sic In-game spelling, punctuation and/or grammarx14px
sound Soundx14px
spawn Spawnedx14px
text Textx14px
wild wasteland, ww Wild Wastelandx14px
xbox360 Xbox 360x14px

Template:Clear In addition, all abbrevations supported by {{Abb}} can be used to produce an icon for the corresponding game.

Adding new icons

Simply add the following to the "ICON DEFINITIONS" section of the template and fill it out:

  -->|<!-- ICON NAME -->=<!--
   -->{{#vardefine:icon-image|<!-- FILE NAME -->}}<!--
   -->{{#vardefine:icon-tooltip|<!-- TOOLTIP TEXT -->}}<!--

Please note:

  • The icon name needs to be in all-lowercase.
  • File names should be specified without "File:" prefix.

In addition, please try to maintain alphabetical order of icon names within the template.

"High-use" icons

The template supports a special setup for "high-use" icons in order to minimize loading times and overcome certain technical limitations regarding the number of images on a given wiki page. Basically when this setup is used for an icon, the icon is rendered as a background image. As such, it requires manual additions to be made to MediaWiki:Common.css and should only be used for icons of which potentially very many are used on a given page.

To set up an icon as "high-use":

  • In the template, add a new row below the standard ones for file name and tooltip text which specifies the name of the icon's CSS class. All in all, the section for a high-use icon should look like this:
  -->|ICONNAME=<!--
   -->{{#vardefine:icon-image|FILENAME}}<!--
   -->{{#vardefine:icon-tooltip|TOOLTIPTEXT}}<!--
   -->{{#vardefine:icon-highuse|CLASSNAME}}<!--
CLASSNAME should be in all-lowercase. The template automatically prepends "va-icon-highuse-" to whatever you specify; e.g. if you set the variable to "example", the class name would end up being "va-icon-highuse-example".
  • On this documentation page, add a new row to the table below and replace all instances of "FILENAME" with the name of the file (without "File:").
|-
| [[File:FILENAME|x14px]]
| {{fileurl|FILENAME|x14px|url type=relative}}
| [[File:FILENAME|x20px]]
| {{fileurl|FILENAME|x20px|url type=relative}}
  • In MediaWiki:Common.css, add the following to the "Template:Icon" section (preferably in the vicinity of the already existing high-use icons):
.va-icon-big .va-icon-highuse-CLASSNAME {
   background-image: url(PATH-NORMAL);
}
.va-icon-normal .va-icon-highuse-CLASSNAME {
   background-image: url(PATH-BIG);
}
Replace:
  • "CLASSNAME" with the value of the "icon-highuse" variable.
  • "PATH-NORMAL" with the content of the corresponding cell in the table above.
  • "PATH-BIG" with the content of the corresponding cell in the table above.

Examples

Input Result
{{icon|cut}} Cut contentx14px
{{icon|cut|big}} Cut contentx20px
{{icon|cut|link=Fallout Wiki}} Cut contentx14px
{{icon|cut|tooltip=Custom tooltip}} Custom tooltipx14px

Technical


Visit Template:Icon/doc to edit this text! (How does this work?)