- Welcome to the Kancolle Wiki!
- If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord
Changes
Jump to navigation
Jump to search
Line 7:
Line 7:
− _columns = {
− "one",
− "two",
− "three",
− "four",
− "five",
− },
− end+
− +
− function CardList:one(row)+
− return self:card(row[1]) +
− end+
− +
− function CardList:two(row)+
− return self:card(row[2])+
− +
− +
− function CardList:three(row)+
− return self:card(row[3])+
− end+
−
− function CardList:four(row)
− return self:card(row[4])
−
−
− function CardList:five(row)
− return self:card(row[5])
Line 65:
Line 51:
− local filled = #row+
− if filled ~= 0 then+
− for i=1, 5 - filled do+
− table.insert(row, false)+
− end+
− table.insert(self._items, row)+
− row = {}+
− for i=1, filled do+
− table.insert(row, false)+
− end+
− end+
+
+
+
+
+
+
Line 86:
Line 78:
− +
+
+
− +
− table.insert(row, false)+
+
+
+
+
+
+
+
Line 108:
Line 109:
− row_values[column] = self[column](self, item)+
− row_values[column].rowspan = 1+
− row_values[column].colspan = 1+
+
+
no edit summary
_header_template = nil,
_header_template = nil,
_cell = [[${values.value}]],
_cell = [[${values.value}]],
}
}
function CardList:create_table_prep()
function CardList:create_table_prep()
self._size = self._args.image_size or self._default_size
self._size = self._args.image_size or self._default_size
self._columns = {}
if self._args.column_count then
if self._args.column_count == "false" then
self._column_count = false
else
self._column_count = tonumber(self._args.column_count)
end
end
end
if self._column_count then
for i=1, self._column_count do
table.insert(self._columns, i)
end
end
end
end
end
for index, item_key in ipairs(self._args) do
for index, item_key in ipairs(self._args) do
if mw.ustring.sub(item_key, 1, 1) == "!" then
if mw.ustring.sub(item_key, 1, 1) == "!" then
if self._column_count then
local filled = #row
if filled ~= 0 then
for i=1, self._column_count - filled do
table.insert(row, false)
end
table.insert(self._items, row)
row = {}
for i=1, filled do
table.insert(row, false)
end
end
end
table.insert(self._items, mw.ustring.sub(item_key, 2))
table.insert(self._items, mw.ustring.sub(item_key, 2))
elseif not self._column_count and item_key == "~" then
table.insert(self._items, row)
row = {}
count = 0
else
else
count = count + 1
count = count + 1
end
end
table.insert(row, item)
table.insert(row, item)
if count % 5 == 0 then
if self._column_count and (count % self._column_count == 0) then
table.insert(self._items, row)
table.insert(self._items, row)
row = {}
row = {}
elseif not self._column_count then
self._max_columns = math.max(self._max_columns or 0, count)
end
end
end
end
end
end
if #row > 0 then
if #row > 0 then
for i=1, 5 - #row do
if self._column_count then
for i=1, self._column_count - #row do
table.insert(row, false)
end
end
end
table.insert(self._items, row)
table.insert(self._items, row)
end
end
if not self._column_count then
for i=1, self._max_columns do
table.insert(self._columns, i)
end
end
end
end
row_values = {}
row_values = {}
for _, column in ipairs(self._columns) do
for _, column in ipairs(self._columns) do
if self._column_count or item[column] then
row_values[column] = self:card(item[column])
row_values[column].rowspan = 1
row_values[column].colspan = 1
end
end
end
end
end