|
20 | 20 | 'click .spoiler': 'clickSpoiler',
|
21 | 21 | 'click button.formatselect': 'selectFormat',
|
22 | 22 | 'click button.teamselect': 'selectTeam',
|
23 |
| - 'keyup input': 'selectTeammate' |
| 23 | + 'click button[name=partnersubmit]': 'selectTeammate' |
24 | 24 | },
|
25 | 25 | initialize: function () {
|
26 | 26 | this.$el.addClass('scrollable');
|
|
45 | 45 | buf += '<p><label class="label">Format:</label>' + this.renderFormats() + '</p>';
|
46 | 46 | buf += '<p><label class="label">Team:</label>' + this.renderTeams() + '</p>';
|
47 | 47 | 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>'; |
49 | 50 | 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>';
|
50 | 51 | buf += '<p><button class="button mainmenu1 big" name="search"><strong>Battle!</strong><br /><small>Find a random opponent</small></button></p></form></div>';
|
51 | 52 | }
|
|
283 | 284 | },
|
284 | 285 |
|
285 | 286 | 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); |
288 | 291 | if (!partner.length) return;
|
289 | 292 | app.send('/requestpartner ' + partner + ',' + this.curFormat);
|
290 |
| - e.currentTarget.value = ''; |
| 293 | + input.value = ""; |
291 | 294 | },
|
292 | 295 |
|
293 | 296 | openPM: function (name, dontFocus) {
|
|
0 commit comments