FANDOM


-- <pre>
local Userbox = {}
Userbox.__index = Userbox
Userbox.__tostring = Userbox.tostring
 
function Userbox.new()
	local obj = setmetatable({
				leftslot = '?',
				leftbg = '#FFFFFF',
				leftcolor = '#000000',
				leftsize = '14pt',
				rightslot = 'This is a custom userbox! (with default text!)',
				rightbg = '#ADADAD',
				rightcolor = '#4343FA',
				rightsize = '10pt',
				bordercolor = '#8A1234',
				bordersize = '2px',
				borderstyle = 'solid'
				},
			Userbox)
	return obj
end
 
--[[
  -- Attribute setting
--]]
function Userbox.setLeft(u, arg)
	u.leftslot = arg
	return u
end
 
function Userbox.setLeftBG(u, arg)
	u.leftbg = arg
	return u
end
 
function Userbox.setLeftColor(u, arg)
	u.leftcolor = arg
	return u
end
 
function Userbox.setLeftFontSize(u, arg)
	u.leftsize = arg
	return u
end
 
function Userbox.setRight(u, arg)
	u.rightslot = arg
	return u
end
 
function Userbox.setRightBG(u, arg)
	u.rightbg = arg
	return u
end
 
function Userbox.setRightColor(u, arg)
	u.rightcolor = arg
	return u
end
 
function Userbox.setRightFontSize(u, arg)
	u.rightsize = arg
	return u
end
 
function Userbox.setBorderColor(u, arg)
	u.bordercolor = arg
	return u
end
 
function Userbox.setBorderSize(u, arg)
	u.bordersize = arg
	return u
end
 
function Userbox.setBorderStyle(u, arg)
	u.borderstyle = arg
	return u
end
 
-- Creation
function Userbox.tostring(u)
	local ret = mw.html.create('table')
			:addClass('userbox')
			:css({ float = 'left',
				border = string.format('%s %s %s',u.bordersize,u.borderstyle,u.bordercolor),
				margin = '0px',
				background = u.rightbg,
				width = '240px' })
			:tag('tr')
				:tag('td')
					:css({ width = '45px',
						height = '45px',
						['line-height'] = '1.25em',
						color = u.leftcolor,
						['font-size'] = u.leftsize,
						background = u.leftbg,
						['vertical-align'] = 'middle',
						['text-align'] = 'center' })
					:wikitext(u.leftslot)
				:done()
				:tag('td')
					:css({ height = '45px',
						['line-height'] = '1.25em',
						color = u.rightcolor,
						['font-size'] = u.rightsize,
						background = u.rightbg,
						padding = '0 4px',
						['vertical-align'] = 'middle' })
					:wikitext(u.rightslot)
				:done()
			:done()
	return tostring(ret)
end
 
return Userbox

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.