From 152f9be732e84e8be29a223e29b9f29b762e8bad Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 26 Apr 2026 12:31:55 +0000 Subject: [PATCH 1/3] feat: add anchor links to section headings for easier sharing Agent-Logs-Url: https://github.com/nitrocode/token-deathclock/sessions/7d801f72-9ab0-4d7a-b9e0-25405e22f213 Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com> --- script.js | 44 +++++++++++++++++------------------ src/js/08-static-renders.js | 14 +++++++++++ src/js/21-boot.js | 1 + styles.css | 2 +- styles/base.css | 17 ++++++++++++++ tests/e2e/death-clock.spec.js | 24 +++++++++++++++++++ 6 files changed, 79 insertions(+), 23 deletions(-) diff --git a/script.js b/script.js index f499b73..74b84a3 100644 --- a/script.js +++ b/script.js @@ -1,5 +1,5 @@ /* AI DEATH CLOCK — browser/DOM layer (minified) */ -"use strict";(function(){const{BASE_TOKENS:Kt,TOKENS_PER_SECOND:O,BASE_DATE_ISO:Gt,HISTORICAL_DATA:Yt,MILESTONES:I,RATE_SCHEDULE:Vt,SESSION_CHALLENGE_DEFS:$o,TOKEN_TIPS:jt,COMPANY_ROLES:ge,AI_AGENTS:pe,formatTokenCount:S,formatTokenCountShort:_,getTriggeredMilestones:Jt,getNextMilestone:zt,predictMilestoneDate:Re,calculateEnvironmentalImpact:A,generateProjectionData:Qt,formatDate:Pe,getTimeDelta:Oe,milestoneProgress:he,getRateAtDate:L,calculateTipImpact:Xt,generateEquivalences:Ne,calculatePersonalFootprint:He,sessionEquivalences:Zt,getNextMilestoneForPlayer:We,computeComboMultiplier:en,getSessionChallenges:tn,formatDoomPoints:X,computePassiveRate:fe,getCompanyStage:nn,getSimulatedViewerCount:on}=window.DeathClockCore,{SITE_VERSION:ye="",CHANGELOG_RELEASES:Ee=[]}=typeof window!="undefined"&&window.ChangelogData||{},{PROJECT_PR_COUNT:Ue=0,PROJECT_TOTAL_TOKENS:qe=0}=typeof window!="undefined"&&window.ProjectStatsData||{},sn=new Date(Gt).getTime(),x=Date.now();let be="dark",B=null;const Ke="tokenDeathclockFirstArrival",Ge="tokenDeathclockTheme";let Z=x;try{const e=parseInt(localStorage.getItem(Ke)||"0",10);e>0&&e<=x?Z=e:localStorage.setItem(Ke,String(x))}catch(e){}function $(){const e=(Date.now()-sn)/1e3;return Kt+O*e}function an(e){return e>=1e15?(e/1e15).toFixed(3)+" Quadrillion":e>=1e12?(e/1e12).toFixed(3)+" Trillion":S(e)}function Ye(e){document.documentElement.setAttribute("data-theme",e);const t=document.getElementById("themeToggle");t&&(t.textContent=e==="dark"?"\u2600\uFE0F":"\u{1F319}"),be=e,B&&mn()}function rn(){const e=be==="dark"?"light":"dark";Ye(e);try{localStorage.setItem(Ge,e)}catch(t){}e==="light"&&k("optimist")}function Ve(){const e=Date.now(),t=$(),n=L(new Date(e)),o=Math.round((e-Z)/1e3*n),s=Math.floor((e-Z)/1e3),i=document.getElementById("totalCounter"),r=document.getElementById("sessionCounter"),c=document.getElementById("sessionTime"),d=document.getElementById("rateCounter"),m=document.getElementById("rateEvent");if(i&&(i.textContent=an(t)),r&&(r.textContent=S(o)),c){const g=Math.floor(s/60),f=s%60,p=Z!==x?"since first visit":"on page";c.textContent=g>0?`${g}m ${f}s ${p}`:`${f}s ${p}`}if(d&&(d.textContent=S(n)),m){const g=[...Vt].reverse().find(f=>e>=new Date(f.date).getTime());g&&(m.textContent=g.event+" \xB7 tokens/sec")}const h=A(t);ee("statKwh",_(h.kWh)),ee("statCo2",_(h.co2Kg)),ee("statWater",_(h.waterL)),ee("statTrees",_(h.treesEquivalent)),Ft(t);const b=Jt(t,I);I.forEach((g,f)=>{const p=document.getElementById("milestone-"+g.id);if(!p)return;const T=p.classList.contains("triggered");t>=g.tokens&&!T&&(p.classList.add("triggered"),$t.has(g.id)||($t.add(g.id),yo(g)));const D=p.querySelector(".progress-fill");if(D){const y=f===0?0:I[f-1].tokens,v=he(t,y,g.tokens);D.style.width=v+"%";const C=p.querySelector(".progress-pct");C&&(C.textContent=v.toFixed(1)+"%")}}),requestAnimationFrame(Ve)}function ee(e,t){const n=document.getElementById(e);n&&(n.textContent=t)}function cn(){const e=document.getElementById("milestonesGrid");if(!e)return;const t=$();e.innerHTML="",I.forEach((n,o)=>{const s=t>=n.tokens,i=o===0?0:I[o-1].tokens,r=he(t,i,n.tokens),c=Re(t,O,n.tokens),d=document.createElement("div");d.className="milestone-card"+(s?" triggered":""),d.id="milestone-"+n.id,d.innerHTML=` +"use strict";(function(){const{BASE_TOKENS:Kt,TOKENS_PER_SECOND:O,BASE_DATE_ISO:Gt,HISTORICAL_DATA:Yt,MILESTONES:I,RATE_SCHEDULE:Vt,SESSION_CHALLENGE_DEFS:_o,TOKEN_TIPS:jt,COMPANY_ROLES:ge,AI_AGENTS:pe,formatTokenCount:S,formatTokenCountShort:_,getTriggeredMilestones:Jt,getNextMilestone:zt,predictMilestoneDate:Re,calculateEnvironmentalImpact:A,generateProjectionData:Qt,formatDate:Pe,getTimeDelta:Oe,milestoneProgress:he,getRateAtDate:L,calculateTipImpact:Xt,generateEquivalences:Ne,calculatePersonalFootprint:He,sessionEquivalences:Zt,getNextMilestoneForPlayer:We,computeComboMultiplier:en,getSessionChallenges:tn,formatDoomPoints:X,computePassiveRate:fe,getCompanyStage:nn,getSimulatedViewerCount:on}=window.DeathClockCore,{SITE_VERSION:ye="",CHANGELOG_RELEASES:Ee=[]}=typeof window!="undefined"&&window.ChangelogData||{},{PROJECT_PR_COUNT:Ue=0,PROJECT_TOTAL_TOKENS:qe=0}=typeof window!="undefined"&&window.ProjectStatsData||{},sn=new Date(Gt).getTime(),x=Date.now();let be="dark",B=null;const Ke="tokenDeathclockFirstArrival",Ge="tokenDeathclockTheme";let Z=x;try{const e=parseInt(localStorage.getItem(Ke)||"0",10);e>0&&e<=x?Z=e:localStorage.setItem(Ke,String(x))}catch(e){}function $(){const e=(Date.now()-sn)/1e3;return Kt+O*e}function an(e){return e>=1e15?(e/1e15).toFixed(3)+" Quadrillion":e>=1e12?(e/1e12).toFixed(3)+" Trillion":S(e)}function Ye(e){document.documentElement.setAttribute("data-theme",e);const t=document.getElementById("themeToggle");t&&(t.textContent=e==="dark"?"\u2600\uFE0F":"\u{1F319}"),be=e,B&&mn()}function rn(){const e=be==="dark"?"light":"dark";Ye(e);try{localStorage.setItem(Ge,e)}catch(t){}e==="light"&&k("optimist")}function Ve(){const e=Date.now(),t=$(),n=L(new Date(e)),o=Math.round((e-Z)/1e3*n),s=Math.floor((e-Z)/1e3),i=document.getElementById("totalCounter"),r=document.getElementById("sessionCounter"),c=document.getElementById("sessionTime"),d=document.getElementById("rateCounter"),m=document.getElementById("rateEvent");if(i&&(i.textContent=an(t)),r&&(r.textContent=S(o)),c){const g=Math.floor(s/60),f=s%60,p=Z!==x?"since first visit":"on page";c.textContent=g>0?`${g}m ${f}s ${p}`:`${f}s ${p}`}if(d&&(d.textContent=S(n)),m){const g=[...Vt].reverse().find(f=>e>=new Date(f.date).getTime());g&&(m.textContent=g.event+" \xB7 tokens/sec")}const h=A(t);ee("statKwh",_(h.kWh)),ee("statCo2",_(h.co2Kg)),ee("statWater",_(h.waterL)),ee("statTrees",_(h.treesEquivalent)),Ft(t);const b=Jt(t,I);I.forEach((g,f)=>{const p=document.getElementById("milestone-"+g.id);if(!p)return;const C=p.classList.contains("triggered");t>=g.tokens&&!C&&(p.classList.add("triggered"),$t.has(g.id)||($t.add(g.id),Eo(g)));const D=p.querySelector(".progress-fill");if(D){const y=f===0?0:I[f-1].tokens,v=he(t,y,g.tokens);D.style.width=v+"%";const T=p.querySelector(".progress-pct");T&&(T.textContent=v.toFixed(1)+"%")}}),requestAnimationFrame(Ve)}function ee(e,t){const n=document.getElementById(e);n&&(n.textContent=t)}function cn(){const e=document.getElementById("milestonesGrid");if(!e)return;const t=$();e.innerHTML="",I.forEach((n,o)=>{const s=t>=n.tokens,i=o===0?0:I[o-1].tokens,r=he(t,i,n.tokens),c=Re(t,O,n.tokens),d=document.createElement("div");d.className="milestone-card"+(s?" triggered":""),d.id="milestone-"+n.id,d.innerHTML=`
@@ -37,17 +37,17 @@ aria-label="${(n-q).toLocaleString()} more days"> +${Math.round((n-q)/365)}y
`),d+="
",e.innerHTML=d,document.getElementById("lb-info").textContent=`${n.toLocaleString()} days until extinction \xB7 predicted ${c}`}function hn(e,t,n){const o=N(t,n),s=t===0;let i='
';for(let c=0;c<24;c++){const d=o+c*36e5,m=s?ke(d,36e5,n):"future",h=`${String(c).padStart(2,"0")}:00`,b=`${String(c).padStart(2,"0")}`;if(m==="dying"){const g=(n-d)/36e5*100;i+=te(`data-hour="${c}"`,g,h,b)}else i+=ne(m,`data-hour="${c}"`,h,b)}i+="
",e.innerHTML=i;const r=t===0?"Today":`Day +${t}`;document.getElementById("lb-info").textContent=`${r} \u2014 select an hour`}function fn(e,t,n,o){const i=N(t,o)+n*36e5,r=t===0&&o>=i&&o${String(d).padStart(2,"0")}`;if(h==="dying"){const f=(o-m)/6e4*100;c+=te(`data-minute="${d}"`,f,b,g)}else c+=ne(h,`data-minute="${d}"`,b,g)}c+="",e.innerHTML=c,document.getElementById("lb-info").textContent=`${String(n).padStart(2,"0")}:xx \u2014 select a minute`}function yn(e,t,n,o,s){const r=N(t,s)+n*36e5+o*6e4,c=t===0&&s>=r&&s${String(m).padStart(2,"0")}`;if(b==="dying"){const p=(s-h)/1e3*100;d+=te(`data-second="${m}"`,p,g,f)}else d+=ne(b,`data-second="${m}"`,g,f)}d+="",e.innerHTML=d,document.getElementById("lb-info").textContent=`${String(n).padStart(2,"0")}:${String(o).padStart(2,"0")}:xx`}function En(){const e=document.getElementById("lb-breadcrumb");if(!e)return;const t=[{label:"\u{1F480} Days",level:"days"}];l.level!=="days"&&t.push({label:`Day ${l.day===0?"Today":"+"+l.day}`,level:"hours"}),(l.level==="minutes"||l.level==="seconds")&&t.push({label:`Hour ${String(l.hour).padStart(2,"0")}`,level:"minutes"}),l.level==="seconds"&&t.push({label:`Min ${String(l.minute).padStart(2,"0")}`,level:"seconds"}),e.innerHTML=t.map((n,o)=>o===t.length-1?`${u(n.label)}`:`${u(n.label)} - `).join(""),e.querySelectorAll("[data-nav]").forEach(n=>{const o=n.getAttribute("data-nav");n.addEventListener("click",()=>ze(o)),n.addEventListener("keydown",s=>{(s.key==="Enter"||s.key===" ")&&ze(o)})})}function ze(e){l.level=e,e==="days"?(l.day=null,l.hour=null,l.minute=null):e==="hours"?(l.hour=null,l.minute=null):e==="minutes"&&(l.minute=null),K()}function K(){const e=document.getElementById("lb-container");if(!e)return;const t=Date.now(),n=new Date(t);l.lastSec=n.getSeconds(),l.lastMin=n.getMinutes(),l.lastHr=n.getHours(),l.lastDayMs=F(n),l.exploding=!1,l.level==="days"?pn(e,t):l.level==="hours"?hn(e,l.day,t):l.level==="minutes"?fn(e,l.day,l.hour,t):l.level==="seconds"&&yn(e,l.day,l.hour,l.minute,t),En(),bn(e)}function bn(e){e.querySelectorAll(".lb-block:not(.lb-dead)").forEach(t=>{t.addEventListener("click",Qe),t.addEventListener("keydown",n=>{(n.key==="Enter"||n.key===" ")&&Qe.call(t,n)})})}function Qe(e){const t=e.currentTarget||this;if(l.level==="days")l.day=parseInt(t.getAttribute("data-day"),10),l.level="hours";else if(l.level==="hours")l.hour=parseInt(t.getAttribute("data-hour"),10),l.level="minutes";else if(l.level==="minutes")l.minute=parseInt(t.getAttribute("data-minute"),10),l.level="seconds";else return;K()}function vn(e){if(l.exploding){e();return}const t=document.querySelector("#lb-container .lb-dying");if(!t){e();return}l.exploding=!0,t.classList.add("lb-exploding"),setTimeout(e,560)}function Xe(){const e=Date.now(),t=new Date(e);if(!l.exploding){const h=document.querySelector("#lb-container .lb-dying");if(h){let b,g;if(l.level==="days")b=F(t),g=864e5;else if(l.level==="hours"){const p=t.getHours();b=N(l.day,e)+p*36e5,g=36e5}else if(l.level==="minutes"){const p=t.getMinutes();b=N(l.day,e)+l.hour*36e5+p*6e4,g=6e4}else{const p=t.getSeconds();b=N(l.day,e)+l.hour*36e5+l.minute*6e4+p*1e3,g=1e3}const f=Math.min(100,(e-b)/g*100);h.style.setProperty("--progress",f.toFixed(2)+"%")}}const n=t.getSeconds(),o=t.getMinutes(),s=t.getHours(),i=F(t),r=l.level==="seconds"&&n!==l.lastSec,c=l.level==="minutes"&&o!==l.lastMin,d=l.level==="hours"&&s!==l.lastHr,m=l.level==="days"&&i!==l.lastDayMs;(r||c||d||m)&&!l.exploding&&(l.lastSec=n,l.lastMin=o,l.lastHr=s,l.lastDayMs=i,vn(()=>K())),l.rafId=requestAnimationFrame(Xe)}function kn(){K(),l.rafId=requestAnimationFrame(Xe),wn()}const Sn={seconds:"sec",minutes:"min",hours:"hr",days:"day",months:"month",years:"year"},E={rafId:null,active:!1,initialized:!1,lastSec:-1,lastMin:-1,lastHr:-1,lastDay:-1,lastMonth:-1,lastYear:-1,pendingCascade:!1,exploding:{sec:!1,min:!1,hr:!1,day:!1,month:!1,year:!1}};function Ze(e,t,n){const o=new Date(n),s=o.getFullYear(),i=o.getMonth(),r=o.getDate(),c=o.getHours(),d=o.getMinutes(),m=o.getSeconds(),h={years:"YEARS",months:"MONTHS",days:"DAYS",hours:"HOURS",minutes:"MINS",seconds:"SECS"},b=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];let g,f,p,T=null,w;switch(t){case"seconds":g=60,f=m,p=(n-Math.floor(n/1e3)*1e3)/1e3*100,w=y=>yy{const v=String(y).padStart(2,"0")+":00";return y{const C=v+1;return v{const me=b[C];return C30&&(T=`+${C-30}y`),w=Lo=>{const Q=v+Lo;return Q