Modulo:TeamBracket: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Moroboshi (discussione | contributi)
fix bold winner
Moroboshi (discussione | contributi)
test customizzazioni stile
Riga 22:
path_top = "border:0 solid black;border-top-width:2px;",
group = "text-align:center",
winner = {'font-weight' , ':bold'},
first_place = {'background-color', ':gold'},
second_place = {'background-color', ':silver'},
third_place = {'background-color', ':#C96'},
row_height = "3px",
buffer_sx_width = "5px",
Riga 79:
self.medals = self.bold_winner and not in_array(self.args['medals'], no_replies)
-- load number of scores for each round
self.scores = {}
local scores_raw = self.args['.scores'] or '1'
local max_scores = 1
for i,score_value in ipairs(mw.text.split(scores_raw, ',')) do
Riga 93:
self.scorename_pattern = self.scorename_pattern .. "-%d"
end
-- custom style
style.winner = self.args.style_medal or style.winner
style.first_place = self.args.style_first_place or style.first_place
style.second_place = self.args.style_second_place or style.second_place
style.third_place = self.args.style_third_place or style.third_place
style.header = self.args.style_header or style.header
style.header_third_place = self.args.style_header_third_place or style.header_third_place
-- set default seeds for round 1
if not(self.hideSeeds) then
Line 126 ⟶ 133:
return tostring(self.tbl)
end
 
 
--[[ ===============================================================================
Line 297 ⟶ 303:
if self.not_draw_top then seedCell:css('border-top-width', '0' ) end
if self.bold_winner and (winner == pos) then
seedCell:csscssText(style.winner[1], style.winner[2])
end
end
Line 310 ⟶ 316:
end
if self.bold_winner and winner == pos then
teamCell:csscssText(style.winner[1], style.winner[2])
end
if self.current_round == self.rounds and winner ~= 0 and self.medals then
if winner == pos then
if team_number < 3 then
teamCell:csscssText(style.first_place[1], style.first_place[2])
else
teamCell:csscssText(style.third_place[1], style.third_place[2])
end
elseif team_number < 3 then
teamCell:csscssText(style.second_place[1], style.second_place[2])
end
end
Line 332 ⟶ 338:
:newline()
if self.not_draw_top then scoreCell:css('border-top-width', '0') end
if score_results[i] == pos then scoreCell:csscssText(style.winner[1], style.winner[2]) end
end
self.not_draw_top = (self.current_round == 1) and (not self.not_draw_top)
Line 342 ⟶ 348:
end
 
--[[ ===============================================================================
function TeamBracket:renderMatch(match_number, row_base)
Gestisce un match
-- match_number: il numero del match contando dall'alto (1, 2, 3, ...)
-- row_base: la prima riga della tabella in cui disegnare il batch
===============================================================================]]
 
function TeamBracket:renderMatch(match_number, row_base)
-- ottiene i nomi dei team del match, verifica che non siano bye e setta self.not_draw_top
-- per registrare se si deve disegnare o meno la riga superiore del match
-- ritorna i nomi dei team e se è un bye (true) o no (false)
local function getTeams(team_number1, team_number2)
local team_name1 = self:getTeamArg(self.current_round, 'team', team_number1)
Line 390 ⟶ 405:
return row_base
end
 
--[[ ===============================================================================
Traccia la finale pr il terzo posto
--row: riga in cui iniziare a disegnare la finale
===============================================================================]]
 
function TeamBracket:render_final_3(row)
Line 531 ⟶ 551:
end
end
 
 
 
function p.teamBracket(frame)