Support one-panel mode

This commit is contained in:
Guangcong Luo
2017-06-29 10:13:23 -04:00
parent 1a1c2511b7
commit 9275c04326
2 changed files with 20 additions and 1 deletions

View File

@@ -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 += '<hr />';
buf += '<p><strong>Graphics</strong></p>';
var onePanel = !!Tools.prefs('onepanel');
if ($(window).width() >= 660) {
buf += '<p><label class="optlabel">Layout: <select name="onepanel"><option value=""' + (!onePanel ? ' selected="selected"' : '') + '>&#x25EB; Left and right panels</option><option value="1"' + (onePanel ? ' selected="selected"' : '') + '>&#x25FB; Single panel</option></select></label></p>';
}
buf += '<p><label class="optlabel">Background: <button name="background">Change background</button></label></p>';
buf += '<p><label class="optlabel"><input type="checkbox" name="dark"' + (Tools.prefs('dark') ? ' checked' : '') + ' /> Dark mode (beta)</label></p>';
buf += '<p><label class="optlabel"><input type="checkbox" name="noanim"' + (Tools.prefs('noanim') ? ' checked' : '') + ' /> Disable animations</label></p>';
@@ -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);

View File

@@ -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');