Module:Tooltip/doc

这是Module:Tooltip的文档页面

This module is similar to {{Tooltip}} but for modules. It contains a number of related utility functions.

tooltip

This function generates a tooltip with the display text shown on the wiki page and the header and body shown when hovering over the display text.

Parameter Description Required Default
1 Text/content shown on page (displayText) required none
2 Initial text/content of tooltip (header) optional none
3 Final text/content of tooltip (body) optional none
tagType HTML tag used to wrap tooltip
  • span: allows default inline use in paragraphs
  • div: requires wrapping paragraphs in span or div
optional div
index tooltip level, for tooltip-in-a-tooltip
  • 1, 2, or 3
optional none
style CSS style effects for tooltip optional none

Numbered parameters must be passed in order, named parameters must be passed as a table following; i.e. tooltip( 1, 2, 3, { tagType = val, index = val, style = val } ) Empty strings must be used for empty header or body if using named parameters.

headerStyle

This function makes it easier to style the header for tooltips by providing a standard frame

Parameter Description Required Default
1 Name of header style (headerType) required none
mainText Main text/title optional none
subText Subtitle optional none
leftText Text/content to left of mainText optional none
rightText Text/content to right of mainText optional none
extra Additional CSS style effects for tooltip optional none

Numbered parameters must be passed in order, named parameters must be passed as a table following; i.e. headerStyle( 1, { mainText = val, subText = val, leftText = val, rightText = val, extra = val } )

ttList

This function creates a list of tooltippable items

Parameter Description Required Default
1 Table of arrays (listTable)
  • If the array key matches a function, array elements are passed one by one to that function as the first table argument.
  • Otherwise, array elements are returned
required none
multiKey Text header for arrays with multiple items optional Any of:
index Tooltip level, disables tooltipping by default optional 4
listStyle Sets styling of list
  • inline: uses <br> tags between each line, for use in tooltips
  • newline: uses indent and newlines for a proper list, for use in tables
optional inline
indent Sets list level and type for newline optional *

Numbered parameters must be passed in order, named parameters must be passed as a table following; i.e. ttList( 1, { multiKey = val, index = val, listStyle = val, indent = val } )

effectList

This function creates a list of modifier effects

Parameter Description Required Default
1 Table of arrays or 'pseudo'-arrays (list) required none
color Passes table of named arguments for Module:Color optional none
listStyle Sets styling of list
  • inline: uses <br> tags between each line, for use in tooltips
  • newline: uses indent and newlines for a proper list, for use in tables
optional inline
indent Sets list level and type for newline optional *
icon Sets an {{Iconify}} icon "group" for each effect
  • Only usable if all effects have the same icon group
optional none
page Sets a page link for alternate linking with icon optional icon

The array elements must be formatted as in the table below. Color values can be any that are valid for Module:Color. If using an array, the third argument can be a table of parameters for Module:Iconify as well, which then uses the color and value as a mod parameter.

Numbered parameters must be passed in order, named parameters must be passed as a table following; i.e. effectList( 1, { color = val, listStyle = val, indent = val, icon = val, page = val } )

Valid effect formats:
No icon/prefix With icon/prefix
"<color>_<value>_<text>" "<color>_<value>_<text>_<prefix>"
{ "<color>", "<value>", "<text>" } { "<color>", "<value>", "<text>", "<prefix>"/icon = "<prefix>" }
{ "<color>", "<value>", { icon="<text>", <other iconify parameters as needed> } }
"<text>"
{ "<text>" }