Choose default team using teambuilderFormat

Before, 'UU (suspect test)' was treated differently from 'UU' when
choosing the default team in the dropdown. It no longer is.
This commit is contained in:
Guangcong Luo
2015-12-15 20:20:20 -05:00
parent 04246a51fb
commit d2f7327c74

View File

@@ -736,6 +736,10 @@
if (window.BattleFormats[formatid].team) {
return '<button class="select teamselect preselected" name="team" value="random" disabled>' + TeamPopup.renderTeam('random') + '</button>';
}
var format = window.BattleFormats[formatid];
var teamFormat = (format.teambuilderFormat || (format.isTeambuilderFormat ? formatid : false));
var teams = Storage.teams;
if (!teams.length) {
return '<button class="select teamselect" name="team" disabled>You have no teams</button>';
@@ -744,9 +748,9 @@
if (this.curTeamIndex >= 0) {
teamIndex = this.curTeamIndex;
}
if (this.curTeamFormat !== formatid) {
if (this.curTeamFormat !== teamFormat) {
for (var i = 0; i < teams.length; i++) {
if (teams[i].format === formatid) {
if (teams[i].format === teamFormat) {
teamIndex = i;
break;
}