跳到内容

Module:Songtable:修订间差异

添加2,323字节 、​ 2021年7月20日 (星期二)
曲目信息模板 v2.3 【自动分类/提示信息框/代码优化/启用部分自动填充】
无编辑摘要
(曲目信息模板 v2.3 【自动分类/提示信息框/代码优化/启用部分自动填充】)
第37行: 第37行:
    if aKey then return a end
    if aKey then return a end
    if bKey then return b end
    if bKey then return b end
   return nil
end
end


第60行: 第61行:
function getImage(id, all, pst, prs, ftr, byd, second, normalJacketArgs, bydJacketArgs, normalJacketData, bydJacketData, bydyes, type)
function getImage(id, all, pst, prs, ftr, byd, second, normalJacketArgs, bydJacketArgs, normalJacketData, bydJacketData, bydyes, type)
    --谢邀,这写的什么东西我自己都看不懂了
    --谢邀,这写的什么东西我自己都看不懂了
   if not(id or all) then return nil end
    local container, tab = mw.html.create('div'), mw.html.create('div')
    local container, tab = mw.html.create('div'), mw.html.create('div')
    local tab1, tab2, tab3, part1, part2, part3, jacket1, jacket2
    local tab1, tab2, tab3, part1, part2, part3, jacket1, jacket2
第178行: 第181行:


    return merge
    return merge
end
function re0()
   return nil
end
end


第217行: 第216行:
              chartDesigner[i] = chartDesigner[i - 1]
              chartDesigner[i] = chartDesigner[i - 1]
            else
            else
              chartDesigner[i] = link({'谱师', tostring(data(k[4]))})
              chartDesigner[i] = choice(link({'谱师', tostring(data(k[4]))}), data(k[4]), '', true)
            end
            end
          end
          end
        end
        end
   end
   local span
   if byd then
     span = merge({chartDesigner[1], chartDesigner[2], chartDesigner[3], chartDesigner[4]})
   else
     span = merge({chartDesigner[1], chartDesigner[2], chartDesigner[3]})
   end
   -- if args['曲名'] == 'Tempestissimo' then spanNs = {'grid-column-start: span 1', 'grid-column-start: span 1', 'grid-column-start: span 1', 'grid-column-start: span 1'} end
   local imageA = getImage(data('id'), args['图片'], args['Past曲绘'], args['Present曲绘'], args['Future曲绘'], args['Beyond曲绘'], args['第二曲绘图片'], args['画师'], args['Beyond画师'], data('ftrJacketDesigner'), data('bydJacketDesigner'), byd, 'a')
   local imageB = getImage(data('id'), args['图片'], args['Past曲绘'], args['Present曲绘'], args['Future曲绘'], args['Beyond曲绘'], args['第二曲绘图片'], args['画师'], args['Beyond画师'], data('ftrJacketDesigner'), data('bydJacketDesigner'), byd, 'b')
   local infoList = {
     [1] = {
       choice(args['曲名'] or data('title') or dataNs('title'), data('id') or #args > 1, (args['曲名'] or data('title') or dataNs('title')) .. "<br>''此曲目暂未登录''", true),
     {id = 'title'}},
     [2] = {
       imageA or choice('[[文件:Songs '..tostring(data('id')) .. '.jpg|点此上传图片]]', data('id'), '[[文件:Songs '..tostring(dataNs('id')) .. '.jpg|点此上传图片]]', dataNs('id')),
     {id = 'top-image'}},
     [3] = {
       imageB or choice('[[文件:Songs '..tostring(data('id')) .. '.jpg|点此上传图片]]', data('id'), '[[文件:Songs '..tostring(dataNs('id')) .. '.jpg|点此上传图片]]', dataNs('id')),
     {id = 'right-image'}},
     [4] = {
       '曲目信息',
     {class = 'header'}},
     [5] = {
       '曲师',
     {class = 'label'}},
     [6] = {
       args['编曲'] or choice(link({'曲师', tostring(data('artist'))}) or link({'曲师', tostring(dataNs('artist'))}), data('artist') or dataNs('artist'), '', true),
     {class = 'data'}},
     [7] = {
       '曲包',
     {class = 'label'}},
     [8] = {
       args['曲包'] or choice(getData.pack({data('set')}), data('set'), getData.pack({dataNs('set')}), dataNs('set')),
     {class = 'data'}},
     [9] = {
       '时长',
     {class = 'label'}},
     [10] = {
       args['时长'] or '空',
     {class = 'data'}},
     [11] = {
       'BPM',
     {class = 'label'}},
     [12] = {
       args['BPM'] or data('bpm') or dataNs('bpm'),
     {class = 'data'}},
     [13] = {
       '谱面信息',
     {class = 'header'}},
     [14] = {
       '难度',
     {class = 'label'}},
     [15] = {
       '[Past]',
     {class = 'pst-label'}},
     [16] = {
       '[Present]',
     {class = 'prs-label'}},
     [17] = {
       '[Future]',
     {class = 'ftr-label'}},
     [18] = {
       bydMark(byd, args['曲名']),
     {class = 'byd-label'}},
     [19] = {
       '等级',
     {class = 'label'}},
     [20] = {
       args['Past等级'] or data('pstRating'),
     {class = 'pst-data'}},
     [21] = {
       args['Present等级'] or data('prsRating'),
     {class = 'prs-data'}},
     [22] = {
       args['Future等级'] or data('ftrRating'),
     {class = 'ftr-data'}},
     [23] = {
       args['Beyond等级'] or data('bydRating'),
     {class = 'byd-data'}},
     [24] = {
       'note数量',
     {class = 'label'}},
     [25] = {
       args['PastNote'] or '空',
     {class = 'pst-data'}},
     [26] = {
       args['PresentNote'] or '空',
     {class = 'prs-data'}},
     [27] = {
     args['FutureNote'] or '空', {class = 'ftr-data'}},
     [28] = {
       args['BeyondNote'] or '空',
     {class = 'byd-data'}},
     [29] = {
       '谱面设计',
     {class = 'label'}},
     [30] = {
       chartDesigner[1] or '空',
     {class = 'pst-data'}, span[1]},
     [31] = {
       chartDesigner[2] or '空',
     {class = 'prs-data'}, span[2]},
     [32] = {
       chartDesigner[3] or '空',
     {class = 'ftr-data'}, span[3]},
     [33] = {
       chartDesigner[4] or '空',
     {class = 'byd-data'}, span[4]},
     [34] = {
       '谱面信息(Joy-Con)',
     {class = 'header ns', id = 'ns-play-header'}},
     [35] = {
       '难度',
     {class = 'label ns'}},
     [36] = {
       '[Past]',
     {class = 'pst-label ns'}},
     [37] = {
       '[Present]',
     {class = 'prs-label ns'}},
     [38] = {
       '[Future]',
     {class = 'ftr-label ns'}},
     [39] = {
       bydMark(byd, args['曲名']),
     {class = 'byd-label ns'}},
     [40] = {
       'note数量',
     {class = 'label ns'}},
     [41] = {
       args['PastNoteNS'] or args['PastNote'],
     {class = 'pst-data ns'}},
     [42] = {
       args['PresentNoteNS'] or args['PresentNote'],
     {class = 'prs-data ns'}},
     [43] = {
       args['FutureNoteNS'] or args['FutureNote'],
     {class = 'ftr-data ns'}},
     [44] = {
       args['BeyondNoteNS'] or '空',
     {class = 'byd-data ns'}},
     [45] = {
       '背景',
     {class = 'label'}},
     [46] = {
       bgCov(args['背景']) or bgCov(data('bg')) or bgCov(dataNs('bg')),
     {class = 'data'}},
     [47] = {
       '更新时间',
     {id = 'update-data-label', class = 'label'}},
     [48] = {
       dateCov(args['更新版本'], args['更新时间'], labelText('移动版'), 'arg') or dateCov(data('version'), tonumber(data('date')), labelText('移动版'), 'data'),
     {id = 'mobile-date-normal', class = 'data'}},
     [49] = {
       dateCov(args['Beyond更新版本'], args['Beyond更新时间'], labelText('移动版'), 'arg') or '空',
     {id = 'mobile-date-byd', class = 'data'}},
     [50] = {
       dateCov(args['更新版本NS'], args['更新时间NS'], labelText('NS版'), 'arg') or dateCov(dataNs('version'), tonumber(dataNs('date')), labelText('NS版'), 'data'),
     {id = 'ns-date-normal', class = 'data ns'}},
     [51] = {
       '空',
     {id = 'ns-date-byd', class = 'data ns'}}}
   local box = mw.html.create('div')
   --样式控制
   box:addClass("songbox")
   if byd then box:addClass("byd") end
   if dataNs('side') == 1 or args['侧'] == '1' then box:addClass("conflict") else box:addClass("light") end
   if args['更新版本NS'] or dataNs('id')
     then
     box:addClass("ns-box")
     if not(dataNs('pstChange') or dataNs('prsChange') or dataNs('ftrChange')) --(or byd) -- bdy单独分栏禁用
       then
       box:addClass("ns-same")
      end
      end
   end
   if args['Beyond更新版本'] and args['Beyond更新时间'] then box:addClass('mobile-byd-date') end
   if args['曲名'] == 'Tempestissimo' then box:addClass('ns-byd-date') box:addClass('ns-date-span') end
   if not(args['更新版本'] or args['更新时间'] or data('id')) then box:addClass('no-mobile') end
   --分类添加
   local category = ''


      local span
   if args['更新版本NS'] or dataNs('id')
      if byd then
      then
        span = merge({chartDesigner[1], chartDesigner[2], chartDesigner[3], chartDesigner[4]})
      if args['更新版本'] or args['更新时间'] or data('id')
       then
        category = category..'[[ 分类:双平台曲目]]'
      else
      else
        span = merge({chartDesigner[1], chartDesigner[2], chartDesigner[3]})
        category = category..'[[ 分类:NS版曲目]]'
      end
      end
   else
     category = category..'[[分类:移动版曲目]]'
   end
   if dataNs('pstChange') or dataNs('prsChange') or dataNs('ftrChange') then category = category..'[[分类:多模式谱面有差异的曲目]]' end
   category = category..'[[分类:'..infoList[8][1] .. '曲包曲目]]'
   if dataNs('side') == 1 or args['侧'] == '1'
     then
     category = category..'[[分类:纷争侧曲目]]'
   else
     category = category..'[[分类:光芒侧曲目]]'
   end
   category = category..'[[分类:PST'..infoList[20][1] .. '级曲目]]'
   category = category..'[[分类:PRS'..infoList[21][1] .. '级曲目]]'
   category = category..'[[分类:FTR'..infoList[22][1] .. '级曲目]]'
   if byd then category = category..'[[分类:BYD'..infoList[23][1] .. '级曲目]]' end
   category = category..'[[分类:采用'..infoList[46][1] .. '背景的曲目]]'
   if args['曲目版本'] then category = category..'[[分类:'..args['曲目版本']:gusb('v', 'V') .. '添加的曲目]]' end
   if args['曲目版本NS'] then category = category..'[[分类:NS '..args['曲目版本NS']:gusb('v', 'V') .. '添加的曲目]]' end
   --表格生成
   local boxList = {}
   for i, o in ipairs(infoList) do
     boxList[i] = mw.html.create('div')
     boxList[i]
     :attr(infoList[i][2])
     :cssText(infoList[i][3])
     :wikitext(infoList[i][1])
     box:wikitext(tostring(boxList[i]))
   end


     -- if args['曲名'] == 'Tempestissimo' then spanNs = {'grid-column-start: span 1', 'grid-column-start: span 1', 'grid-column-start: span 1', 'grid-column-start: span 1'} end
   -- 提示信息
   local noticeText = ''


     local imageA = getImage(data('id'), args['图片'], args['Past曲绘'], args['Present曲绘'], args['Future曲绘'], args['Beyond曲绘'], args['第二曲绘图片'], args['画师'], args['Beyond画师'], data('ftrJacketDesigner'), data('bydJacketDesigner'), byd, 'a')
   if not(data('id') or dataNs('id'))
      local imageB = getImage(data('id'), args['图片'], args['Past 绘'], args['Present曲绘'], args['Future曲绘'], args['Beyond曲绘'], args['第二 绘图片'], args['画师'], args['Beyond画师'], data('ftrJacketDesigner'), data('bydJacketDesigner'), byd, 'b')
      then
     noticeText = noticeText..'<li>在Songlist中无法检查到此 目。请尝试更新[[ 模板:Songlist]] ,检查页面名或填写正确的<code> 名</code>参数。</li>'
   end


     local infoList = {
   local noticeTextNote = ''
       [1] = {
         args['曲名'] or data('title') or dataNs('title'),
       {id = 'title'}},
       [2] = {
         imageA or choice('[[文件:Songs '..data('id') .. '.jpg|点此上传图片]]', data('id'), '[[文件:Songs '..dataNs('id') .. '.jpg|点此上传图片]]', dataNs('id')),
       {id = 'top-image'}},
       [3] = {
         imageB or choice('[[文件:Songs '..data('id') .. '.jpg|点此上传图片]]', data('id'), '[[文件:Songs '..dataNs('id') .. '.jpg|点此上传图片]]', dataNs('id')),
       {id = 'right-image'}},
       [4] = {
         '曲目信息',
       {class = 'header'}},
       [5] = {
         '曲师',
       {class = 'label'}},
       [6] = {
         args['编曲'] or link({'曲师', tostring(data('artist'))}) or link({'曲师', tostring(dataNs('artist'))}),
       {class = 'data'}},
       [7] = {
         '曲包',
       {class = 'label'}},
       [8] = {
         args['曲包'] or getData.pack({data('set')}),
       {class = 'data'}},
       [9] = {
         '时长',
       {class = 'label'}},
       [10] = {
         args['时长'] or '空',
       {class = 'data'}},
       [11] = {
         'BPM',
       {class = 'label'}},
       [12] = {
         args['BPM'] or data('bpm') or dataNs('bpm'),
       {class = 'data'}},
       [13] = {
         '谱面信息',
       {class = 'header'}},
       [14] = {
         '难度',
       {class = 'label'}},
       [15] = {
         '[Past]',
       {class = 'pst-label'}},
       [16] = {
         '[Present]',
       {class = 'prs-label'}},
       [17] = {
         '[Future]',
       {class = 'ftr-label'}},
       [18] = {
         bydMark(byd, args['曲名']),
       {class = 'byd-label'}},
       [19] = {
         '等级',
       {class = 'label'}},
       [20] = {
         args['Past等级'] or data('pstRating'),
       {class = 'pst-data'}},
       [21] = {
         args['Present等级'] or data('prsRating'),
       {class = 'prs-data'}},
       [22] = {
         args['Future等级'] or data('ftrRating'),
       {class = 'ftr-data'}},
       [23] = {
         args['Beyond等级'] or data('bydRating'),
       {class = 'byd-data'}},
       [24] = {
         'note数量',
       {class = 'label'}},
       [25] = {
         args['PastNote'] or '空',
       {class = 'pst-data'}},
       [26] = {
         args['PresentNote'] or '空',
       {class = 'prs-data'}},
       [27] = {
       args['FutureNote'] or '空', {class = 'ftr-data'}},
       [28] = {
         args['BeyondNote'] or '空',
       {class = 'byd-data'}},
       [29] = {
         '谱面设计',
       {class = 'label'}},
       [30] = {
         chartDesigner[1] or '空',
       {class = 'pst-data'}, span[1]},
       [31] = {
         chartDesigner[2] or '空',
       {class = 'prs-data'}, span[2]},
       [32] = {
         chartDesigner[3] or '空',
       {class = 'ftr-data'}, span[3]},
       [33] = {
         chartDesigner[4] or '空',
       {class = 'byd-data'}, span[4]},
       [34] = {
         '谱面信息(Joy-Con)',
       {class = 'header ns', id = 'ns-play-header'}},
       [35] = {
         '难度',
       {class = 'label ns'}},
       [36] = {
         '[Past]',
       {class = 'pst-label ns'}},
       [37] = {
         '[Present]',
       {class = 'prs-label ns'}},
       [38] = {
         '[Future]',
       {class = 'ftr-label ns'}},
       [39] = {
         bydMark(byd, args['曲名']),
       {class = 'byd-label ns'}},
       [40] = {
         'note数量',
       {class = 'label ns'}},
       [41] = {
         args['PastNoteNS'] or args['PastNote'],
       {class = 'pst-data ns'}},
       [42] = {
         args['PresentNoteNS'] or args['PresentNote'],
       {class = 'prs-data ns'}},
       [43] = {
         args['FutureNoteNS'] or args['FutureNote'],
       {class = 'ftr-data ns'}},
       [44] = {
         args['BeyondNoteNS'] or '无',
       {class = 'byd-data ns'}},
       [45] = {
         '背景',
       {class = 'label'}},
       [46] = {
         bgCov(args['背景']) or bgCov(data('bg')) or bgCov(dataNs('bg')),
       {class = 'data'}},
       [47] = {
         '更新时间',
       {id = 'update-data-label', class = 'label'}},
       [48] = {
         dateCov(args['更新版本'], args['更新时间'], labelText('移动版'), 'arg') or dateCov(data('version'), tonumber(data('date')), labelText('移动版'), 'data'),
       {id = 'mobile-date-normal', class = 'data'}},
       [49] = {
         dateCov(args['Beyond更新版本'], args['Beyond更新时间'], labelText('移动版'), 'arg') or '无',
       {id = 'mobile-date-byd', class = 'data'}},
       [50] = {
         dateCov(args['更新版本NS'], args['更新时间NS'], labelText('NS版'), 'arg') or '无',
       {id = 'ns-date-normal', class = 'data ns'}},
       [51] = {
         '无',
       {id = 'ns-date-byd', class = 'data ns'}}}


       local box = mw.html.create('div')
   if not(args['PastNote']) then noticeTextNote = noticeTextNote..'<code>PastNote</code>' end
   if not(args['PresentNote']) then noticeTextNote = noticeTextNote..'<code>PresentNote</code>' end
   if not(args['FutureNote']) then noticeTextNote = noticeTextNote..'<code>FutureNote</code>' end


       --样式控制
   if noticeTextNote ~= ''
       box:addClass("songbox")
     then
       if byd then box:addClass("byd") end
     noticeText = noticeText..'<li>此模板缺少'..noticeTextNote..' 参数,此参数无法自动读取。</li>'
       if dataNs('side') == 1 or args[' 侧'] == '1' then box:addClass("conflict") else box:addClass("light") end
   end
       if args[' 更新版本NS'] or dataNs('id')
 
         then
   if not(args['时 '])
         box:addClass("ns-box")
     then
         if not(dataNs('pstChange') or dataNs('prsChange') or dataNs('ftrChange')) --(or byd) -- bdy单独分栏禁用
     noticeText = noticeText..'<li>此模板缺少<code> 长</code>参数,此参数无法自动读取。</li>'
           then
   end
           box:addClass("ns-same")
         end
       end
       if args['Beyond更新版本'] and args['Beyond更新 '] then box:addClass('mobile-byd-date') end
       if args['曲名'] == 'Tempestissimo' then box:addClass('ns-byd-date') box:addClass('ns-date-span') end
       if not(args[' 更新版本'] or args['更新 '] or data('id')) then box:addClass('no-mobile') end


       --分类添加
   if not(args['更新版本'])
       local category = ''
     then
     noticeText = noticeText..'<li>此模板的移动版更新版本是未完整状态。请添加<code>更新版本</code>与<code>更新时间</code>参数。</li>'
   end


       if args['更新版本NS'] or dataNs('id')
   if not(args['更新版本NS'])
         then
     then
         if args['更新版本'] or args[' 更新时 间'] or data('id')
     noticeText = noticeText..'<li>此模板的NS版 更新版本 是未完整状态。请添加<code>更新版本NS</code>与<code> 更新时 间NS</code>参数。</li>'
           then
   end
           category = category..'[[分类:双平台曲目]]'
         else
           category = category..'[[分类:NS版曲目]]'
         end
       else
         category = category..'[[分类:移动版曲目]]'
       end


       if dataNs('pstChange') or dataNs('prsChange') or dataNs('ftrChange') then category = category..'[[ 分类:多模式谱面有差异的曲目]]' end
   local notice
        if args['nocat'] then category = '' end
   if noticeText ~= ''
     then
     notice = mw.getCurrentFrame():expandTemplate {title = 'Collapse', args = {
       [' 标题'] = ' 曲目信息模板提示信息', ['状态'] = '折叠',
       ['标题文字方向'] = 'center', ['标题颜色'] = '#dddddd',
        [' 内容颜色'] = '#eeeeee', ['内容样式'] = 'width:800px',
     ['style'] = 'display:table;width:200px', ['内容'] = noticeText}}


       --表格生成
     category = category..'[[分类:缺少参数的曲目信息模板]]'
       local boxList = {}
   end


       for i, o in ipairs(infoList) do
   if args['nocat'] then category = '' end
         boxList[i] = mw.html.create('div')
         boxList[i]
         :attr(infoList[i][2])
         :cssText(infoList[i][3])
         :wikitext(infoList[i][1])
         box:wikitext(tostring(boxList[i]))
       end


       return tostring(box)..category
   return tostring(box)..choice(notice, notice, '', true)..category
     end
end


     return p
return p