Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Clade/labels
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 args =frame:getParent().args -- get parent arguments --local args = {} p.getArgs = function(frame) --return frame.args -- use frame arguments return frame:getParent().args -- use parent arguments end p.main = function(frame) args = p.getArgs(frame) local i = 1 -- index for labels local output = "" --[[local groupStyle = args['style'] local topStyle = args['top'] local leftStyle = args['left'] local rightStyle = args['right'] local bottomStyle = args['bottom'] ]] -- parameters for all labels local width = args['width'] -- or "5em;" --local style = args['style'] or "" --local color = args['width'] or "" local longestString = 0 while args['label'..i] do local label = args['label'..i] or "" if #label > longestString then longestString = #label end local style = args['style'..i] or args['style'] or "" local color = args['color'..i] or args['color'] or "" local top = args['top'..i] or args['top'] or "" local left = args['left'..i] or args['left'] or "" local right = args['right'..i] or args['right'] or "" local bottom = args['bottom'..i] or args['bottom'] or "" if top ~= "" then top = 'top:' .. top .. ';' end if left ~= "" then left = 'left:' .. left .. ';' end if right ~= "" then right = 'right:' .. right .. ';' end if bottom ~= "" then bottom = 'bottom:' .. bottom .. ';' end if color ~= "" then color = 'color:' .. color .. ';' end --if no color:find(";", -1, true) then color = color .. ';' end --local position = top .. left .. right .. bottom output = output .. '<div style="position:absolute;white-space:nowrap;' .. style .. color -- CSS styling .. top .. left .. right .. bottom .. '">' -- position of label .. label -- content of label .. '</div>' i=i+1 end if output ~= "" then local styleStr = "" --widthStr = 'width:' .. (longestString*0.5)..'em;' -- can't take account of formatting or <br/> if width then styleStr = 'style="width:' .. width .. '"' end output = '<div ' .. styleStr ..'>' .. output .. '</div>' end return output end p.label = function(frame) args = p.getArgs(frame) local i = 1 -- index for labels local output = "" local label = args['label'..i] or args['label'] or args[1] or "" local width = args['width'] local style = args['style'..i] or args['style'] or "" local color = args['color'..i] or args['color'] or "" local top = args['top'..i] or args['top'] or "" local left = args['left'..i] or args['left'] or "" local right = args['right'..i] or args['right'] or "0px" local bottom = args['bottom'..i] or args['bottom'] or "" if top ~= "" then top = 'top:' .. top .. ';' end if left ~= "" then left = 'left:' .. left .. ';' end if right ~= "" then right = 'right:' .. right .. ';' end if bottom ~= "" then bottom = 'bottom:' .. bottom .. ';' end if color ~= "" then color = 'color:' .. color .. ';' end output = output .. '<div style="position:absolute;white-space:nowrap;' .. style .. color -- CSS styling .. top .. left .. right .. bottom .. '">' -- position of label .. label -- content of label .. '</div>' if output ~= "" then local widthStr = '' if width then widthStr = 'width:' .. width .. ';' end output = '<div style="position:relative;' .. widthStr .. '">' .. output .. '<br/></div>' end return output end return p
Summary:
Please note that all contributions to Stockhub 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
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Clade/labels/doc
(
edit
)