370
次編輯
無編輯摘要 |
(更换样式) |
||
第3行: | 第3行: | ||
local songlistAppend = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{ title = 'Songlist append.json' }) | local songlistAppend = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{ title = 'Songlist append.json' }) | ||
local trans = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{ title = 'Template:Transition.json' }) | local trans = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{ title = 'Template:Transition.json' }) | ||
function getInfList() | function getInfList() | ||
第13行: | 第11行: | ||
for _,songInf in ipairs(songlistAppend["songs"]) | for _,songInf in ipairs(songlistAppend["songs"]) | ||
do | do | ||
table.insert(songlistE,{ | |||
songInf["id"], | |||
songInf["title_localized"]["default"], | |||
songInf["difficulties"][1]["ratingReal"], | |||
songInf["difficulties"][2]["ratingReal"], | |||
songInf["difficulties"][3]["ratingReal"], | |||
songInf["difficulties"][4]["ratingReal"] | |||
}) | |||
appendList[songInf["id"]] = true | appendList[songInf["id"]] = true | ||
end | end | ||
第37行: | 第27行: | ||
if songInf["difficulties"] and not(appendList[songInf["id"]]) | if songInf["difficulties"] and not(appendList[songInf["id"]]) | ||
then | then | ||
table.insert(songlistE,{ | |||
songInf["id"], | |||
songInf["title_localized"]["default"], | |||
songInf["difficulties"][1]["ratingReal"], | |||
songInf["difficulties"][2]["ratingReal"], | |||
songInf["difficulties"][3]["ratingReal"], | |||
songInf["difficulties"][4]["ratingReal"] | |||
}) | |||
end | end | ||
end | end | ||
第58行: | 第40行: | ||
end | end | ||
function p.main() | |||
function p.main( | |||
local inf = getInfList() | local inf = getInfList() | ||
table.sort(inf, function(a, b) return a[ | table.sort(inf, function(a, b) return a[6] > b[6] end) | ||
local outputTable = mw.html.create("table"):addClass("rotable") | local outputTable = mw.html.create("table"):addClass("rotable"):addClass("sortable") | ||
outputTable:tag("tr"):tag("th"):wikitext("曲绘"):tag("th"):wikitext("曲目") | outputTable:tag("tr"):tag("th"):wikitext("曲绘"):tag("th"):wikitext("曲目") | ||
:tag("th"):wikitext(" | :tag("th"):wikitext(" 难度I"):tag("th"):wikitext(" 难度II") | ||
:tag("th"):wikitext("难 | :tag("th"):wikitext("难 度III"):tag("th"):wikitext("定 数IV") | ||
for _,inf in ipairs(inf) | for _,inf in ipairs(inf) | ||
do | do | ||
outputTable:tag("tr"):tag("td"):wikitext("[[File:Songs "..inf[1]..".png| | outputTable:tag("tr"):tag("td"):wikitext("[[File:Songs "..inf[1]..".png|40px]]") | ||
:tag("td"):wikitext(inf[2]) | :tag("td"):wikitext(inf[2]) | ||
:tag("td"):wikitext(inf[3]):tag("td"):wikitext(inf[4]) | |||
:tag("td"):wikitext(inf[5]):tag("td"):wikitext(inf[6]) | :tag("td"):wikitext(inf[5]):tag("td"):wikitext(inf[6]) | ||
end | end | ||