From 88fbafb64bf195e6b44b6eace4e7c9e5fe697d81 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Mon, 7 Mar 2016 16:06:45 -0500 Subject: [PATCH] Refresh Watch Battle when clicking Watch Battle If Watch Battle is open, trying to open it again will refresh it in addition to focusing it. Previously, it would only refresh if it's been over 60 seconds since the previous refresh. --- js/client-rooms.js | 4 ++++ js/client.js | 1 + 2 files changed, 5 insertions(+) diff --git a/js/client-rooms.js b/js/client-rooms.js index 52242b7ad..d1f319b7a 100644 --- a/js/client-rooms.js +++ b/js/client-rooms.js @@ -157,6 +157,10 @@ this.$('button[name=refresh]').focus(); this.$el.scrollTop(prevPos); }, + rejoin: function () { + app.send('/cmd roomlist'); + this.lastUpdate = new Date().getTime(); + }, update: function (data) { if (!data && !this.data) { if (app.isDisconnected) { diff --git a/js/client.js b/js/client.js index 8d0e1ac15..36833ba7b 100644 --- a/js/client.js +++ b/js/client.js @@ -1169,6 +1169,7 @@ joinRoom: function (id, type, nojoin) { if (this.rooms[id]) { this.focusRoom(id); + if (this.rooms[id].rejoin) this.rooms[id].rejoin(); return this.rooms[id]; } if (id.substr(0, 11) === 'battle-gen5' && !Tools.loadedSpriteData['bw']) Tools.loadSpriteData('bw');