Module:Protection banner: Difference between revisions
Content added Content deleted
Enwikipedia>Jackmcbarn (rm some locals that only get used once) |
Enwikipedia>Jackmcbarn (condense _main and switch Blurb arg order) |
||
Line 339: | Line 339: | ||
local Blurb = class('Blurb') |
local Blurb = class('Blurb') |
||
function Blurb:initialize( |
function Blurb:initialize(protectionObj, cfg) |
||
self._cfg = cfg |
self._cfg = cfg |
||
self._protectionObj = protectionObj |
self._protectionObj = protectionObj |
||
Line 894: | Line 894: | ||
-- Initialise protection and blurb objects |
-- Initialise protection and blurb objects |
||
local protectionObj = Protection:new(args, cfg) |
local protectionObj = Protection:new(args, cfg) |
||
local blurbObj = Blurb:new( |
local blurbObj = Blurb:new(protectionObj, cfg) |
||
blurbObj:setDeletionDiscussionPage(args.xfd) |
blurbObj:setDeletionDiscussionPage(args.xfd) |
||
blurbObj:setUsername(args.user) |
blurbObj:setUsername(args.user) |
||
Line 904: | Line 904: | ||
if protectionObj:isProtected() then |
if protectionObj:isProtected() then |
||
-- Get the banner object |
-- Get the banner object |
||
local isPadlock = yesno(args.small) |
|||
local bannerObj |
local bannerObj |
||
if |
if yesno(args.small) then |
||
bannerObj = Padlock:new(cfg) |
bannerObj = Padlock:new(cfg) |
||
else |
|||
⚫ | |||
end |
|||
⚫ | |||
⚫ | |||
⚫ | |||
if isPadlock then |
|||
bannerObj:setImageTooltip(blurbObj:makeTooltipText()) |
bannerObj:setImageTooltip(blurbObj:makeTooltipText()) |
||
bannerObj:setImageAlt(blurbObj:makeAltText()) |
bannerObj:setImageAlt(blurbObj:makeAltText()) |
||
bannerObj:setImageLink(blurbObj:makeLinkText()) |
bannerObj:setImageLink(blurbObj:makeLinkText()) |
||
else |
else |
||
⚫ | |||
-- Large banners use the alt text for the tooltip. |
-- Large banners use the alt text for the tooltip. |
||
bannerObj:setImageTooltip(blurbObj:makeAltText()) |
bannerObj:setImageTooltip(blurbObj:makeAltText()) |
||
⚫ | |||
end |
|||
⚫ | |||
if not isPadlock then |
|||
bannerObj:setReasonText(blurbObj:makeReasonText()) |
bannerObj:setReasonText(blurbObj:makeReasonText()) |
||
bannerObj:setExplanationText(blurbObj:makeExplanationText()) |
bannerObj:setExplanationText(blurbObj:makeExplanationText()) |
||
bannerObj:setPage(protectionObj.title.prefixedText) |
bannerObj:setPage(protectionObj.title.prefixedText) |
||
end |
end |
||
⚫ | |||
⚫ | |||
⚫ | |||
ret[#ret + 1] = tostring(bannerObj) |
ret[#ret + 1] = tostring(bannerObj) |