「モジュール:Protection banner」の版間の差分
細 1版 |
細 1版 をインポートしました |
||
| (3人の利用者による、間の3版が非表示) | |||
| 3行目: | 3行目: | ||
-- Initialise necessary modules. | -- Initialise necessary modules. | ||
require(' | 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 | ||
| 13行目: | 13行目: | ||
-- Set constants. | -- Set constants. | ||
local CONFIG_MODULE = ' | local CONFIG_MODULE = 'モジュール:Protection banner/config' | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
| 311行目: | 311行目: | ||
return not self:isProtected() | return not self:isProtected() | ||
or type(expiry) == 'number' and expiry < os.time() | or type(expiry) == 'number' and expiry < os.time() | ||
end | |||
-- 日本語版独自 | |||
function Protection:isMismatched() | |||
return self.reason == 'dispute' and self.level ~= 'sysop' | |||
end | end | ||
| 328行目: | 333行目: | ||
ret[#ret + 1] = makeCategoryLink( | ret[#ret + 1] = makeCategoryLink( | ||
msg['tracking-category-incorrect'], | msg['tracking-category-incorrect'], | ||
self.title.text | |||
) | |||
elseif self:isMismatched() then | |||
ret[#ret + 1] = makeCategoryLink( | |||
msg['tracking-category-mismatch'], | |||
self.title.text | self.title.text | ||
) | ) | ||
| 685行目: | 695行目: | ||
local imageFilename = protectionObj.bannerConfig.image | local imageFilename = protectionObj.bannerConfig.image | ||
if imageFilename then | if imageFilename then | ||
obj._imageFilename = imageFilename | |||
-- 日本語版独自の条件分岐 | |||
if type(imageFilename) == 'string' then | |||
obj._imageFilename = imageFilename | |||
elseif type(imageFilename) == 'function' then | |||
obj._imageFilename = imageFilename(protectionObj) | |||
end | |||
else | else | ||
-- If an image filename isn't specified explicitly in the banner config, | -- If an image filename isn't specified explicitly in the banner config, | ||
| 728行目: | 744行目: | ||
return makeFileLink{ | return makeFileLink{ | ||
file = filename, | file = filename, | ||
size = (self. | size = (self.imageSize or 'x20') .. 'px', -- 日本語版独自の変更 | ||
alt = self._imageAlt, | alt = self._imageAlt, | ||
link = self._imageLink, | link = self._imageLink, | ||
| 744行目: | 760行目: | ||
function Banner.new(protectionObj, blurbObj, cfg) | function Banner.new(protectionObj, blurbObj, cfg) | ||
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. | local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. | ||
obj. | obj.imageSize = 40 -- 日本語版独自の変更: フィールド名 | ||
obj.imageCaption = blurbObj:makeBannerText('alt') -- Large banners use the alt text for the tooltip. | obj.imageCaption = blurbObj:makeBannerText('alt') -- Large banners use the alt text for the tooltip. | ||
obj._reasonText = blurbObj:makeBannerText('text') | obj._reasonText = blurbObj:makeBannerText('text') | ||
| 779行目: | 795行目: | ||
function Padlock.new(protectionObj, blurbObj, cfg) | function Padlock.new(protectionObj, blurbObj, cfg) | ||
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. | local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. | ||
obj. | obj.imageSize = 'x20' -- 日本語版独自の変更: フィールド名、高さのみ指定 | ||
obj.imageCaption = blurbObj:makeBannerText('tooltip') | obj.imageCaption = blurbObj:makeBannerText('tooltip') | ||
obj._imageAlt = blurbObj:makeBannerText('alt') | obj._imageAlt = blurbObj:makeBannerText('alt') | ||