|
261 | 261 | 100% { opacity: 0; } |
262 | 262 | } |
263 | 263 |
|
| 264 | + /* blinking "connection lost" icon next to the OK indicator (replaces the conlost toast) */ |
| 265 | + #connLost { |
| 266 | + display: none; |
| 267 | + color: var(--cp-magenta); |
| 268 | + font-size: .95rem; |
| 269 | + margin-right: 12px; |
| 270 | + text-shadow: 0 0 10px rgba(255, 42, 109, .8); |
| 271 | + } |
| 272 | + |
| 273 | + #connLost.show { |
| 274 | + display: inline; |
| 275 | + animation: conn-blink 1s steps(1) infinite; |
| 276 | + } |
| 277 | + |
| 278 | + @keyframes conn-blink { |
| 279 | + 0%, 49% { opacity: 1; } |
| 280 | + 50%, 100% { opacity: .15; } |
| 281 | + } |
| 282 | + |
264 | 283 | /* ---------- dropdown menu ---------- */ |
265 | 284 | .dropdown-menu { |
266 | 285 | background: var(--cp-panel); |
|
1148 | 1167 | <span id="navbar-heading" data-i18n="title"></span> |
1149 | 1168 | </a> |
1150 | 1169 | <div class="collapse navbar-collapse justify-content-end"> |
| 1170 | + <span class="navbar-text" id="connLost" data-i18n="[title]toast.conlost"><i class="fas fa-link-slash"></i></span> |
1151 | 1171 | <span class="navbar-text" id="actionOk" aria-hidden="true"><i class="fas fa-check"></i> OK</span> |
1152 | 1172 | <span class="navbar-text" id="batteryIndicator" data-visible="false"> |
1153 | 1173 | <i class="fas fa-battery-three-quarters" id="batteryIcon"></i><span id="batteryLevel"></span> |
@@ -3486,6 +3506,9 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5> |
3486 | 3506 | } function connect() { |
3487 | 3507 | socket = new WebSocket("ws://" + host + "/ws"); |
3488 | 3508 | socket.onopen = function () { |
| 3509 | + // connection (re)established -> hide the "connection lost" indicator |
| 3510 | + var connLostEl = document.getElementById('connLost'); |
| 3511 | + if (connLostEl) connLostEl.classList.remove('show'); |
3489 | 3512 | clearInterval(pingInterval); |
3490 | 3513 | clearInterval(getTrackProgressInterval); |
3491 | 3514 | pingInterval = setInterval(ping, 3000); |
@@ -4115,12 +4138,17 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5> |
4115 | 4138 | var myJSON = JSON.stringify(myObj); |
4116 | 4139 | socket.send(myJSON); |
4117 | 4140 | tm = setTimeout(function () { |
4118 | | - toaster.warning(i18next.t("toast.conlost")); |
| 4141 | + // no pong within 5s -> show the blinking "connection lost" icon (was a toast) |
| 4142 | + var el = document.getElementById('connLost'); |
| 4143 | + if (el) el.classList.add('show'); |
4119 | 4144 | }, 5000); |
4120 | 4145 | } |
4121 | 4146 |
|
4122 | 4147 | function pong() { |
4123 | 4148 | clearTimeout(tm); |
| 4149 | + // pong received -> connection is alive again, hide the indicator |
| 4150 | + var el = document.getElementById('connLost'); |
| 4151 | + if (el) el.classList.remove('show'); |
4124 | 4152 | } |
4125 | 4153 | async function getTrackProgress() { |
4126 | 4154 | if (ActiveTab !== 'nav-control-tab') { |
|
0 commit comments