Modulo:Navbox/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
navbox sempre aperti nella pagina del template |
m Bot: rimuovo no globals obsoleto |
||
(18 versioni intermedie di un altro utente non mostrate) | |||
Riga 3:
]]--
require('
local getArgs = require('Modulo:Arguments').getArgs
Riga 48:
-- Con il debug ridefinisce il metodo mw.html:css,
-- permettendo di eseguire i test senza controllare anche
--
-- @param {table} tableNode
Riga 65:
-- Carica il CSS via TemplateStyles quando opportuno
local function loadCSS(name)
local styles = 'Modulo:Navbox/sandbox/' .. prefix .. 'styles.css'
end
Line 89 ⟶ 86:
local self = {}
local thNode
setmetatable(self, { __index = Navbox })
Line 108 ⟶ 99:
:tag('th')
:attr('colspan', self.args.image and '3' or '2')
:cssText(self.args.titlestyle)
if self.args.navbar ~= 'plain' then
Line 139 ⟶ 129:
-- Configura gli stili CSS della tabella
function Navbox:_setupTableNode()
self.tableNode
:addClass(isTemplatePage(self.args.name) and 'navbox_mobile' or 'navbox')
Line 153 ⟶ 136:
self.args.state == 'autocollapse' and 'autocollapse' or
not self.args.state and 'autocollapse' or nil)
:addClass('nowraplinks noprint metadata')
:attr('id', 'navbox-' .. (self.args.name or ''))
:addClass('noprint')▼
:addClass('metadata')▼
:cssText(self.args.style)
:cssText(self.args.bodystyle)
Line 165 ⟶ 146:
-- @param {table} node
function Navbox:_addTnavbar(node)
local tnavbar = mw.getCurrentFrame():expandTemplate {
title = 'Tnavbar',
Line 179 ⟶ 153:
}
}
node:tag('div'):
end
Line 186 ⟶ 160:
-- @param {table} node
function Navbox:_addTitle(node)
node:tag('span'):
end
Line 194 ⟶ 168:
-- @param {string} argStyle
function Navbox:_addAboveOrBelow(arg, argStyle)
self.tableNode
:tag('tr')
:tag('
:attr('colspan', self.args.image and '3' or '2')
:
:cssText(argStyle)
:wikitext(arg)
Line 213 ⟶ 182:
-- @param {number} rowspan
function Navbox:_addImage(trNode, rowspan)
trNode
:tag('td')
:attr('rowspan', rowspan)
:
:cssText(self.args.imagestyle)
:wikitext(self.args.image)
Line 229 ⟶ 193:
function Navbox:_addLists()
local rowIds, altStyle, altBackground
-- crea una riga per ogni groupN/listN
rowIds = getIds(self.args, true)
for
local trNode = self.tableNode:tag('tr')
-- groupN
Line 243 ⟶ 201:
trNode:tag('th')
:attr('colspan', self.args['list' .. id] and '1' or '2')
:
:cssText(self.args.groupstyle)
:cssText(self.args['group' .. id .. 'style'])
Line 251 ⟶ 209:
if self.args['list' .. id] then
local list = trimSep(self.args['list' .. id])
if (
altStyle = self.args.evenstyle
altBackground = '
else
altStyle = self.args.oddstyle
altBackground =
end
trNode:tag('td')
:attr('colspan', self.args['group' .. id] and '1' or '2')
:
▲ :css('text-align', self.args['group' .. id] and 'left' or 'center')
:cssText(self.args.liststyle)
:cssText(altStyle)
Line 310 ⟶ 267:
-- Configura gli stili CSS della tabella.
function NavboxSubgroup:_setupTableNode()
self.tableNode
▲ :addClass(isTemplatePage(self.args.name) and 'navbox_mobile' or 'navbox')
:cssText(self.args.bodystyle)
end
Line 328 ⟶ 275:
function NavboxSubgroup:_addLists()
local listIds, altStyle
-- crea una row per ogni listN
listIds = getIds(self.args)
Line 340 ⟶ 283:
if self.args['group' .. id] then
trNode:tag('th')
:
:cssText(self.args.groupstyle)
:wikitext(self.args['group' .. id])
Line 351 ⟶ 294:
trNode:tag('td')
:attr('colspan', self.args['group' .. id] and '1' or '2')
:
:cssText(self.args.liststyle)
:cssText(altStyle)
Line 371 ⟶ 314:
-- Funzione per l'utilizzo da un altro modulo.
function p._navbox_subgroup(args)
return
end
|