Skip to content

Commit

Permalink
Main menu: Add a button to the partner selection input for partner fo…
Browse files Browse the repository at this point in the history
…rmats
  • Loading branch information
mia-pi-git committed May 2, 2024
1 parent f55efed commit 05ca742
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions play.pokemonshowdown.com/js/client-mainmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'click .spoiler': 'clickSpoiler',
'click button.formatselect': 'selectFormat',
'click button.teamselect': 'selectTeam',
'keyup input': 'selectTeammate'
'click button[name=partnersubmit]': 'selectTeammate'
},
initialize: function () {
this.$el.addClass('scrollable');
Expand All @@ -45,7 +45,8 @@
buf += '<p><label class="label">Format:</label>' + this.renderFormats() + '</p>';
buf += '<p><label class="label">Team:</label>' + this.renderTeams() + '</p>';
buf += '<p><label class="label" name="partner" style="display:none">';
buf += 'Partner: <input name="teammate" /></label></p>';
buf += 'Partner:<br />';
buf += '<input class="partnerselect" /><button name="partnersubmit">Invite</button></label></p>';
buf += '<p><label class="checkbox"><input type="checkbox" name="private" ' + (Storage.prefs('disallowspectators') ? 'checked' : '') + ' /> <abbr title="You can still invite spectators by giving them the URL or using the /invite command">Don\'t allow spectators</abbr></label></p>';
buf += '<p><button class="button mainmenu1 big" name="search"><strong>Battle!</strong><br /><small>Find a random opponent</small></button></p></form></div>';
}
Expand Down Expand Up @@ -283,11 +284,13 @@
},

selectTeammate: function (e) {
if (e.currentTarget.name !== 'teammate' || e.keyCode !== 13) return;
var partner = toID(e.currentTarget.value);
e.stopPropagation();
e.preventDefault();
var input = $('input.partnerselect').get(0);
var partner = toID(input.value);
if (!partner.length) return;
app.send('/requestpartner ' + partner + ',' + this.curFormat);
e.currentTarget.value = '';
input.value = "";
},

openPM: function (name, dontFocus) {
Expand Down

0 comments on commit 05ca742

Please sign in to comment.