|
119 | 119 | cursor: not-allowed; |
120 | 120 | } |
121 | 121 |
|
| 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 | + |
122 | 152 | .status-group { |
123 | 153 | display: flex; |
124 | 154 | flex-direction: column; |
|
271 | 301 | font-size: 12px; |
272 | 302 | } |
273 | 303 |
|
| 304 | + .hide-windows-button { |
| 305 | + padding: 3px 6px; |
| 306 | + font-size: 12px; |
| 307 | + margin-left: 3px; |
| 308 | + } |
| 309 | + |
274 | 310 | .status-group { |
275 | 311 | align-items: flex-end; |
276 | 312 | gap: 1px; |
|
913 | 949 | <div class="user-info"> |
914 | 950 | <input type="text" class="nickname-input" placeholder="Enter nickname..." value=""> |
915 | 951 | <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> |
916 | 953 | <div class="status-group"> |
917 | 954 | <span class="status connecting" id="status"> |
918 | 955 | Connecting... |
|
1024 | 1061 | } |
1025 | 1062 | } |
1026 | 1063 |
|
| 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 | + |
1027 | 1107 | generateRandomNickname() { |
1028 | 1108 | const adjectives = [ |
1029 | 1109 | 'Cyber', 'Neon', 'Retro', 'Pixel', 'Code', 'Data', 'Hack', 'Tech', |
|
1060 | 1140 | this.requestNotificationPermission(); |
1061 | 1141 | }); |
1062 | 1142 |
|
| 1143 | + // Add click handler for hide windows button |
| 1144 | + this.hideWindowsButton.addEventListener('click', () => { |
| 1145 | + this.toggleWindowsVisibility(); |
| 1146 | + }); |
| 1147 | + |
1063 | 1148 | // Check if we're in a PWA context |
1064 | 1149 | const isPWA = window.matchMedia('(display-mode: standalone)').matches || |
1065 | 1150 | window.navigator.standalone === true; |
|
1299 | 1384 | // Notification button element |
1300 | 1385 | this.notificationButton = document.getElementById('notificationButton'); |
1301 | 1386 |
|
| 1387 | + // Hide windows button element |
| 1388 | + this.hideWindowsButton = document.getElementById('hideWindowsButton'); |
| 1389 | + |
| 1390 | + // Load and apply windows visibility state |
| 1391 | + this.loadWindowsVisibility(); |
| 1392 | + |
1302 | 1393 | // Set the generated nickname in the input field |
1303 | 1394 | this.nicknameInput.value = this.nickname; |
1304 | 1395 | } |
|
0 commit comments