Modèle:Tooltip/doc

De Lotro-wiki
Sauter à la navigation Sauter à la recherche

This template provides most of the basic capabilities for Lotro-Wiki's tooltip ("pop-up") displays. It is not intended to be used directly, but rather constitutes a "back-end" for higher-level templates such as Template:Item Tooltip and Template:Effect. As more of our templates become modernized, we'll be able to provide the pop-up functionality for additional pages, such as quests, skills, and the like.

Modes

There are currently four modes available for tooltip-enabled pages (currently all pages using Template:Item Tooltip, Template:Recipe, and Template:Effect).

mode=link
This displays simply as a pop-up enabled link. Hovering the mouse over the link will display any tooltip content on the target page.
Example: {{:The Enemy's Doom|mode=link}} yields The Enemy's Doom
Note: This is unnecessary for pages in the Item: namespace, as links to items are auto-enabled for pop-ups.
mode=icon
This mode displays the icon defined at the target page, with an optional amount overlay.
Example: {{:Item:Minstrel's Friend|mode=icon|amount=3}} yields Item:Minstrel's Friend
Example: link=The Enemy's Doom
Note: amount will only work for pages that properly pass amount parameters down to this template (i.e. only items at this point). Also, because icons created this way act as a link to the target page, item icons will generate an on-hover pop-up while effect icons will not (see note above).
mode=imlink
This is a combination of the previous two modes and displays the familiar icon-and-link format widely used for item and effect links on Lotro-Wiki. For item pages with a defined quality, the link will be displayed in that item's quality. Included in or mimicked by Template:Reward and Template:Barter
Example 1: {{:The Enemy's Doom|mode=imlink}} yields The Enemy's Doom
Example 2a: {{:Item:Token of Valour|mode=imlink|amount=3}} yields Item:Token of Valour
Example 2b: {{:Item:Token of Valour|mode=imlink_plain}} yields Item:Token of Valour
Note: Items can be displayed without quality coloring (as in example 2b) by using the pseudo-mode imlink_plain defined in Template:Item Tooltip. This is the default functioning for Template:Reward as use of colors is generally discouraged outside of specific template cases. Display of amount overlays is bugged when using this method, though, so either a) use colors and overlay together or b, preferred) don't use overlays at all.
mode=tableimlink
This is the same as the previous mode, but wraps each icon-link pair in a set of <tr>...</tr> tags with the icon and the name in separate table elements. This was likely added for a specific template (Template:Deed or Template:Vendorlist) and may no longer be useful.
Example:
<table style="background:grey;">
<tr><td>Column A</td><td> Column B</td></tr>
{{:Item:Fruit Roll|mode=tableimlink}}
{{:Item:Lover's Helm|mode=tableimlink}}
</table>

Item:Fruit Roll Item:Lover's Helm

Column A Column B

Using in Default Mode

The four modes listed above should only be used when directly calling (transcluding) an item or effect that is tooltip-enabled. Calling this template directly with any of these modes serves no purpose, as Template:Tooltip has no icon, stats, attributes, flavour text, etc. to display. All that information must be properly passed down by the item/effect page and the ensuing template chain. The syntax below constitutes the first step in that chain, and provides options for other templates to format the black tooltip box. Note the emphasis on "template," as this only creates a container for other templates to fill with information and is not intended to be used directly.

Syntax

{{Tooltip
| mode           = <!-- Sets the mode in which to display passed information,
                        use {{{mode|}}} when calling in an intermediate template -->
| icon           = <!-- The filename (omit ".png") of the icon to be displayed at the top left
                        Icons display at 32px when name matches disambigpage, 24px otherwise
| size           = <!-- Icon size, only used for mode=imlink.
                        For valid values, see [[Template:Icon]]. -->
| name           = <!-- The name of the item/effect/etc, displayed at
                        the top of the box just to the right of the icon -->
| disambigpage   = <!-- The name on which the last page in the chain will live,
                        this should generally be set to {{{disambigpage|}}} -->
| amount         = <!-- Used for stack overlay displays, this should generally
                        be set to {{{amount|}}} when dealing with items and omitted otherwise -->
| float          = <!-- Style the box to float left or right, default is
                        right when name matches disambigpage and left otherwise -->
| width          = <!-- Style the width of the box, default is 18em -->
| padtop         = <!-- Add additional padding between the top of the box
                        and the first line, defaults to 1em -->
| pad            = <!-- Add additional padding between the left edge of the box
                        and the enclosed text, default is 1em --.
| font-size      = <!-- Font size for the displayed name -->
| trailing-text  = <!-- Optional text, only used for mode=imlink.
                        The text is displayed as-is directly after "icon" and "name"; two whites-spaces are padded after "name". -->
| noclear        = <!-- ??? possibly has no effect -->
| alltherest     = <!-- The remainder of the information included by next
                        template in the chain, formatted as needed -->
}}


...additional documentation to come...