Module:Protection banner:修订间差异

IdleTap-bot​(留言 | 贡献)
导入自求闻百科
 
zhwiki>Hamish
 
第3行: 第3行:


-- Initialise necessary modules.
-- Initialise necessary modules.
require('Module:No globals')
require('strict')
local makeFileLink = require('Module:File link')._main
local makeFileLink = require('Module:File link')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
第398行: 第398行:
parameterFuncs.TOOLTIPBLURB      = self._makeTooltipBlurbParameter
parameterFuncs.TOOLTIPBLURB      = self._makeTooltipBlurbParameter
parameterFuncs.TOOLTIPFRAGMENT    = self._makeTooltipFragmentParameter
parameterFuncs.TOOLTIPFRAGMENT    = self._makeTooltipFragmentParameter
 
parameterFuncs.VANDAL            = self._makeVandalTemplateParameter
self._params = setmetatable({}, {
self._params = setmetatable({}, {
__index = function (t, k)
__index = function (t, k)
第630行: 第631行:
return self:_getExpandedMessage('tooltip-fragment-noexpiry')
return self:_getExpandedMessage('tooltip-fragment-noexpiry')
end
end
end
function Blurb:_makeVandalTemplateParameter()
return require('Module:Vandal-m')._main{
self._args.user or self._protectionObj.title.baseText
}
end
end


第717行: 第724行:
return makeFileLink{
return makeFileLink{
file = filename,
file = filename,
size = (self.imageWidth or 40) .. 'px',
size = (self.imageWidth or 20) .. 'px',
alt = self._imageAlt,
alt = self._imageAlt,
link = self._imageLink,
link = self._imageLink,
第773行: 第780行:
obj._imageLink = blurbObj:makeBannerText('link')
obj._imageLink = blurbObj:makeBannerText('link')
obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action]
obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action]
or ((protectionObj.action == 'edit') and cfg.padlockIndicatorNames[protectionObj.level])
or cfg.padlockIndicatorNames.default
or cfg.padlockIndicatorNames.default
or 'pp-default'
or 'pp-default'
第779行: 第787行:


function Padlock:__tostring()
function Padlock:__tostring()
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.cascadingProtection.restrictions.edit then return end
local frame = mw.getCurrentFrame()
local frame = mw.getCurrentFrame()
-- The nowiki tag helps prevent whitespace at the top of articles.
-- The nowiki tag helps prevent whitespace at the top of articles.