This is the documentation page for Module:Tooltips
Tooltips builds tooltip links and icons. It can be used as a static or instantiated class.
Stylesheet for tooltips and tooltip text can be found on MediaWiki:Tooltips.css. The JS script that enables tooltips is sourced from https://dev.fandom.com/wiki/Tooltips
On this Wiki, Tooltips is used in:
- {{A}}
- {{M}}
- {{WF}}
- {{Companion}}
- {{Relic}}
- {{Weapon}}
- {{Arcane}}
- {{D}}
- {{Resource}}
- {{Focus}}
- {{Faction}}
- {{Gear}}
- {{Stat}}
Usage
Direct Invocation
{{#invoke:Tooltip|function|input1|input2|...}}
Examples
Note that these only work on pages with the wikitext content model such as here. In addition, tooltips will not work if a page is added via <tabview> tags.
Haven
Serration
Mirage
Adarza Kavat
Axi A1
Vectis
Arcane Energize
Heat, Flesh,
Ignite
Auron
Protective Sling
Grineer
Requiem Ultimatum
How it works
- When you call a tooltip builder function (e.g.
Tooltips.full(itemName, moduleName, ...)), it uses Module:Tooltips/icon to get the item image and page link from a module's/datasubpage and builds the basic HTML tooltip tags to put on wiki articles (<span class="tooltip tooltip-text" data-param="..." data-param2="..."></span>). - The JS script https://dev.fandom.com/wiki/Tooltips (imported in MediaWiki:ImportJS, configured in MediaWiki:Tooltips.js) does the fetching of data based on
data-param(containing item name) anddata-param2(containing name of module which has a/datadatabase containing the item's data) attributes in tooltip tags to build the actual tooltip defined by wikitext in Module:Tooltips/tip and css in MediaWiki:Tooltips.css.- For example,
<span class="tooltip tooltip-full tooltips-init-complete" data-param="Artemis Bow" data-param2="Weapons">...</span>will display a Template:Weapon tooltip of Artemis Bow (Weapon) while<span class="tooltip tooltip-full tooltips-init-complete" data-param="Artemis Bow" data-param2="Ability">...</span>will display a Template:A ("A" is a shorthand for abilities) tooltip of Artemis Bow. - The processed wikitext for tooltips will be located in a div container on the bottom of articles with an id of
tooltip-storage. - Data fetching uses MediaWiki's Action API.
- Note that tooltips do not work properly on module pages because they do not have the same HTML structure as article pages.
- For example,
Directory
- Module:Tooltips - main module for invoking tooltip function on articles; tooltip builder
- Module:Tooltips/tip - submodule for defining styling of tooltip box that appears on hover over
- Module:Tooltips/icon - submodule for defining where to fetch data for the contents of tooltip box as well as the styling of the icon next to tooltip element
Documentation
Package items
tooltips._getText(name, index, rep)(function)- Returns formatted tooltip link text.
- Parameters:
nameName of object entry to make a tooltip of (string)indexTooltip index table (table)repReplacement args (table)
- Returns: Wikitext link (string)
tooltips._getIcon(_, index)(function)- Returns tooltip icon.
- Parameters:
_Ignore; unused variable (string)indexTooltip index table (table)
- Returns: Image wikilink or nil (string)
tooltips.full(name, source, index)(function)- Get the tooltip text and icon.
- Parameters:
nameName of object entry to make a tooltip of (can also be used as index) (string)sourceName of module containing object entry (nil to check if a manual index is working) (string)indexIndex entry from m:tt/icon, or data point from (source) if source is set (table)frame.args.rReplacement for displayed link text (nil, -> <name>) (string)frame.args.colorColor replacement for displayed link text (e.g. '#ffffff') (string)frame.args.iIndex for data replacement (will also prevent data from loading) (string)frame.args.lLink for data replacement (string)frame.args.nName for data replacement (string)frame.args.iconIcon image name for data replacement (e.g. 'Ash.png') (string)
- Returns: Tooltip tags, icon, & link in wikitext (string)
tooltips.text(name, ...)(function)- Get the tooltip text with no icon.
- Parameters:
nameName of object entry to make a tooltip of (string)...see p.full (string)
- Returns: Tooltip text in wikitext (string)
tooltips.icon(name, ...)(function)- Get the tooltip icon with no text.
- Parameters:
nameName of object entry to make a tooltip of (string)...see p.full (string)
- Returns: Tooltip icon in wikitext (string)
tooltips._getIndex(name, source)(function)- Get the data index.
- Parameters:
nameItem name (string)sourceName of source module containing object entry (string)
- Returns: index table (table)
tooltips.getTip(name, source, slot)(function)- Get the tooltip.
- Parameters:
nameName of object entry to make a tooltip of (string)sourceName of source module containing object entry (string)slotName of submodule (string)
- Returns: Tooltip (string)
tooltips._source(source)(function)- Returns a function that serves as a interface to tooltip builders. Another way of thinking about this function is to treat the entire module as a class. When you require(), the module, you are 'instantiating' a new instance of this class and pass in the name of the database to pull data from. Then you call a tooltip function and pass in a database entry name for the desired tooltip.
- Parameter:
sourceName of source module containing object entry (string) - Returns: Wrapper function (function)
- Created with Docbunto
See Also