2,525
个编辑
小 (songtable fix) |
小 (换行、残缺) |
||
第11行: | 第11行: | ||
local function vdValidation(v, d) return v and d and {v, d} end | local function vdValidation(v, d) return v and d and {v, d} end | ||
local function labelText(text) return mw.html.create 'span':addClass 'bg-c':wikitext(text) end | local function labelText(text) return mw.html.create 'span':addClass 'bg-c':wikitext(text) end | ||
local br = mw.html.create 'br' | |||
local function dateCov(dateBox, data, plat) | local function dateCov(dateBox, data, plat) | ||
local version, date = unpack(data | if not data then return end | ||
local version, date = unpack(data) | |||
dateBox:tag 'div':node(labelText(plat)):done() | dateBox:tag 'div':node(labelText(plat)):done() | ||
:tag 'div':wikitext(version): | :tag 'div':wikitext(version):node(br):wikitext('(', date, ')'):done() | ||
end | end | ||
local function span(len) if len > 1 then return 'span-' .. len end end | local function span(len) if len > 1 then return 'span-' .. len end end | ||
第136行: | 第138行: | ||
local box = mw.html.create 'div':addClass 'infotable' | local box = mw.html.create 'div':addClass 'infotable' | ||
local header = box:tag 'div':addClass 'header bg-c':wikitext(song.title_localized.en) | local header = box:tag 'div':addClass 'header bg-c':wikitext(song.title_localized.en) | ||
if song.title_localized.ja then header: | if song.title_localized.ja then header:node(br):node 'span':attr {lang = 'ja'}:wikitext(song.title_localized.ja) end | ||
if song.title_localized['zh-Hans'] then header: | if song.title_localized['zh-Hans'] then header:node(br):wikitext(song.title_localized['zh-Hans']) end | ||
box:tag 'div':addClass 'figure':node(args['tab1'] and createContainer(tabCustom(args)) or getImage(args, song)) | box:tag 'div':addClass 'figure':node(args['tab1'] and createContainer(tabCustom(args)) or getImage(args, song)) | ||
--% :create'' | --% :create'' | ||
第150行: | 第152行: | ||
colTags[idx] = diff['@tag'] or ({[0] = 'Past', 'Present', 'Future', 'Beyond', 'Eternal'})[diff.ratingClass] | colTags[idx] = diff['@tag'] or ({[0] = 'Past', 'Present', 'Future', 'Beyond', 'Eternal'})[diff.ratingClass] | ||
end | end | ||
box:addClass('repeat-' .. #colTags) | |||
local artist = args['编曲'] or args['曲师'] or song.artist | local artist = args['编曲'] or args['曲师'] or song.artist | ||
第157行: | 第160行: | ||
if not duration then notice.duration = true end | if not duration then notice.duration = true end | ||
local bpm = args['BPM'] or song.bpm | local bpm = args['BPM'] or song.bpm | ||
main:tag 'div':addClass 'gc-1 bg-c':wikitext '曲目信息' | main:tag 'div':addClass 'gc-1 bg-c f-m':wikitext '曲目信息' | ||
for _, v in ipairs {{'曲师', artist}, {'曲包', set}, {'时长', duration}, {'BPM', bpm},} do | for _, v in ipairs {{'曲师', artist}, {'曲包', set}, {'时长', duration}, {'BPM', bpm},} do | ||
local tag, data = unpack(v) | local tag, data = unpack(v) | ||
第182行: | 第185行: | ||
local class = ({[0] = 'PST', 'PRS', 'FTR', 'BYD', 'ETR'})[diff.ratingClass] | local class = ({[0] = 'PST', 'PRS', 'FTR', 'BYD', 'ETR'})[diff.ratingClass] | ||
local function chartBasic(df, | local function chartBasic(df, vd_, s) | ||
chart['rating' .. s] = args[tag .. '等级' .. s] or (df.rating .. (df.ratingPlus and '+' or '')) | chart['rating' .. s] = args[tag .. '等级' .. s] or (df.rating .. (df.ratingPlus and '+' or '')) | ||
chart['note' .. s] = args[tag .. 'Note' .. s] | chart['note' .. s] = args[tag .. 'Note' .. s] | ||
chart['vdOverride' .. s] = vdValidation(args[tag .. '更新版本' .. s], args[tag .. '更新时间' .. s]) | chart['vdOverride' .. s] = vdValidation(args[tag .. '更新版本' .. s], args[tag .. '更新时间' .. s]) | ||
if df.date and not chart['vdOverride' .. s] then notice.vd = true end | if df.date and not chart['vdOverride' .. s] then notice.vd = true end | ||
chart['vdOverride' .. s] = chart['vdOverride' .. s] or | chart['vdOverride' .. s] = chart['vdOverride' .. s] or vd_ | ||
end | end | ||
第199行: | 第202行: | ||
if chart.bgOverride then addCategory(bgCatF:format(chart.bgOverride)) end | if chart.bgOverride then addCategory(bgCatF:format(chart.bgOverride)) end | ||
chart.bgOverride = chart.bgOverride or bg | chart.bgOverride = chart.bgOverride or bg | ||
if diff.title_localized then header: | if diff.title_localized then header:node(br):wikitext(diff.title_localized.en, ' ', chart.display) end | ||
local diffNS = sns.difficulties[idx] | local diffNS = sns.difficulties[idx] | ||
if diffNS then | if diffNS then | ||
第210行: | 第213行: | ||
end | end | ||
end | end | ||
main:tag 'div':addClass 'gc-1 bg-c':wikitext '谱面信息' | main:tag 'div':addClass 'gc-1 bg-c f-m':wikitext '谱面信息' | ||
main:tag 'div':addClass 'bg-c':wikitext '难度' | main:tag 'div':addClass 'bg-c':wikitext '难度' | ||
for _, c in ipairs(charts) do | for _, c in ipairs(charts) do | ||
第280行: | 第283行: | ||
end | end | ||
return tostring(box) .. noticeText .. (args['nocat'] and '' or table.concat(category)) | return tostring(box) .. noticeText .. (args['nocat'] and '' or table.concat(category)) | ||
-- .. tostring(mw.html.create 'pre':wikitext(mw.dumpObject(charts))) | |||
end | end | ||
-- p.dateCov = dateCov | |||
function p.main(frame) | function p.main(frame) | ||
local args = getArgs(frame) | local args = getArgs(frame) |
个编辑