diff --git a/js/client-chat.js b/js/client-chat.js index 9cc92edcd..a141053de 100644 --- a/js/client-chat.js +++ b/js/client-chat.js @@ -607,18 +607,35 @@ case 'rating': case 'ladder': if (!target) target = app.user.get('userid'); + + var targets = target.split(','); + var formatTargeting = false; + var formats = {}; + for (var i = 1, len = targets.length; i < len; i++) { + formats[toId(targets[i])] = 1; + formatTargeting = true; + } + var self = this; - $.get(app.user.getActionPHP() + '?act=ladderget&user='+encodeURIComponent(target), Tools.safeJSON(function(data) { + $.get(app.user.getActionPHP() + '?act=ladderget&user='+encodeURIComponent(targets[0]), Tools.safeJSON(function(data) { try { var buffer = '
'; - buffer += ''; + buffer += ''; if (!data.length) { buffer += ''; } else { buffer += ''; - for (var i=0; i'; + } else { + buffer += ''; + hiddenFormats.push(row.formatid); + } + buffer += ''; } } + if (hiddenFormats.length) { + if (hiddenFormats.length === formatLength) { + buffer += ''; + } + + buffer += ''; + } buffer += '
User: '+target+'
User: '+targets[0]+'
This user has not played any ladder games yet.
FormatEloGXEGlicko-1COILWLT
'+Math.round(row.acre)+''+Math.round(row.gxe,1)+''; + if (!formatTargeting || formats[row.formatid]) { + buffer += '
This user has not played any ladder games that match the format targeting.
'; self.add('|raw|'+buffer); } catch(e) {} @@ -751,6 +775,20 @@ var name = data.name || this.challengeData.userid; if (/^[a-z0-9]/i.test(name)) name = ' ' + name; app.rooms[''].challenge(name, this.challengeData.format, this.challengeData.team); + }, + + showOtherFormats: function (d, target) { + var autoscroll = (this.$chatFrame.scrollTop() + 60 >= this.$chat.height() - this.$chatFrame.height()); + + var $target = $(target); + var $table = $target.closest('table'); + $table.find('tr.hidden').show(); + $table.find('tr.no-matches').remove(); + $target.closest('tr').remove(); + + if (autoscroll) { + this.$chatFrame.scrollTop(this.$chat.height()); + } } }); diff --git a/style/client.css b/style/client.css index 8f31dfa31..5743d4c81 100644 --- a/style/client.css +++ b/style/client.css @@ -828,6 +828,10 @@ p.or:after { color: gray; } +.hidden { + display: none; +} + .roomlist { text-align: left; }