mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-08-29 08:38:20 +00:00
fix: pause button crash killed WS handler registration
getElementById('pktPauseBtn') was null because button is rendered by
loadPackets() which runs async. Crash at line 218 prevented wsHandler
from being registered at line 260. Moved to data-action event delegation
which works regardless of render timing.
This commit is contained in:
+1
-1
@@ -84,7 +84,7 @@
|
||||
<script src="hop-resolver.js?v=1774126708"></script>
|
||||
<script src="app.js?v=1774126708"></script>
|
||||
<script src="home.js?v=1774042199"></script>
|
||||
<script src="packets.js?v=1774154561"></script>
|
||||
<script src="packets.js?v=1774154704"></script>
|
||||
<script src="map.js?v=1774126708" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="channels.js?v=1774331200" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="nodes.js?v=1774126708" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
|
||||
+10
-11
@@ -213,16 +213,15 @@
|
||||
if (!btn) return;
|
||||
if (btn.dataset.action === 'pkt-refresh') loadPackets();
|
||||
else if (btn.dataset.action === 'pkt-byop') showBYOP();
|
||||
});
|
||||
|
||||
document.getElementById('pktPauseBtn').addEventListener('click', function() {
|
||||
packetsPaused = !packetsPaused;
|
||||
this.textContent = packetsPaused ? '▶' : '⏸';
|
||||
this.title = packetsPaused ? 'Resume live updates' : 'Pause live updates';
|
||||
this.classList.toggle('active', packetsPaused);
|
||||
if (!packetsPaused && pauseBuffer.length) {
|
||||
pauseBuffer.forEach(msg => wsHandler(msg));
|
||||
pauseBuffer = [];
|
||||
else if (btn.dataset.action === 'pkt-pause') {
|
||||
packetsPaused = !packetsPaused;
|
||||
btn.textContent = packetsPaused ? '▶' : '⏸';
|
||||
btn.title = packetsPaused ? 'Resume live updates' : 'Pause live updates';
|
||||
btn.classList.toggle('active', packetsPaused);
|
||||
if (!packetsPaused && pauseBuffer.length) {
|
||||
pauseBuffer.forEach(msg => wsHandler(msg));
|
||||
pauseBuffer = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -456,7 +455,7 @@
|
||||
<h2>Latest Packets <span class="count">(${totalCount})</span></h2>
|
||||
<div>
|
||||
<button class="btn-icon" data-action="pkt-refresh" title="Refresh">🔄</button>
|
||||
<button class="btn-icon" id="pktPauseBtn" title="Pause live updates">⏸</button>
|
||||
<button class="btn-icon" id="pktPauseBtn" data-action="pkt-pause" title="Pause live updates">⏸</button>
|
||||
<button class="btn-icon" data-action="pkt-byop" title="Bring Your Own Packet" aria-label="Bring Your Own Packet - paste raw packet hex for analysis" aria-haspopup="dialog">📦 BYOP</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user