Skip to content

Commit 05ca742

Browse files
committed
Main menu: Add a button to the partner selection input for partner formats
1 parent f55efed commit 05ca742

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

play.pokemonshowdown.com/js/client-mainmenu.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
'click .spoiler': 'clickSpoiler',
2121
'click button.formatselect': 'selectFormat',
2222
'click button.teamselect': 'selectTeam',
23-
'keyup input': 'selectTeammate'
23+
'click button[name=partnersubmit]': 'selectTeammate'
2424
},
2525
initialize: function () {
2626
this.$el.addClass('scrollable');
@@ -45,7 +45,8 @@
4545
buf += '<p><label class="label">Format:</label>' + this.renderFormats() + '</p>';
4646
buf += '<p><label class="label">Team:</label>' + this.renderTeams() + '</p>';
4747
buf += '<p><label class="label" name="partner" style="display:none">';
48-
buf += 'Partner: <input name="teammate" /></label></p>';
48+
buf += 'Partner:<br />';
49+
buf += '<input class="partnerselect" /><button name="partnersubmit">Invite</button></label></p>';
4950
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>';
5051
buf += '<p><button class="button mainmenu1 big" name="search"><strong>Battle!</strong><br /><small>Find a random opponent</small></button></p></form></div>';
5152
}
@@ -283,11 +284,13 @@
283284
},
284285

285286
selectTeammate: function (e) {
286-
if (e.currentTarget.name !== 'teammate' || e.keyCode !== 13) return;
287-
var partner = toID(e.currentTarget.value);
287+
e.stopPropagation();
288+
e.preventDefault();
289+
var input = $('input.partnerselect').get(0);
290+
var partner = toID(input.value);
288291
if (!partner.length) return;
289292
app.send('/requestpartner ' + partner + ',' + this.curFormat);
290-
e.currentTarget.value = '';
293+
input.value = "";
291294
},
292295

293296
openPM: function (name, dontFocus) {

0 commit comments

Comments
 (0)