diff --git a/js/client-teambuilder.js b/js/client-teambuilder.js index aab974d85..3a9735e3e 100644 --- a/js/client-teambuilder.js +++ b/js/client-teambuilder.js @@ -323,7 +323,7 @@ buf += ''; return buf; } - buf += '
'; + buf += '
'; buf += '
'; buf += ''; buf += '
'; @@ -569,12 +569,48 @@ }); }, - // copy/move/delete + // copy/import/export/move/delete copySet: function(i, button) { i = +($(button).closest('li').attr('value')); this.clipboardAdd($.extend(true, {}, this.curTeam.team[i])); button.blur(); }, + wasViewingPokemon: false, + importSet: function(i, button) { + i = +($(button).closest('li').attr('value')); + + this.wasViewingPokemon = true; + if (!this.curSet) { + this.wasViewingPokemon = false; + this.selectPokemon(i); + } + + this.$('li').find('input, button').prop('disabled', true); + this.$chart.hide(); + this.$('.teambuilder-pokemon-import') + .show() + .find('textarea') + .val(TeambuilderRoom.toText([this.curSet]).trim()) + .focus(); + }, + closePokemonImport: function(force) { + if (!this.wasViewingPokemon) return this.back(); + + var $li = this.$('li'); + var i = +($li.attr('value')); + this.$('.teambuilder-pokemon-import').hide(); + this.$chart.show(); + + if (force === true) return this.selectPokemon(i); + $li.find('input, button').prop('disabled', false); + }, + savePokemonImport: function(i) { + i = +(this.$('li').attr('value')); + this.curSet = TeambuilderRoom.parseText(this.$('.pokemonedit').val())[0]; + // since we just destroyed the reference... + this.curTeam.team[i] = this.curSet; + this.closePokemonImport(true); + }, moveSet: function(i, button) { i = +($(button).closest('li').attr('value')); app.addPopup(MovePopup, { @@ -636,6 +672,12 @@ this.chartPrevSearch = '[init]'; buf += '
'; + // import/export + buf += '
'; + buf += '
'; + buf += ''; + buf += '
'; + this.$el.html(buf); this.$chart = this.$('.teambuilder-results'); }, @@ -792,7 +834,7 @@ if (set) { this.curSet = set; this.curSetLoc = i; - var name = this.curChartName; + var name = this.curChartName || 'details'; if (name === 'details' || name === 'stats') { this.update(); this.updateChart(); diff --git a/style/client.css b/style/client.css index c5126b82f..a99597bbe 100644 --- a/style/client.css +++ b/style/client.css @@ -2247,6 +2247,22 @@ div[class^='tournament-message-'], div[class*=' tournament-message-'] { box-shadow: inset 1px 1px 0 rgba(255,255,255,.6), 0px 2px 2px rgba(0,0,0,.15); } +.teambuilder-pokemon-import { + display: none; + position: absolute; + top: 206px; + left: 10px; + padding: 2px; + overflow: hidden; +} + +.pokemonedit { + width: 626px; + text-align: left; + font-size: inherit; + font-family: inherit; +} + .statform { padding: 3px 13px 10px 13px; font-size: 10pt;