diff --git a/wwwroot/js/catalog-price-check.js b/src/PowderCoating.Web/wwwroot/js/catalog-price-check.js similarity index 91% rename from wwwroot/js/catalog-price-check.js rename to src/PowderCoating.Web/wwwroot/js/catalog-price-check.js index de62a8b..af9bcb9 100644 --- a/wwwroot/js/catalog-price-check.js +++ b/src/PowderCoating.Web/wwwroot/js/catalog-price-check.js @@ -53,7 +53,7 @@ // Animate progress: fast to ~85%, then slow crawl toward 99%. // Uses two easing phases so it never "finishes" before the server responds. var start = Date.now(); - var phase1End = totalSecs * 0.80 * 1000; // 80% of time → 85% progress + var phase1End = totalSecs * 0.80 * 1000; // 80% of time -> 85% progress var raf; function tick() { @@ -61,11 +61,11 @@ var pct; if (elapsed < phase1End) { - // Phase 1: ease-out from 0 → 85 + // Phase 1: ease-out from 0 -> 85 var t = elapsed / phase1End; pct = 85 * (1 - Math.pow(1 - t, 2)); } else { - // Phase 2: slow crawl 85 → 99 (never quite reaches 99) + // Phase 2: slow crawl 85 -> 99 (never quite reaches 99) var t2 = (elapsed - phase1End) / (totalSecs * 1000); pct = 85 + 14 * (1 - Math.exp(-t2 * 1.5)); } @@ -76,8 +76,8 @@ raf = requestAnimationFrame(tick); - // Safety: if the server takes much longer than estimated, keep the overlay up. - // The page navigation itself will tear it down. + // The page navigation itself tears down the overlay; cancel the RAF to avoid + // running after the page is gone. window.addEventListener('pagehide', function () { cancelAnimationFrame(raf); });