FANDOM


-- <pre>
local p = {}
 
local green = '3px solid #00FF00'
local black = '3px solid #000000'
local faded = '3px solid #203620'
 
local display = {
	[':'] = {
		{ top = green, right = black, bottom = black, left = black },
		{ top = black, right = black, bottom = green, left = black }
	},
	[' '] = {
		{ top = black, right = black, bottom = black, left = black },
		{ top = black, right = black, bottom = black, left = black }
	},
	[0] = {
		{ top = green, right = green, bottom = faded, left = green },
		{ top = faded, right = green, bottom = green, left = green }
	},
	[1] = {
		{ top = faded, right = green, bottom = faded, left = faded },
		{ top = faded, right = green, bottom = faded, left = faded }
	},
	[2] = {
		{ top = green, right = green, bottom = green, left = faded },
		{ top = faded, right = faded, bottom = green, left = green }
	},
	[3] = {
		{ top = green, right = green, bottom = faded, left = faded },
		{ top = green, right = green, bottom = green, left = faded }
	},
	[4] = {
		{ top = faded, right = green, bottom = green, left = green },
		{ top = faded, right = green, bottom = faded, left = faded }
	},
	[5] = {
		{ top = green, right = faded, bottom = faded, left = green },
		{ top = green, right = green, bottom = green, left = faded }
	},
	[6] = {
		{ top = green, right = faded, bottom = faded, left = green },
		{ top = green, right = green, bottom = green, left = green }
	},
	[7] = {
		{ top = green, right = green, bottom = faded, left = green },
		{ top = faded, right = green, bottom = faded, left = faded }
	},
	[8] = {
		{ top = green, right = green, bottom = green, left = green },
		{ top = faded, right = green, bottom = green, left = green }
	},
	[9] = {
		{ top = green, right = green, bottom = green, left = green },
		{ top = faded, right = green, bottom = green, left = faded }
	}
}
 
function p.main()
	local time = os.date('*t')
	local h,m,s = time.hour, time.min, time.sec
 
	local h1,h2 = math.floor(h/10),h%10
	local m1,m2 = math.floor(m/10),m%10
	local s1,s2 = math.floor(s/10),s%10
 
	local tbl = { h1, ' ', h2, ' ', ':', ' ', m1, ' ', m2, ' ', ':' , ' ', s1, ' ', s2 }
 
	local size = 20
	local height = tostring(size * 2 + 9)
	local numwidth = tostring(size + 6)
	local colwidth = tostring(3)
	local ret = mw.html.create('table')
				:css({ background = '#000',
					padding = '10px' })
 
	local newrow = ret:tag('tr')
 
	for _, v in ipairs(tbl) do
		local _w
		if tonumber(v) then
			_w = numwidth
		else
			_w = colwidth
		end
		local borders = {}
		for x, y in pairs(display[v][1]) do
			borders['border-'..x] = y
		end
		newrow	:tag('td')
				:css({ width = _w .. 'px',
					height = height .. 'px' })
				:css(borders)
			:done()
	end
 
	newrow:done()
	newrow = ret:tag('tr')
 
	for _, v in ipairs(tbl) do
		local _w
		if tonumber(v) then
			_w = numwidth
		else
			_w = colwidth
		end
		local borders = {}
		for x, y in pairs(display[v][2]) do
			borders['border-'..x] = y
		end
		newrow	:tag('td')
				:css({ width = _w .. 'px',
					height = height .. 'px' })
				:css(borders)
			:done()
	end
 
	ret:allDone()
	return ret
end
 
return p

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.