Bureaucrats, emailconfirmed, Interface administrators, staff, Administrators, translation-admin, translator, Widget editors
154
edits
(Grids) |
No edit summary |
||
Line 23: | Line 23: | ||
end | end | ||
function UISlot.Call( | function UISlot.Call(items, width, height, size) | ||
local w = | local w = width or 1 | ||
local h = | local h = height or 1 | ||
local grid = {} | local grid = {} | ||
local large = size | |||
if size == nil then | |||
size = w == 1 and h == 1 | |||
end | |||
for i = 1,h do | for i = 1,h do | ||
grid[i] = {} | grid[i] = {} | ||
for j = 1,w do | for j = 1,w do | ||
grid[i][j] = | grid[i][j] = items[j+(i-1)*w] | ||
end | end | ||
end | end | ||
return UISlot.Grid(grid) | return UISlot.Grid(grid, large) | ||
end | end | ||
function UISlot.Grid(items) | function UISlot.Grid(items, large) | ||
local root = mw.html.create( "table" ):addClass("invgrid") | local root = mw.html.create( "table" ):addClass("invgrid") | ||
for i = 1, #items do | for i = 1, #items do | ||
local row = root:tag("tr"):addClass("invrow") | local row = root:tag("tr"):addClass("invrow") | ||
for j = 1, #items[i] do | for j = 1, #items[i] do | ||
UISlot.Item(items[i][j], | UISlot.Item(items[i][j], large, row) | ||
end | end | ||
end | end |
edits