Home
Random
Log in
Settings
About OtherX
Disclaimers
Search
Editing
Module:Tooltip
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} local yn = require('Module:Yesno') local hc = require('Module:Paramtest').has_content -- module access point for div p._div = function(args) local name = args.name if not hc(name) then error('Name is required!') end local content = args.content local hasarrow = yn(args.arrow or 'yes', true) local arrowsize = tonumber(args.arrowsize) or 10 local limitwidthbool = yn(args.limitwidth or 'yes', true) local style = args.style local div = mw.html.create('div') local arrow = 'no' if hasarrow then arrow = 'yes' end local limitwidth = 'no' if limitwidthbool then limitwidth = 'yes' end local attrs = { ['data-tooltip-for'] = name, ['data-tooltip-arrow'] = arrow, ['data-tooltip-arrow-size'] = arrowsize, ['data-tooltip-limit-width'] = limitwidth, } if hc(style) then attrs['data-tooltip-style'] = style end div :addClass('hidden js-tooltip-wrapper') :css('display', 'none') :attr(attrs) :tag('div') :addClass('js-tooltip-text') :wikitext(content) :done() :done() return div end p._span = function(args) local name = args.name or args[1] or nil if not hc(name) then error('Name is required!') end local alt = args.alt or args[2] or '?' local span = mw.html.create('span') span:addClass('hidden js-tooltip-click') :css('display', 'none') :attr('data-tooltip-name', name) :wikitext(alt) :done() return span end -- template access points p.div = function(frame) return p._div(frame:getParent().args) end p.span = function(frame) return p._span(frame:getParent().args) end return p
Summary:
Please note that all contributions to OtherX may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
OtherX:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:DependencyList
(
edit
)
Template:Documentation
(
edit
)
Template:No documentation
(
edit
)
Template:PageType
(
edit
)
Module:Array
(
edit
)
Module:DPLlua
(
edit
)
Module:DependencyList
(
edit
)
Module:Documentation
(
edit
)
Module:Paramtest
(
edit
)
Module:Tooltip
(
edit
)
Module:Tooltip/doc
(
edit
)
Module:Yesno
(
edit
)
This page is a member of a hidden category:
Category:Pages with broken file links