Module:Sock list/sandbox

local p = {}
local getArgs = require('Module:Arguments').getArgs
local isIpOrRange = require('Module:IPAddress')._isIpOrRange
local yesno = require('Module:Yesno')
local m_checkuser = require('Module:Checkuser')
local checkip = m_checkuser._ip
local checkuser = m_checkuser._user

function p.main(frame)
	local args = getArgs(frame)
	return p._main(frame, args)
end

function listEntry(frame, args, sockNum, sock)
	local template = (isIpOrRange(sock) ~= "")
		and (args.IP_template or args.template or 'checkip')
		or (args.account_template or args.template or 'checkuser')
	local li = mw.html.create('li')
	local text
	if template == 'checkip' then
		text = checkip(sock, args.master)
	elseif template == 'checkuser' then
		text = checkuser(sock, args.master)
	end
	if args['strike' .. sockNum] then
		text = "<s>" .. text .. "</s>"
	end
	local note = args['note' .. sockNum]
	if note then
		text = text .. " " .. note
	end
	li:wikitext(text)
	return li
end

function toolEIA(args)
	local url = "https://tools.wmflabs.org/sigma/editorinteract.py?users="
		.. mw.uri.encode(args.master or "")
	for i, sock in ipairs(args) do
		if not args['strike' .. i] then
			url = url .. "&users=" .. mw.uri.encode(sock)
		end
	end
	return "[" .. url .. " Editor interaction utility]"
end

function toolTimeline(args)
	local url = "https://tools.wmflabs.org/interaction-timeline?wiki=enwiki&user="
		.. mw.uri.encode(args.master or "") .. "&user=" .. mw.uri.encode(args[1] or "")
	return "[" .. url .. " Interaction Timeline]"
end

function toolSpiTools(args)
	local url = "https://spi-tools.toolforge.org/spi/?caseName="
		.. mw.uri.encode(args.master or "")
	return "[" .. url .. " SPI Tools]"
end

function p._main(frame, args)
	local socklist = mw.html.create('ul')
	if yesno(args.hidden) then
		socklist:attr('style', 'display:none;')
	end
	if args[1] then
		for sockNum, sock in ipairs(args) do
			if args.master ~= sock or not yesno(args.remove_master or 'no') then
				socklist:node(listEntry(frame, args, sockNum, sock))
	end end end
	if yesno(args.tools_link) then
		local tools = mw.html.create('li')
		tools
			:attr('class', 'plainlinks')
			:wikitext("<b>Tools</b>: ")
			:node(toolEIA(args))
			:wikitext(" <b>&middot;</b> ")
			:node(toolTimeline(args))
			:wikitext(" <b>&middot;</b> ")
			:node(toolSpiTools(args))
		socklist:node(tools)
	end
	return socklist
end

return p

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.