Skip to content

Commit 7282cdc

Browse files
committed
button to hide system windows
1 parent a101a3c commit 7282cdc

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

index.html

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,36 @@
119119
cursor: not-allowed;
120120
}
121121

122+
.hide-windows-button {
123+
background: #003300;
124+
border: 1px solid #00ff00;
125+
color: #00ff00;
126+
padding: 5px 8px;
127+
font-family: inherit;
128+
font-size: 14px;
129+
cursor: pointer;
130+
transition: all 0.2s;
131+
border-radius: 3px;
132+
margin-left: 5px;
133+
}
134+
135+
.hide-windows-button:hover {
136+
background: #00ff00;
137+
color: #000;
138+
box-shadow: 0 0 5px #00ff00;
139+
}
140+
141+
.hide-windows-button.hidden {
142+
background: #330000;
143+
border-color: #ff6600;
144+
color: #ff9900;
145+
}
146+
147+
.system-window.hidden,
148+
.missing-messages-window.hidden {
149+
display: none !important;
150+
}
151+
122152
.status-group {
123153
display: flex;
124154
flex-direction: column;
@@ -271,6 +301,12 @@
271301
font-size: 12px;
272302
}
273303

304+
.hide-windows-button {
305+
padding: 3px 6px;
306+
font-size: 12px;
307+
margin-left: 3px;
308+
}
309+
274310
.status-group {
275311
align-items: flex-end;
276312
gap: 1px;
@@ -913,6 +949,7 @@
913949
<div class="user-info">
914950
<input type="text" class="nickname-input" placeholder="Enter nickname..." value="">
915951
<button class="notification-button" id="notificationButton" title="Enable notifications">🔔</button>
952+
<button class="hide-windows-button" id="hideWindowsButton" title="Hide/show system windows">SYS</button>
916953
<div class="status-group">
917954
<span class="status connecting" id="status">
918955
Connecting...
@@ -1024,6 +1061,49 @@
10241061
}
10251062
}
10261063

1064+
loadWindowsVisibility() {
1065+
try {
1066+
const isHidden = localStorage.getItem('retro-chat-windows-hidden') === 'true';
1067+
if (isHidden) {
1068+
this.systemWindow.classList.add('hidden');
1069+
this.missingMessagesWindow.classList.add('hidden');
1070+
this.hideWindowsButton.classList.add('hidden');
1071+
this.hideWindowsButton.textContent = '---';
1072+
this.hideWindowsButton.title = 'Show system windows';
1073+
} else {
1074+
this.hideWindowsButton.textContent = 'SYS';
1075+
this.hideWindowsButton.title = 'Hide system windows';
1076+
}
1077+
} catch (error) {
1078+
console.warn('Could not load windows visibility from localStorage:', error);
1079+
}
1080+
}
1081+
1082+
toggleWindowsVisibility() {
1083+
try {
1084+
const isHidden = this.systemWindow.classList.contains('hidden');
1085+
if (isHidden) {
1086+
// Show windows
1087+
this.systemWindow.classList.remove('hidden');
1088+
this.missingMessagesWindow.classList.remove('hidden');
1089+
this.hideWindowsButton.classList.remove('hidden');
1090+
this.hideWindowsButton.textContent = 'SYS';
1091+
this.hideWindowsButton.title = 'Hide system windows';
1092+
localStorage.setItem('retro-chat-windows-hidden', 'false');
1093+
} else {
1094+
// Hide windows
1095+
this.systemWindow.classList.add('hidden');
1096+
this.missingMessagesWindow.classList.add('hidden');
1097+
this.hideWindowsButton.classList.add('hidden');
1098+
this.hideWindowsButton.textContent = '---';
1099+
this.hideWindowsButton.title = 'Show system windows';
1100+
localStorage.setItem('retro-chat-windows-hidden', 'true');
1101+
}
1102+
} catch (error) {
1103+
console.warn('Could not toggle windows visibility:', error);
1104+
}
1105+
}
1106+
10271107
generateRandomNickname() {
10281108
const adjectives = [
10291109
'Cyber', 'Neon', 'Retro', 'Pixel', 'Code', 'Data', 'Hack', 'Tech',
@@ -1060,6 +1140,11 @@
10601140
this.requestNotificationPermission();
10611141
});
10621142

1143+
// Add click handler for hide windows button
1144+
this.hideWindowsButton.addEventListener('click', () => {
1145+
this.toggleWindowsVisibility();
1146+
});
1147+
10631148
// Check if we're in a PWA context
10641149
const isPWA = window.matchMedia('(display-mode: standalone)').matches ||
10651150
window.navigator.standalone === true;
@@ -1299,6 +1384,12 @@
12991384
// Notification button element
13001385
this.notificationButton = document.getElementById('notificationButton');
13011386

1387+
// Hide windows button element
1388+
this.hideWindowsButton = document.getElementById('hideWindowsButton');
1389+
1390+
// Load and apply windows visibility state
1391+
this.loadWindowsVisibility();
1392+
13021393
// Set the generated nickname in the input field
13031394
this.nicknameInput.value = this.nickname;
13041395
}

0 commit comments

Comments
 (0)