|
47 | 47 | color: white; |
48 | 48 | border-radius: 0px 5px 5px 0px; |
49 | 49 | } |
| 50 | + #command-input:focus { |
| 51 | + outline: none; |
| 52 | + } |
| 53 | + |
| 54 | + /* FLOATING CONNECT BUTTON IN THE CENTER */ |
50 | 55 | #connect-button { |
51 | | - padding: 10px 20px; |
52 | | - font-size: 16px; |
| 56 | + position: absolute; |
| 57 | + /* Center in viewport */ |
| 58 | + top: 50%; |
| 59 | + left: 50%; |
| 60 | + transform: translate(-50%, -50%); |
| 61 | + z-index: 9999; |
| 62 | + |
| 63 | + /* Larger styling */ |
| 64 | + padding: 20px 40px; |
| 65 | + font-size: 20px; |
| 66 | + |
53 | 67 | background-color: #555; |
54 | 68 | color: white; |
55 | 69 | border: none; |
56 | 70 | cursor: pointer; |
57 | | - margin-left: 10px; |
58 | | - animation: pulse 1s infinite alternate; |
59 | 71 | border-radius: 5px; |
| 72 | + |
| 73 | + /* Keep the original pulsing effect */ |
| 74 | + animation: pulse 1s infinite alternate; |
60 | 75 | } |
61 | 76 | #connect-button:disabled { |
62 | 77 | color: #888; |
|
76 | 91 | } |
77 | 92 | } |
78 | 93 |
|
79 | | - #command-input:focus { |
80 | | - outline: none; |
81 | | - } |
82 | | - |
83 | 94 | /* Sound icon in top-right corner */ |
84 | 95 | #menu-icon { |
85 | 96 | position: absolute; |
|
147 | 158 | transform: scale(1.2); |
148 | 159 | cursor: pointer; |
149 | 160 | } |
| 161 | + |
150 | 162 | </style> |
151 | 163 |
|
152 | 164 | <link rel="stylesheet" href="/static/public/css/xterm.css" /> |
@@ -176,9 +188,12 @@ <h3>Volume Controls</h3> |
176 | 188 | <div id="main-container"> |
177 | 189 | <div id="terminal"></div> |
178 | 190 | </div> |
| 191 | + |
| 192 | + <!-- CONNECT BUTTON FLOATED IN CENTER --> |
| 193 | + <button id="connect-button">Connect</button> |
| 194 | + |
179 | 195 | <div id="input-area"> |
180 | 196 | <input type="text" id="command-input" placeholder="Enter command..."> |
181 | | - <button id="connect-button">Connect</button> |
182 | 197 | </div> |
183 | 198 |
|
184 | 199 | <script> |
@@ -289,6 +304,11 @@ <h3>Volume Controls</h3> |
289 | 304 | socket.onopen = function() { |
290 | 305 | term.writeln("Connected to the server!"); |
291 | 306 | term.clear(); |
| 307 | + |
| 308 | + // Hide the button when connected |
| 309 | + connectButton.style.display = 'none'; |
| 310 | + |
| 311 | + // We also disable it right away to prevent double-click confusion |
292 | 312 | connectButton.disabled = true; |
293 | 313 | textInput.focus(); |
294 | 314 | }; |
@@ -393,7 +413,10 @@ <h3>Volume Controls</h3> |
393 | 413 | } else { |
394 | 414 | term.writeln("Connection died"); |
395 | 415 | } |
| 416 | + // Show the button again when disconnected |
| 417 | + connectButton.style.display = 'block'; |
396 | 418 | connectButton.disabled = false; |
| 419 | + |
397 | 420 | if (textInput.type === "password") { |
398 | 421 | textInput.value = ''; |
399 | 422 | textInput.type = "text"; |
|
0 commit comments