Anonymous user
Module:Protection banner: Difference between revisions
Jump to navigation
Jump to search
various category updates
(Add render methods to the Padlock and Banner classes, and call them from the exportToLua function. Now we have something to look at, yay!) |
(various category updates) |
||
Line 701:
local Category = class('Category')
function Category:initialize(configObj, protectionStatusObj, titleObj)
self._configObj = configObj
self._protectionStatusObj = protectionStatusObj
self._titleObj = titleObj
end
Line 708 ⟶ 711:
end
function Category:
if self.
return string.format(
'[[%s:%s]]',
mw.site.namespaces[14].name,
self.
)
end
end
Line 726 ⟶ 727:
local ProtectionCategory = Category:subclass('ProtectionCategory')
function ProtectionCategory:
Category.initialize(self, configObj, protectionStatusObj)
self._titleObj = titleObj
protectionStatusObj,▼
function ProtectionCategory:render()
)▼
local configObj = self._configObj
local protectionStatusObj = self._protectionStatusObj
local titleObj = self._titleObj
Category.setName(self, name)▼
▲ end
-- Get the namespace category key from the namespace number.
local nskey
do
local namespace = titleObj.namespace
local categoryNamespaces = configObj:getConfigTable('categoryNamespaces')
▲ nskey = categoryNamespaces[ns]
▲ nskey = 'talk'
end▼
end
end
Line 883 ⟶ 873:
if cat then
Category.setName(self, cat)
else
error(
Line 896 ⟶ 887:
local ExpiryCategory = Category:subclass('ExpiryCategory')
function ExpiryCategory:render()
local configObj = self._configObj
local protectionStatusObj = self._protectionStatusObj
--------------------------------------------------------------------------------
Line 902 ⟶ 898:
local ErrorCategory = Category:subclass('ErrorCategory')
function ErrorCategory:render()
local configObj = self._configObj
local protectionStatusObj = self._protectionStatusObj
local expiry = protectionStatusObj:getExpiry()
local action = protectionStatusObj:getAction()
if type(expiry) == 'number' and expiry < os.time()
or level == '*'
or action == 'move' and level == 'autoconfirmed'
then
Category.setName(self, configObj:getMessage('tracking-category-incorrect'))
return Category.export(self)
end
end
--------------------------------------------------------------------------------
|