mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-05-05 21:16:26 -05:00
Import/export on a per Pokemon basis
This commit is contained in:
parent
89b15073ab
commit
154c50d1be
|
|
@ -323,7 +323,7 @@
|
|||
buf += '</li>';
|
||||
return buf;
|
||||
}
|
||||
buf += '<div class="setmenu"><button name="copySet"><i class="icon-copy"></i>Copy</button> <button name="moveSet"><i class="icon-move"></i>Move</button> <button name="deleteSet"><i class="icon-trash"></i>Delete</button></div>';
|
||||
buf += '<div class="setmenu"><button name="copySet"><i class="icon-copy"></i>Copy</button> <button name="importSet"><i class="icon-upload-alt"></i>Import/Export</button> <button name="moveSet"><i class="icon-move"></i>Move</button> <button name="deleteSet"><i class="icon-trash"></i>Delete</button></div>';
|
||||
buf += '<div class="setchart-nickname">';
|
||||
buf += '<label>Nickname</label><input type="text" value="'+Tools.escapeHTML(set.name||set.species)+'" name="nickname" />';
|
||||
buf += '</div>';
|
||||
|
|
@ -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 += '<div class="teambuilder-results"></div>';
|
||||
|
||||
// import/export
|
||||
buf += '<div class="teambuilder-pokemon-import">';
|
||||
buf += '<div class="pokemonedit-buttons"><button name="closePokemonImport"><i class="icon-chevron-left"></i> Back</button> <button name="savePokemonImport"><i class="icon-save"></i> Save</button></div>';
|
||||
buf += '<textarea class="pokemonedit textbox" rows="14"></textarea>';
|
||||
buf += '</div>';
|
||||
|
||||
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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user