Module:Sock list:修订间差异
外观
删除的内容 添加的内容
Copied content from w:en:Module:Sock list; see that page's history for attribution; via importer.js |
LuciferianThomas(留言 | 贡献) + hidename參數 |
||
(未显示2个用户的10个中间版本) | |||
第9行: | 第9行: | ||
end |
end |
||
function listEntry(frame, sock, master) |
function listEntry(frame, sock, master, hidename) |
||
local |
local isip = (isIpOrRange(sock) ~= "") |
||
local template = isip and "checkip" or "checkuser" |
|||
local li = mw.html.create('li') |
local li = mw.html.create('li') |
||
if isip then |
|||
⚫ | |||
li:attr('class', "template-sock-list-ip") |
|||
li:attr('data-ip', sock) |
|||
else |
|||
li:attr('class', "template-sock-list-user") |
|||
li:attr('data-user', sock) |
|||
end |
|||
⚫ | |||
return li |
return li |
||
end |
end |
||
function toolEIA(args) |
function toolEIA(args) |
||
local url = "https://tools.wmflabs.org/sigma/editorinteract.py?users=" |
local url = "https://tools.wmflabs.org/sigma/editorinteract.py?server=zhwiki&users=" |
||
.. mw.uri.encode(args.master) |
.. mw.uri.encode(args.master) |
||
for i, sock in ipairs(args) do |
for i, sock in ipairs(args) do |
||
url = url .. "&users=" .. mw.uri.encode(sock) |
url = url .. "&users=" .. mw.uri.encode(sock) |
||
end |
end |
||
return "[" .. url .. " |
return "[" .. url .. " 用戶互動分析]" |
||
end |
end |
||
function toolTimeline(args) |
function toolTimeline(args) |
||
local user2 = args[1] or "" |
|||
⚫ | |||
if args.master == user2 then |
|||
user2 = args[2] or "" |
|||
⚫ | |||
end |
end |
||
⚫ | |||
⚫ | |||
function toolCompare(args) |
|||
⚫ | |||
local url = "https://tools.wmflabs.org/betacommand-dev/UserCompare/" |
|||
⚫ | |||
return "[" .. url .. " User compare report]" |
|||
end |
end |
||
function p._main(frame, args) |
function p._main(frame, args) |
||
local socklist = mw.html.create(' |
local socklist = mw.html.create('div') |
||
socklist:attr('class', 'template-sock-list') |
|||
local userlist = mw.html.create('ul') |
|||
if args[1] then |
if args[1] then |
||
for i, sock in ipairs(args) do |
for i, sock in ipairs(args) do |
||
userlist:node(listEntry(frame, sock, args.master, yesno( args[ 'hidename' .. i ] or 0 ))) |
|||
end |
end |
||
end |
end |
||
⚫ | |||
if yesno(args.tools_link) then |
if yesno(args.tools_link) then |
||
local |
local toolswrapper = mw.html.create('dl') |
||
local tools = mw.html.create('dd') |
|||
tools |
tools |
||
:attr('class', 'plainlinks') |
:attr('class', 'plainlinks template-sock-list-tools') |
||
:wikitext("<b> |
:wikitext("<b>工具</b>:") |
||
:node(toolEIA(args)) |
:node(toolEIA(args)) |
||
:wikitext(" • ") |
:wikitext(" • ") |
||
:node(toolTimeline(args)) |
:node(toolTimeline(args)) |
||
toolswrapper:node(tools) |
|||
:wikitext(" • ") |
|||
socklist:node(toolswrapper) |
|||
:wikitext(" <small>''Auto-generated every hour.''</small>") |
|||
⚫ | |||
end |
end |
||
return socklist |
return socklist |
2023年1月25日 (三) 07:05的最新版本
相关页面 |
---|
此模块被小工具、Common.js或用戶工具使用。 如果您打算移動、刪除或修改此頁面而無法向下兼容,並會影響相關工具運作時,請先通知相關工具的維護者,謝謝您。 相關的工具:User:Xiplus/js/spihelper.js |
相關的小工具對於Wikipedia:傀儡調查的格式相當敏感,請勿擅自變更任何文字、空白、換行。 |
Implements {{sock list}}.
Usage
{{#invoke:Sock list|main}}
local p = {}
local getArgs = require('Module:Arguments').getArgs
local isIpOrRange = require('Module:IPAddress')._isIpOrRange
local yesno = require('Module:Yesno')
function p.main(frame)
local args = getArgs(frame)
return p._main(frame, args)
end
function listEntry(frame, sock, master, hidename)
local isip = (isIpOrRange(sock) ~= "")
local template = isip and "checkip" or "checkuser"
local li = mw.html.create('li')
if isip then
li:attr('class', "template-sock-list-ip")
li:attr('data-ip', sock)
else
li:attr('class', "template-sock-list-user")
li:attr('data-user', sock)
end
li:wikitext(frame:expandTemplate{title=template, args={sock, ['master name']=master, ['hidename']=(hidename and '1' or ''), bullet='no'}})
return li
end
function toolEIA(args)
local url = "https://tools.wmflabs.org/sigma/editorinteract.py?server=zhwiki&users="
.. mw.uri.encode(args.master)
for i, sock in ipairs(args) do
url = url .. "&users=" .. mw.uri.encode(sock)
end
return "[" .. url .. " 用戶互動分析]"
end
function toolTimeline(args)
local user2 = args[1] or ""
if args.master == user2 then
user2 = args[2] or ""
end
local url = "https://tools.wmflabs.org/interaction-timeline?wiki=zhwiki&user="
.. mw.uri.encode(args.master) .. "&user=" .. mw.uri.encode(user2)
return "[" .. url .. " 互動時間線]"
end
function p._main(frame, args)
local socklist = mw.html.create('div')
socklist:attr('class', 'template-sock-list')
local userlist = mw.html.create('ul')
if args[1] then
for i, sock in ipairs(args) do
userlist:node(listEntry(frame, sock, args.master, yesno( args[ 'hidename' .. i ] or 0 )))
end
end
socklist:node(userlist)
if yesno(args.tools_link) then
local toolswrapper = mw.html.create('dl')
local tools = mw.html.create('dd')
tools
:attr('class', 'plainlinks template-sock-list-tools')
:wikitext("<b>工具</b>:")
:node(toolEIA(args))
:wikitext(" • ")
:node(toolTimeline(args))
toolswrapper:node(tools)
socklist:node(toolswrapper)
end
return socklist
end
return p