Content deleted Content added
Restore |
Sohom Datta (talk | contribs) others |
||
(18 intermediate revisions by 9 users not shown) | |||
Line 15:
local mTableTools -- [[Module:TableTools]]
local interwikiTable -- [[Module:InterwikiTable]], loaded with mw.loadData
-- Load shared helper functions
Line 26 ⟶ 25:
local makeFullUrlLink = mShared.makeFullUrlLink
local message = mShared.message
local p = {}
Line 65 ⟶ 58:
snippets.username
)
end
function linkFunctions.np(snippets)
-- User page (no ping)
return '<span class="plainlinks">' .. makeFullUrlLink(
snippets.interwiki,
2,
snippets.username,
'',
snippets.username
) .. '</span>'
end
Line 85 ⟶ 89:
message('display-contributions')
)
end
function linkFunctions.c64(snippets)
-- Contributions
local first64 = snippets.username:match('^%x+:%x+:%x+:%x+:')
or snippets.username:match('^%x+:%x+:%x+:')
or snippets.username:match('^%x+:%x+:')
or snippets.username:match('^%x+:')
return first64 and makeWikilink(
snippets.interwiki,
-1,
'Contribs/' .. first64 .. ':/64',
'(/64)'
) or ''
end
function linkFunctions.ct(snippets)
-- Edit count
return
0,
'ec/' .. snippets.toolLang .. '.' .. snippets.projectLong .. '.org/' .. snippets.username,
message('display-count')
)
Line 124 ⟶ 137:
function linkFunctions.ae(snippets)
-- Automated edits (and non-automated contributions).
return
0,
'autoedits/' .. snippets.toolLang .. '.' .. snippets.projectLong .. '.org/' .. snippets.username,
message('display-autoedits')
)
end
function linkFunctions.bl(snippets)
-- Block log
Line 208:
function linkFunctions.es(snippets)
-- Edit summaries
return
0,
'editsummary/' .. snippets.toolLang .. '.' .. snippets.projectLong .. '.org/' .. snippets.username,
message('display-editsummaries')
)
Line 228 ⟶ 223:
'Log/delete/' .. snippets.username,
message('display-deletions')
)
end
Line 320 ⟶ 307:
message('display-rfa')
)
end
Line 392 ⟶ 333:
'ListFiles/' .. snippets.username,
message('display-uploads')
)
end
function linkFunctions.nuke(snippets)
-- Mass delete/Special:Nuke
return makeWikilink(
snippets.interwiki,
-1,
'Nuke/' .. snippets.username,
message('display-nuke')
)
end
function linkFunctions.gender(snippets)
-- Gender
return mw.getCurrentFrame():callParserFunction(
'GENDER',
snippets.username,
'he/him',
'she/her',
'they/them'
)
end
Line 418 ⟶ 382:
end
end
local function getExtraLinkFunctions()
-- Loads the table of extra link functions from the /extra module.
Line 444 ⟶ 409:
local function memoizeExtraLink(code, func)
local success, link = pcall(func, snippets)
if
links[code] = link
return link
end
return
end
Line 466 ⟶ 428:
local linkFunction = linkFunctions[code]
local link
if linkFunction then
link = linkFunction(snippets)
links[code] = link
else
extraLinkFunctions = getExtraLinkFunctions()
Line 476 ⟶ 436:
local extraLinkFunction = extraLinkFunctions[code]
if type(extraLinkFunction) == 'function' then
end
end
end
if
return link
else
Line 510 ⟶ 470:
return links
end
--------------------------------------------------------------------------------
-- User data snippets
Line 675 ⟶ 636:
function snippetFunctions.fullDomain()
-- The full ___domain name of the site, e.g. www.mediawiki.org,
-- en.
local fullDomain
local lang = getSnippet('toolLang')
Line 756 ⟶ 717:
local options = {}
options.isDemo = yesno(args.demo) or false
options.noPing = yesno(args.noPing) or yesno(args.noping) or yesno(args.np) or false
options.toolbarStyle = yesno(args.small) and 'font-size: 90%;' or nil
options.sup = yesno(args.sup, true)
Line 781 ⟶ 743:
function p.export(codes, links, options)
-- Make the user link.
local userLink = options.noPing and links.np or links.u
-- If we weren't passed any link codes, just return the user link.
Line 845 ⟶ 807:
end
return p
|