From 4830b290515ad2805f8a2efd0fcab25b9aef0eed Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Tue, 16 Feb 2016 20:38:27 -0500 Subject: [PATCH] Offline mode: Handle clicking on users/battles Fixes #639 --- js/client-mainmenu.js | 4 ++++ js/client-rooms.js | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/js/client-mainmenu.js b/js/client-mainmenu.js index f5ff037fe..3bd1686d4 100644 --- a/js/client-mainmenu.js +++ b/js/client-mainmenu.js @@ -846,6 +846,10 @@ app.addPopup(CreditsPopup); }, finduser: function () { + if (app.isDisconnected) { + app.addPopupMessage("You are offline."); + return; + } app.addPopupPrompt("Username", "Open", function (target) { if (!target) return; if (toId(target) === 'zarel') { diff --git a/js/client-rooms.js b/js/client-rooms.js index 43b3d2880..c2e563f58 100644 --- a/js/client-rooms.js +++ b/js/client-rooms.js @@ -95,6 +95,10 @@ this.close(); }, finduser: function () { + if (app.isDisconnected) { + app.addPopupMessage("You are offline."); + return; + } app.addPopupPrompt("Username", "Open", function (target) { if (!target) return; if (toId(target) === 'zarel') { @@ -155,7 +159,11 @@ }, update: function (data) { if (!data && !this.data) { - this.$list.html('

Loading...

'); + if (app.isDisconnected) { + this.$list.html('

You are offline.

'); + } else { + this.$list.html('

Loading...

'); + } return; } this.$('button[name=refresh]')[0].disabled = false;