查看“模块:VoiceTable”的源代码
←
模块:VoiceTable
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
local p = {} function p.table(frame) local max_pieces = 50 local args = (frame == mw.getCurrentFrame() and frame.args) or frame res_table = {} table.insert(res_table, frame:callParserFunction{name = '#Widget:MiniAudioPlayerJS'}) local playable = ((args["可播放"] or "") ~= "") local title = mw.text.trim(args["表格标题"] or "") local path = mw.text.trim(args["目录"] or "") local lack_file = false local lack_text = false local lack_tran = false local table_class = playable and "wikitable" or "wikitable mw-collapsible mw-collapsed" -- Desktop Table table.insert(res_table, string.format("\n{|class=\"%s %s\" ", table_class, "nomobile")) table.insert(res_table, "style=\"width:835px;max-width:100%;line-height:18px;text-align:center;display:table;white-space:normal;\"\n") if not playable then table.insert(res_table, string.format("|-\n! colspan=\"3\" |'''%s'''", title)) end for i = 1, max_pieces do local piece_title = mw.text.trim(args["标题" .. i] or "") if piece_title ~= "" then local piece_jp = mw.text.trim(args["日文" .. i] or "") local piece_cn = mw.text.trim(args["中文" .. i] or "") local piece_cond = mw.text.trim(args["条件" .. i] or "") local piece_file = mw.text.trim(args["语音" .. i] or "") local piece_lack_file = (piece_file == "") local piece_lack_text = (piece_jp == "" and piece_cn == "") local piece_lack_tran = (piece_jp ~= "" and piece_cn == "") local piece_lack_info = piece_lack_file or piece_lack_text or piece_lack_tran table.insert(res_table, string.format("\n|-\n!style=\"width:120px;%s\"|'''%s'''\n", (piece_lack_info and "color:#A00D00;" or ""), piece_title)) table.insert(res_table, "|style=\"text-align:left;\"|") if playable and piece_jp ~= "" and piece_cn ~= "" then table.insert(res_table, "<p lang=\"ja\" style=\"margin:5px;margin-bottom:10px\">" .. piece_jp .. "</p><p style=\"margin:5px;\">" .. piece_cn) elseif piece_cn ~= "" then table.insert(res_table, "<p style=\"margin:5px;\">" .. piece_cn) else table.insert(res_table, "<p lang=\"ja\" style=\"margin:5px;\">" .. piece_jp) end table.insert(res_table, ((piece_cond ~= "") and string.format("'''(%s)'''</p>", piece_cond) or "</p>")) table.insert(res_table, string.format("\n|style=\"width:%dpx;\"|", playable and 80 or 40)) if piece_file ~= "" then if piece_file == "-" then table.insert(res_table, "—") else local piece_file_url = (path == "") and frame:callParserFunction{name = 'filepath:' .. piece_file} or (path .. piece_file) local player_args = {icon_width = '36px', src = piece_file_url} if not playable then player_args["download_style"] = "display:none;" end table.insert(res_table, frame:callParserFunction{name = '#Widget:MiniAudioPlayer', args = player_args}) end end lack_file = lack_file or piece_lack_file lack_text = lack_text or piece_lack_text lack_tran = lack_tran or piece_lack_tran end end table.insert(res_table, "\n|}") -- Mobile Table table.insert(res_table, string.format("\n{|class=\"%s %s\" ", table_class, "nodesktop")) table.insert(res_table, "style=\"width:100%;line-height:18px;text-align:center;display:table;white-space:normal;font-size:unset;\"\n") if not playable then table.insert(res_table, string.format("|-\n! colspan=\"2\" |'''%s'''", title)) end for i = 1, max_pieces do local piece_title = mw.text.trim(args["标题" .. i] or "") if piece_title ~= "" then local piece_jp = mw.text.trim(args["日文" .. i] or "") local piece_cn = mw.text.trim(args["中文" .. i] or "") local piece_cond = mw.text.trim(args["条件" .. i] or "") local piece_file = mw.text.trim(args["语音" .. i] or "") table.insert(res_table, string.format("\n|-\n!'''%s'''\n", piece_title)) table.insert(res_table, string.format("\n!style=\"width:%dpx;\"|", playable and 60 or 30)) if piece_file ~= "" then local piece_file_url = frame:callParserFunction{name = 'filepath:' .. piece_file} local player_args = {icon_width = '27px', src = piece_file_url} if not playable then player_args["download_style"] = "display:none;" end table.insert(res_table, frame:callParserFunction{name = '#Widget:MiniAudioPlayer', args = player_args}) end table.insert(res_table, string.format("\n|-\n|colspan=\"%d\" style=\"text-align:left;\"|", (playable and 3 or 2))) if playable and piece_jp ~= "" and piece_cn ~= "" then table.insert(res_table, "<p lang=\"ja\" style=\"margin:5px;margin-bottom:10px\">" .. piece_jp .. "</p><p style=\"margin:5px;\">" .. piece_cn) elseif piece_cn ~= "" then table.insert(res_table, "<p style=\"margin:5px;\">" .. piece_cn) else table.insert(res_table, "<p lang=\"ja\" style=\"margin:5px;\">" .. piece_jp) end table.insert(res_table, ((piece_cond ~= "") and string.format("'''(%s)'''</p>", piece_cond) or "</p>")) end end table.insert(res_table, "\n|}") if (playable and (mw.title.getCurrentTitle().namespace == 0)) then local category = "从者语音" category = mw.text.trim(args["类别"] or category) table.insert(res_table, string.format("[[分类:%s]]", category)) if lack_file then table.insert(res_table, string.format("[[分类:语音不全的%s]]", category)) end if lack_text then table.insert(res_table, string.format("[[分类:文本不全的%s]]", category)) end if lack_tran then table.insert(res_table, string.format("[[分类:翻译不全的%s]]", category)) end end return table.concat(res_table) end return p
该页面使用的模板:
模板:FromOther/CN
(
查看源代码
)
模板:Namespace detect
(
查看源代码
)
模块:VoiceTable/doc
(
查看源代码
)
返回至
模块:VoiceTable
。
导航菜单
个人工具
登录
名字空间
模块
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
随机页面
最近更改
最新文件
常用
上传多个文件
工具
链入页面
相关更改
特殊页面
页面信息