Edit the documentation or categories for this module.
local util_args = require("Module:ArgsUtil")
local util_cargo = require("Module:CargoUtil")
local util_esports = require("Module:EsportsUtil")
local util_vars = require("Module:VarsUtil")
local TabVariables = require('Module:TabVariables')
local p = {}
function p.div(parent, class, wikitext, extra)
local div = parent:tag('div'):addClass('sb-' .. class):wikitext(wikitext)
if extra then
div:addClass('sb-' .. class .. '-' .. extra)
end
return div
end
p.TOGGLES = {
one = {
show_attr = '.sb-w%s-g%s',
hide_attr = '.sb-showbutton-w%s-g%s',
show_class = 'sb-allw sb-w%s-allg sb-w%s-g%s',
hide_class = 'sb-showbutton-allw sb-showbutton-w%s-allg sb-showbutton-w%s-g%s',
},
tab = {
show_attr = '.sb-w%s-allg',
hide_attr = '.sb-showbutton-w%s-allg',
show_class = 'sb-allw sb-w%s-allg',
hide_class = 'sb-showbutton-allw sb-showbutton-w%s-allg',
cssclass = 'expand-contract-button-no-margin',
},
all = {
show_attr = '.sb-allw',
hide_attr = '.sb-showbutton-allw',
show_class = 'sb-allw',
hide_class = 'sb-showbutton-allw',
show_text = 'Show Entire Page',
hide_text = 'Hide Entire Page',
},
row = 'sb-allw sb-w%s-allg sb-w%s-g%s toggle-section-hidden'
}
function p.resetScore(team)
util_vars.setVar(('sb_score_%s'):format(team), 0)
end
function p.incrementScore(team)
local currentScore = util_vars.getVar(('sb_score_%s'):format(team))
util_vars.setVar(('sb_score_%s'):format(team), currentScore + 1)
end
function p.getScore(team)
return util_vars.getVar(('sb_score_%s'):format(team))
end
function p.getTabName()
return util_vars.getVar('sbTabName') or TabVariables.getName() or 'Unknown Tab'
end
function p.getCounterCargo()
if util_vars.getGlobalIndex('sb_N_GameInMatch') ~= 1 then return nil end
return {
_table = 'ScoreboardCounters',
OverviewPage = util_esports.getOverviewPage(),
Tab = p.getTabName(),
N_ScoreboardPage = TabVariables.getIndex(),
N_MatchInPage = util_vars.getGlobalIndex('sb_N_MatchInPage'),
}
end
function p.storeCounterCargo(args)
if not args then args = {} end
if util_args.castAsBool(args.nocargo) then return end
local counterCargo = p.getCounterCargo()
if counterCargo then util_cargo.store(counterCargo) end
end
return p