Allow for filtering by more than just Elo 1300+

This commit is contained in:
Kirk Scheibelhut
2019-07-03 17:10:27 -07:00
parent c123b0c8b4
commit b09a58dbe9

View File

@@ -118,13 +118,14 @@
title: 'Battles',
isSideRoom: true,
events: {
'change input[name=elofilter]': 'refresh'
'change select[name=elofilter]': 'refresh'
},
initialize: function () {
this.$el.addClass('ps-room-light').addClass('scrollable');
var buf = '<div class="pad"><button class="button" style="float:right;font-size:10pt;margin-top:3px" name="close"><i class="fa fa-times"></i> Close</button><div class="roomlist"><p><button class="button" name="refresh"><i class="fa fa-refresh"></i> Refresh</button> <span style="' + Dex.getPokemonIcon('meloetta-pirouette') + ';display:inline-block;vertical-align:middle" class="picon" title="Meloetta is PS\'s mascot! The Pirouette forme is Fighting-type, and represents our battles."></span></p>';
buf += '<p><label class="label">Format:</label><button class="select formatselect" name="selectFormat">(All formats)</button></p> <label><input type="checkbox" name="elofilter" value="1300" /> Elo 1300+</label>';
buf += '<p><label class="label">Format:</label><button class="select formatselect" name="selectFormat">(All formats)</button></p>';
buf += '<label>Minimum Elo: <select name="elofilter"><option value="1000">1000</option><option value="1200">1200</option><option value="1400">1400</option><option value="1800">1800</option></select></label>';
buf += '<div class="list"><p>Loading...</p></div>';
buf += '</div></div>';
@@ -209,8 +210,8 @@
},
refresh: function () {
var elofilter = '';
var $checkbox = this.$('input[name=elofilter]');
if ($checkbox.is(':checked')) elofilter = ', ' + $checkbox.val();
var elo = this.$('select[name=elofilter]').val();
if (elo !== '1000') elofilter = ', ' + elo;
app.send('/cmd roomlist ' + this.format + elofilter);
this.lastUpdate = new Date().getTime();