Diferencia entre revisiones de «Módulo:Series overview»

Ir a la navegación Ir a la búsqueda
episodesT
m (1 revisión importada)
Cobra Kai>Alex 21
(episodesT)
Línea 1: Línea 1:
-- This module implements {{Series overview}}.
-- This module implements {{Series overview}}.


require('Module:No globals')
require('strict')
local yesno = require('Module:Yesno')
local yesno = require('Module:Yesno')
local HTMLcolor = mw.loadData( 'Module:Color contrast/colors' )
local HTMLcolor = mw.loadData( 'Module:Color contrast/colors' )
Línea 85: Línea 85:
return infoCell
return infoCell
end
function SeriesOverview.endtable()
return "</table></div>"
end
end


Línea 104: Línea 108:
:addClass('plainrowheaders')
:addClass('plainrowheaders')
:css('text-align', 'center')
:css('text-align', 'center')
:css('height', '1px')
:css('display', 'table')
-- Sortable
-- Sortable
if args.sortable then
if args.sortable then
root:addClass('sortable');
root:addClass('sortable');
end
-- "Series overview" ID
if args.id then
root:attr('id', 'Series overview')
end
end
Línea 215: Línea 226:
:attr('scope', 'col')
:attr('scope', 'col')
:attr('rowspan', allReleased and 1 or 2)
:attr('rowspan', allReleased and 1 or 2)
:attr('colspan', ((args.multiseries and args.no_colors) or (not args.multiseries and noColors)) and 1 or 2)
:css('min-width', '50px')
:css('min-width', '50px')
:css('padding', cellPadding)
:css('padding', cellPadding)
Línea 244: Línea 254:
:attr('colspan', 2)
:attr('colspan', 2)
:css('padding', cellPadding)
:css('padding', cellPadding)
:wikitext('Episodes')
:wikitext(args.episodesT or 'Episodes')
end
end
end
end
Línea 354: Línea 364:
local k = string.char(k0)
local k = string.char(k0)
if k0 == string.byte('A')-1 then k = '' end
if k0 == string.byte('A')-1 then k = '' end
-- Part header
if entry.part and k == '' then
root:node(entry.part)
end
-- New season row
-- New season row
-- local seasonRow = (entry['color' .. k] or entry['episodes' .. k] or entry['start' .. k] or entry['end' .. k]) and root:tag('tr') or mw.html.create('tr')
-- local seasonRow = (entry['color' .. k] or entry['episodes' .. k] or entry['start' .. k] or entry['end' .. k]) and root:tag('tr') or mw.html.create('tr')
local seasonRow = entry['start' .. k] and root:tag('tr') or mw.html.create('tr')
local seasonRow = entry['start' .. k] and root:tag('tr') or mw.html.create('tr')
seasonRow:css('height', '100%')
-- Part header
if entry.part then
seasonRow:node(entry.part)
end
local borderBottom = '2px solid #8D939A'
local borderBottom = '2px solid #8D939A'
Línea 378: Línea 389:
end
end
-- Colored cell
-- Season number link, included only in the first row
local cellColor
if not noColors then
if not noColors then
if entry['color' .. k] ~= nil and HTMLcolor[entry['color' .. k]] == nil then  
if entry['color' .. k] ~= nil and HTMLcolor[entry['color' .. k]] == nil then  
entry['color' .. k] = '#'..(mw.ustring.match(entry['color' .. k], '^[%s#]*([a-fA-F0-9]*)[%s]*$') or '')
entry['color' .. k] = '#'..(mw.ustring.match(entry['color' .. k], '^[%s#]*([a-fA-F0-9]*)[%s]*$') or '')
end
end
if splitSeason and entry.color then
if splitSeason then
if k == 'A' then
if entry.color then
seasonRow:tag('td')
cellColor = entry.color
:attr('rowspan', entry.color and splits or 1)
else
:css('background', entry.color)
cellColor = "linear-gradient(to bottom"
:css('width','10px')
for i = 0, splits-1 do
local _color = 'color' .. string.upper(string.char(i+97))
cellColor = cellColor .. ", " .. (entry[_color] or 'rgba(0,0,0,0)') .. " " .. (100/splits *i) .. "%"
  .. ", " .. (entry[_color] or 'rgba(0,0,0,0)') .. " " .. (100/splits *(i+1)) .. "%"
end
cellColor = cellColor .. ")"
end
end
else
else
seasonRow:tag('td')
cellColor = entry['color' .. k]
:css('background',entry['color' .. k])
:css('width','10px')
end
end
end
end
-- Season number link, included only in the first row
if k == '' or k == 'A' then
if k == '' or k == 'A' then
seasonRow:tag(args.series and 'td' or 'th')
local colorWidth = '14px'
-- Overall table cell
local cellRow = mw.html.create(args.series and 'td' or 'th')
:attr('scope', 'row')
:attr('scope', 'row')
:attr('rowspan', splitSeason and splits or nil)
:attr('rowspan', splitSeason and splits or nil)
:attr('colspan', entry.special and not entry.episodes and 3+numAuxCells or 1)
:attr('colspan', entry.special and not entry.episodes and 3+numAuxCells or 1)
:css('height', 'inherit')
:css('padding', '0')
-- Overall inner span
local spanRow = mw.html.create('span')
spanRow
:css('width: 100%')
:css('text-align', 'center')
:css('text-align', 'center')
:wikitext((entry.link and '[[' .. entry.link .. '|' .. (entry.linkT or season) .. ']]' or (entry.linkT or season)) .. (entry.linkR or ''))
:css('float', 'left')
:css('width', '100%')
:css('height', '100%')
-- Coloured nested span
local spanRow2 = mw.html.create('span')
spanRow2
:css('width', colorWidth)
:css('background', cellColor)
:css('height', '100%')
:css('float', 'left')
:css('box-shadow', 'inset -1px 0 #A2A9B1')
-- Link nested span
local spanRow3 = mw.html.create('span')
spanRow3
:css('height', '100%')
:css('width', not noColors and 'calc(100% - ' .. colorWidth .. ' - 8px)' or '100%')
:css('display', 'flex')
:css('vertical-align', 'middle')
:css('align-items', 'center')
:css('justify-content', 'center')
:css('padding', not noColors and '0 4px' or '')
local spanRow4 = mw.html.create('span')
spanRow4
:addClass('nowrap')
-- Coloured span first into the overall span
if not noColors then
spanRow:node(spanRow2)
end
-- Link into the blank span
spanRow4:wikitext((entry.link and '[[' .. entry.link .. '|' .. (entry.linkT or season) .. ']]' or (entry.linkT or season)) .. (entry.linkR or ''))
-- Blank span into the Link nested span
spanRow3:node(spanRow4)
-- Link span second into the overall span
spanRow:node(spanRow3)
-- Overall span into the actual cell
cellRow:node(spanRow)
-- The actual cell into the season row
seasonRow:node(cellRow)
end
end
Línea 429: Línea 494:
if entry.episodes then
if entry.episodes then
local thisCell = SeriesOverview.season_cell(entry.episodes, frame)
local thisCell = SeriesOverview.season_cell(entry.episodes, frame)
:attr('colspan', splitSeason and 1 or 2)
:attr('colspan', (splitSeason and entry.episodesA ~= 'hide') and 1 or 2)
:attr('rowspan', splitSeason and splits or nil)
:attr('rowspan', splitSeason and splits or nil)
seasonRow:node(thisCell)
seasonRow:node(thisCell)
Línea 435: Línea 500:
local infoCell = SeriesOverview.series_attributes( frame:expandTemplate{title='N/A',args={'TBA'}} )
local infoCell = SeriesOverview.series_attributes( frame:expandTemplate{title='N/A',args={'TBA'}} )
infoCell
infoCell
:attr('colspan', splitSeason and 1 or 2)
:attr('colspan', (splitSeason and entry.episodesA ~= 'hide') and 1 or 2)
:attr('rowspan', splitSeason and splits or nil)
:attr('rowspan', splitSeason and splits or nil)
seasonRow:node(infoCell)
seasonRow:node(infoCell)
end
end
end
end
if splitSeason then
if splitSeason and entry.episodesA ~= 'hide' then
if entry['episodes' .. k] then
if entry['episodes' .. k] then
local thisCell = SeriesOverview.season_cell(entry['episodes' .. k], frame)
local thisCell = SeriesOverview.season_cell(entry['episodes' .. k], frame)
Línea 538: Línea 603:
end -- End 'if' multiseries
end -- End 'if' multiseries
end -- End 'do' season rows
end -- End 'do' season rows
local rootdiv
if args.multiseries or not args.series then
rootdiv = mw.html.create('div')
rootdiv
:css('display', 'block')
:css('overflow-x', 'auto')
rootdiv:node(root)
rootdiv = tostring(rootdiv)
else
rootdiv = tostring(root)
end
if args.dontclose then
rootdiv = mw.ustring.gsub(rootdiv, "</div>", "")
rootdiv = mw.ustring.gsub(rootdiv, "</table>", "")
end


return (args.dontclose and mw.ustring.gsub(tostring(root), "</table>", "") or tostring(root)) .. categories
return rootdiv .. categories
end
end


Línea 553: Línea 635:
})
})
return SeriesOverview.new(frame, args)
return SeriesOverview.new(frame, args)
end
function p._end(frame)
return SeriesOverview.endtable()
end
end


return p
return p
Usuario anónimo
Las cookies nos ayudan a ofrecer nuestros servicios. Al utilizar nuestros servicios, aceptas nuestro uso de cookies.

Menú de navegación