Module:UserLinks: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
add the rest of the link types, remove wiki-encoded username as I ended up not using it at all
(use a protocol relative link for labs)
(add the rest of the link types, remove wiki-encoded username as I ended up not using it at all)
Line 13:
-- u.username The plain username --
-- u.usernameHtml The username html-encoded. Spaces are encoded with plus signs. --
-- u.usernameHtmlWiki The username html-encoded. Spaces are encoded with underscores. --
-- --
-- u.project The plain project name. --
Line 47 ⟶ 46:
 
local function makeBlockLogLink()
local url = mw.uri.fullUrl('Special:Log/block', 'page=User:' .. u.usernameHtmlWikiusernameHtml)
return '[' .. tostring(url) .. ' block log]'
end
 
local function makeBlocksLink()
return '[[' .. u.projectColon .. 'Special:Log/block/' .. u.username .. '|blocks]]'
end
 
local function makeBlockUserLink()
return '[[' .. u.projectColon .. 'Special:Block/' .. u.username .. '|block user]]'
end
 
local function makeCentralAuthLink()
return '[[' .. u.projectColon .. 'Special:CentralAuth/' .. u.username .. '|central auth]]'
end
 
local function makeDeletedContribsLink()
return '[[' .. u.projectColon .. 'Special:DeletedContributions/' .. u.username .. '|deleted contribs]]'
end
 
local function makeEmailLink()
return '[[' .. u.projectColon .. 'Special:Emailuser/' .. u.username .. '|email]]'
end
 
local function makeEditSummariesLink()
return '[http://toolserver.org/~tparis/editsummary/index.php?name=' .. u.usernameHtml .. '&lang=en&wiki=wikipedia edit summaries]'
end
 
local function makeDeletionsLink()
return '[[' .. u.projectColon .. 'Special:Log/delete/' .. u.username .. '|deletions]]'
end
 
local function makeListUserLink()
local url = mw.uri.fullUrl('Special:ListUsers', 'limit=1&username=' .. u.usernameHtml)
return '[' .. tostring(url) .. ' list user]'
end
 
local function makeSulLink()
return '[[sulutil:' .. u.username .. '|global contribs]]'
end
 
local function makeTargetLogsLink()
local url = mw.uri.fullUrl('Special:Log', 'page=User:' .. u.usernameHtml)
return '[' .. tostring(url) .. ' target logs]'
end
 
local function makeEditFilterLogLink()
local url = mw.uri.fullUrl('Special:AbuseLog', 'wpSearchUser=' .. u.usernameHtml)
return '[' .. tostring(url) .. ' edit filter log]'
end
 
local function makeProtectionsLink()
return '[[' .. u.projectColon .. 'Special:Log/protect/' .. u.username .. '|protections]]'
end
 
local function makeRightsLink()
return '[[' .. u.projectColon .. 'Special:Log/rights/' .. u.username .. '|rights]]'
end
 
local function makeRenamesLink()
return '[[' .. u.projectColon .. 'Special:Log/renameuser/' .. u.username .. '|renames]]'
end
 
local function makeRfaLink()
return '[[Special:PrefixIndex/Wikipedia:Requests for adminship/' .. u.username .. '|RfA]]'
end
 
local function getLink(linktype)
local linktypes = {
t = makeTalkLink,
c = makeContribsLink,
ct = makeCountLink,
m = makeMovesLink,
l = makeLogsLink,
bl = makeBlockLogLink,
bls = makeBlocksLink,
bu = makeBlockUserLink,
ca = makeCentralAuthLink,
dc = makeDeletedContribsLink,
e = makeEmailLink,
es = makeEditSummariesLink,
del = makeDeletionsLink,
lu = makeListUserLink,
sul = makeSulLink,
tl = makeTargetLogsLink,
efl = makeEditFilterLogLink,
pr = makeProtectionsLink,
rl = makeRightsLink,
ren = makeRenamesLink,
rfa = makeRfaLink
}
return linktypes[linktype]()
Line 92 ⟶ 170:
end
u.usernameHtml = mw.uri.encode(u.username) -- Html-encoded username. Spaces are encoded as pluses.
u.usernameHtmlWiki = mw.uri.encode(u.username, 'WIKI') -- Html-encodeed username. Spaces are encoded as underscores.
-------------------------------------------------
Line 99 ⟶ 176:
u.project = args.Project -- Get the project value.
u.projectColon = (u.project and (':' .. args.Project .. ':')) or '' -- Project value plus colons, for escaping interwiki links.
u.project = u.project or '' -- Control for nil values of args.Project.
end
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu