模組:Status
外观
有機器人使用本模块
如欲移動、刪除或修改此模块而無法向下兼容,並會影響機器人運作,請先通知機器人操作者,謝謝您。相關的機器人:User:A2093064-bot及User:Jimmy-bot及User:cewbot |
請在新增參數值別名前先告知機器人操作者。 |
相关页面 |
---|
上述文档嵌入自Module:Status/doc。 (编辑 | 历史) 编者可以在本模块的沙盒 (编辑 | 差异)和测试样例 (创建)页面进行实验。 本模块的子页面。 |
local p = {}
local page = mw.title.new( 'Module:Status/data.json' )
local content = page:getContent()
local data = mw.text.jsonDecode( content )
local function status (x)
for k,v in pairs(data) do
for _,s in pairs(v.status) do
if x == s then return k end
end
end
return 'unknown'
end
local function color (x)
return data[status(x)].color
end
local function text (x, arg1, arg2)
return arg2 or data[status(x)].text or arg1 or '處理中'
end
local function isKeep (x)
return data[status(x)].keep or false
end
function p._main(args)
local arg = args[1] and args[1]:lower() or '處理中'
local code = args['prefix'] or '狀態:'
local spanid = nil
local bot_archive = ''
if isKeep(arg) then
spanid = '_new_request'
bot_archive = mw.getCurrentFrame():expandTemplate{title='Bot-directive-archiver', args={'keep'}}
end
code = code .. mw.text.tag('span', {
['class'] = 't-status',
['style'] = 'background:' .. color(arg),
['id'] = spanid or nil
}, '  ')
code = code .. ' ' .. mw.text.tag('b', {}, text(arg, args[1], args[2])) .. (args['sign'] or '')
code = mw.text.tag('div', {}, code) .. bot_archive
return code
end
--[=[
local paid = {}
if id then paid['id'] = id end
if id then paid['id'] = id end
if style then paid['style'] = style end
if title then paid['title'] = title end
]=]--
function p.main(frame)
local args = {}
for k, v in pairs( frame:getParent().args ) do
args[k] = v
end
return p._main(args)
end
return p