2,509
个编辑
小 (ulk测试) |
小 (调整) |
||
第60行: | 第60行: | ||
for _, cond in ipairs(chartUlk.conditions) do | for _, cond in ipairs(chartUlk.conditions) do | ||
local className | local className | ||
if cond.type == 0 then | if cond.type == 0 or cond.type == 5 then | ||
className = ' | className = 'frag' | ||
elseif cond.type <= 100 | elseif cond.type <= 100 then | ||
className = ' | className = 'prev' | ||
end | end | ||
if className then | if className then | ||
local row = view[id] | local row = view[id] | ||
if not row then | if not row then | ||
row = {} | row = {frag = 0, prev = 0} | ||
view[id] = row | view[id] = row | ||
end | end | ||
row[className] = row[className] + 1 | |||
local cell = row[rc] | local cell = row[rc] | ||
if not cell then | if not cell then | ||
第76行: | 第77行: | ||
row[rc] = cell | row[rc] = cell | ||
end | end | ||
table.insert(cell, mw.html.create 'span':addClass(className):wikitext(stringify(cond))) | table.insert(cell, tostring(mw.html.create 'span':addClass('ulk-' .. className):wikitext(stringify(cond)))) | ||
end | end | ||
end | end | ||
第82行: | 第83行: | ||
local texts = {} | local texts = {} | ||
local rowFormat = '|-\n|[[%s]]' .. ('||%s'):rep(3) | local rowFormat = '|-%s\n|[[%s]]' .. ('||%s'):rep(3) | ||
local sectionCode = {unknown = 0, single = 1, free = 2, mainstory = 3, sidestory = 4, collab = 5} | local sectionCode = {unknown = 0, single = 1, free = 2, mainstory = 3, sidestory = 4, collab = 5} | ||
for id, row in pairs(view) do | for id, row in pairs(view) do | ||
第93行: | 第94行: | ||
rowText[i] = ' ' | rowText[i] = ' ' | ||
else | else | ||
rowText[i] = | rowText[i] = table.concat(cell, '<br/>') | ||
end | end | ||
end | end | ||
local tot = row.frag + row.prev | |||
local className | |||
if row.frag == tot then | |||
className = 'frag' | |||
elseif row.prev == tot then | |||
className = 'prev' | |||
end | |||
className = className and ('class="ulk-%s"'):format(className) or '' | |||
if id == 'lasteternity' then className = 'class="ulk-frag ulk-prev"' end | |||
table.insert(texts, { | table.insert(texts, { | ||
data = rowFormat:format(mLink[id], unpack(rowText)), | data = rowFormat:format(className, mLink[id], unpack(rowText)), | ||
pack = packItem['name'], | pack = packItem['name'], | ||
sort = {sectionCode[packItem['section']], packItem['numero'], song.date}, | sort = {sectionCode[packItem['section']], packItem['numero'], song.date}, |
个编辑