diff --git a/js/client-mainmenu.js b/js/client-mainmenu.js index 353d2918b7..85a52c091b 100644 --- a/js/client-mainmenu.js +++ b/js/client-mainmenu.js @@ -896,6 +896,8 @@ buf += '
' + this.renderFormats(format) + '
'; buf += '' + this.renderTeams(format) + '
'; buf += ''; + buf += '' : '>'); + buf += '
'; buf += ' '; $challenge.html(buf); }, @@ -935,6 +937,14 @@ var format = $pmWindow.find('button[name=format]').val(); var teamIndex = $pmWindow.find('button[name=team]').val(); var privacy = this.adjustPrivacy($pmWindow.find('input[name=private]').is(':checked')); + + var bestof = $pmWindow.find('input[name=bestof]').is(':checked'); + var hasCustomRules = format.includes('@@@'); + if (bestof) { + format += hasCustomRules ? ', ' : '@@@'; + format += 'Best of = 3'; + } + var team = null; if (Storage.teams[teamIndex]) team = Storage.teams[teamIndex]; @@ -1272,6 +1282,18 @@ app.rooms[''].curTeamIndex = -1; var $teamButton = this.sourceEl.closest('form').find('button[name=team]'); if ($teamButton.length) $teamButton.replaceWith(app.rooms[''].renderTeams(format)); + + var $bestOfCheckbox = this.sourceEl.closest('form').find('input[name=bestof]'); + if ($bestOfCheckbox) { + var $parentTag = $bestOfCheckbox.parent().parent(); + if (format.includes('vgc')) { + $parentTag.removeClass('hidden'); + } else { + $parentTag.addClass('hidden'); + $bestOfCheckbox.prop('checked', false); + } + } + var $partnerLabels = $('label[name=partner]'); $partnerLabels.each(function (i, label) { label.style.display = BattleFormats[format].partner ? '' : 'none';