From 9275c043265e2d8d8d797cfdad47d4e1838e416f Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Thu, 29 Jun 2017 10:13:23 -0400 Subject: [PATCH] Support one-panel mode --- js/client-topbar.js | 10 ++++++++++ js/client.js | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/js/client-topbar.js b/js/client-topbar.js index c41fc33c9..9648c0757 100644 --- a/js/client-topbar.js +++ b/js/client-topbar.js @@ -428,6 +428,7 @@ 'change select[name=bg]': 'setBg', 'change select[name=timestamps-lobby]': 'setTimestampsLobby', 'change select[name=timestamps-pms]': 'setTimestampsPMs', + 'change select[name=onepanel]': 'setOnePanel', 'change input[name=logchat]': 'setLogChat', 'change input[name=selfhighlight]': 'setSelfHighlight', 'click img': 'avatars' @@ -450,6 +451,10 @@ buf += '
'; buf += '

Graphics

'; + var onePanel = !!Tools.prefs('onepanel'); + if ($(window).width() >= 660) { + buf += '

'; + } buf += '

'; buf += '

'; buf += '

'; @@ -537,6 +542,11 @@ background: function (e) { app.addPopup(CustomBackgroundPopup); }, + setOnePanel: function (e) { + app.singlePanelMode = !!e.currentTarget.value; + Tools.prefs('onepanel', !!e.currentTarget.value); + app.updateLayout(); + }, setTimestampsLobby: function (e) { this.timestamps.lobby = e.currentTarget.value; Tools.prefs('timestamps', this.timestamps); diff --git a/js/client.js b/js/client.js index 3a2f9dac4..f03ea9790 100644 --- a/js/client.js +++ b/js/client.js @@ -432,6 +432,11 @@ } } + if (Tools.prefs('onepanel')) { + self.singlePanelMode = true; + self.updateLayout(); + } + if (Tools.prefs('bwgfx') || Tools.prefs('noanim')) { // since xy data is loaded by default, only call // loadSpriteData if we want bw sprites or if we need bw @@ -1464,8 +1469,12 @@ // If we don't have any right rooms at all, just show the left // room in full. Home is a left room, so we'll always have a // left room. - if (!this.sideRoom) { + if (!this.sideRoom || this.singlePanelMode) { this.curRoom.show('full'); + if (this.curSideRoom) { + this.curSideRoom.hide(); + this.curSideRoom = null; + } if (this.curRoom.id === '') { if ($(window).width() < this.curRoom.bestWidth) { this.curRoom.$el.addClass('tiny-layout');