From 11f24766e58f8b161e30497eec01e26c001d36b9 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 24 Sep 2025 14:39:33 -0400 Subject: [PATCH] . --- web/superball.html | 57 ++++++++++++++-------------------------------- 1 file changed, 17 insertions(+), 40 deletions(-) diff --git a/web/superball.html b/web/superball.html index 0d0dc4c..fa93f82 100644 --- a/web/superball.html +++ b/web/superball.html @@ -1128,7 +1128,7 @@ bounceSection.id = `bounce-${bounceId}`; bounceSection.innerHTML = ` -

Bounce ${bounceId} (Kind 22222 Routing Event)

+

Add a bounce (Kind 22222 Routing Event)

- +
@@ -1203,36 +1203,10 @@ // Populate thrower dropdown with discovered throwers populateThrowerDropdown(bounceId); - // Update bounce labels to reflect execution order - updateBounceLabels(); + // Labels are now generic, no need to update numbering } - // Update bounce labels to reflect execution order (newest bounce is Bounce 1, oldest is Bounce N) - function updateBounceLabels() { - // Get all existing bounce sections - const bounceContainer = document.getElementById('bounces-container'); - const bounceSections = bounceContainer.querySelectorAll('.bounce-section'); - - // Update labels in reverse order (newest first gets Bounce 1) - bounceSections.forEach((section, index) => { - const bounceId = section.id.replace('bounce-', ''); - const executionOrder = bounceSections.length - index; // Reverse the index - - // Update the header - const header = document.getElementById(`bounce-${bounceId}-header`); - if (header) { - header.textContent = `Bounce ${executionOrder} (Kind 22222 Routing Event)`; - } - - // Update the create button text - const createBtn = document.getElementById(`create-bounce-btn-${bounceId}`); - if (createBtn) { - createBtn.textContent = `Create Bounce ${executionOrder}`; - } - }); - - console.log('INFO: Updated bounce labels for execution order'); - } + // Bounce labels are now generic - no numbering needed // Update all timeline absolute times continuously function updateAllTimelineTimes() { @@ -1431,8 +1405,7 @@ // Show the Add Bounce button again now that this bounce is completed document.getElementById('add-bounce-btn').classList.remove('hidden'); - // Update bounce labels after creation to reflect execution order - updateBounceLabels(); + // Labels are generic, no update needed } catch (error) { console.log('ERROR', `Failed to create bounce ${bounceId}: ${error.message}`); @@ -1638,11 +1611,12 @@ // Start with user sending the outermost bounce let currentTime = baseTime; - // Work forward through bounces (in order they were created) - bounces.forEach((bounce, index) => { - const bounceNumber = index + 1; - const isFirst = (index === 0); - const isLast = (index === bounces.length - 1); + // Work forward through bounces (in EXECUTION order - reverse of creation order) + const reversedBounces = [...bounces].reverse(); + reversedBounces.forEach((bounce, index) => { + const bounceNumber = bounces.length - index; // Original bounce number + const isFirst = (index === 0); // First in execution (last created) + const isLast = (index === reversedBounces.length - 1); // Last in execution (first created) const throwerName = getThrowerName(bounce, bounceNumber); if (isFirst) { @@ -1763,7 +1737,8 @@ // Helper functions for bounce data extraction function getRelaysForBounce(bounceNumber) { - const bounceIndex = bounceNumber - 1; + // Convert execution order bounce number to array index (reverse lookup) + const bounceIndex = bounces.length - bounceNumber; if (bounceIndex < 0 || bounceIndex >= bounces.length) return []; // Get relays from the bounce's routing instructions @@ -1775,7 +1750,8 @@ } function getDelayForBounce(bounceNumber) { - const bounceIndex = bounceNumber - 1; + // Convert execution order bounce number to array index (reverse lookup) + const bounceIndex = bounces.length - bounceNumber; if (bounceIndex < 0 || bounceIndex >= bounces.length) return 30; const bounce = bounces[bounceIndex]; @@ -1786,7 +1762,8 @@ } function getPaddingAdjustmentForBounce(bounceNumber) { - const bounceIndex = bounceNumber - 1; + // Convert execution order bounce number to array index (reverse lookup) + const bounceIndex = bounces.length - bounceNumber; if (bounceIndex < 0 || bounceIndex >= bounces.length) return 0; const bounce = bounces[bounceIndex];