Module:Sandbox/SD0001/Tabbed window
Appearance
![]() | This module is rated as beta, and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected. |
Experimental port of mw:MediaWiki:Gadget-tabbedwindow.js which uses {{Calculator}}. No-JS behaviour is quite broken.
Demo: User:SD0001/Tabbed window.
Usage
{{#invoke:Sandbox/SD0001/Tabbed window|main|tab1=tab1|content1=content1|tab2=tab2|content2=content2}}
More than 2 tabs are supported as well.
local Arguments = require('Module:Arguments')
local p = {}
p.main = function(frame)
return p._main(Arguments.getArgs(frame))
end
p._main = function(args)
local tabsTable = {}
for param, value in ipairs(args) do
if string.match(param, "^tab%d+") ~= nil then
local num = tonumber(string.match(param, '%d+'))
if num ~= nil and args['content'..num] ~= nil then
tabsTable[value] = args['content'..num]
end
end
end
return tabsTable
end
return p