Module:Protection banner: Difference between revisions

add p.renderPadlock function
Enwikipedia>Mr. Stradivarius
(try tweaking the order)
Enwikipedia>Mr. Stradivarius
(add p.renderPadlock function)
Line 86:
local tremove = table.remove
local ceil = math.ceil
local format = string.format
 
local function toTableEnd(t, pos)
Line 229 ⟶ 230:
end
error('No category match found; please define the category for key "all-all-all-all-all"')
end
 
function p.renderPadlock(data)
-- Renders the padlock seen in the top-right-hand corner or protected pages,
-- using the data provided in the data table.
local root = mw.html.create('div')
root
:addClass('metadata topicon nopopups')
:attr('id', 'protected-icon')
:css{display = 'none', right = data.right or '55px'}
:wikitext(format(
'[[Image:%s|20px|link=%s|%s|alt=%s]]',
data.image, data.iconLink, data.iconText, data.altText
))
return tostring(root)
end