Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circle packer 3.0!! #21

Merged
merged 15 commits into from
Aug 21, 2024
14 changes: 12 additions & 2 deletions src/frontend/dash/circlePacker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,19 @@ export class ClockCircle extends Circle{
document.querySelectorAll('.bustime.west').forEach(timeElems.push);

for(let busSignIndex = 0; busSignIndex < timeElems.length; busSignIndex++) {
let minutesTill = Math.max(0,Math.round((arrivals[busSigns[busSignIndex >> 1]][busSignIndex & 1] - Date.now())/1000/60));
let arrivalsCardinal;
if(busSignIndex < 2)
arrivalsCardinal = arrivals[busSigns[0]];
else
arrivalsCardinal = arrivals[busSigns[1]];
rutmanz marked this conversation as resolved.
Show resolved Hide resolved

let minutesTill = Math.max(0,Math.round((arrivalsCardinal[busSignIndex % 2] - Date.now())/1000/60));

timeElems[0].innerHTML = minutesTill + '&nbsp;min'
timeElems[0].classList[minutesTill <= 5 ? "add" : "remove"]("soonish")
if(minutesTill <= 5)
timeElems[0].classList.add("soonish");
else
timeElems[0].classList.remove("soonish");
}
})();
},
Expand Down
Loading