sorted the title updates

This commit is contained in:
Joe 2025-04-15 04:35:56 +01:00
parent 17f1cbfa9b
commit c6c659535e
2 changed files with 16 additions and 12 deletions

View File

@ -12,19 +12,21 @@ export class Conductor {
return this.instruments; return this.instruments;
} }
setTitle() { static setTitle() {
const now = new Date(); const now = new Date();
const future = new Date(now.getTime() + 59 * 1000); // 59 seconds later const future = new Date(now.getTime() + 59 * 1000); // 59 seconds later
const formattedDate = `${this.padZero(now.getDate())}.${this.padZero( const formattedDate = `${Conductor.padZero(
now.getMonth() + 1 now.getDate()
)}.${now.getFullYear()}`; )}.${Conductor.padZero(now.getMonth() + 1)}.${now.getFullYear()}`;
const formattedTime = `${this.padZero(now.getHours())}:${this.padZero( const formattedTime = `${Conductor.padZero(
now.getMinutes() now.getHours()
)}:${this.padZero(now.getSeconds())}`; )}:${Conductor.padZero(now.getMinutes())}:${this.padZero(
const formattedFutureTime = `${this.padZero( now.getSeconds()
)}`;
const formattedFutureTime = `${Conductor.padZero(
future.getHours() future.getHours()
)}:${this.padZero(future.getMinutes())}:${this.padZero( )}:${Conductor.padZero(future.getMinutes())}:${Conductor.padZero(
future.getSeconds() future.getSeconds()
)}`; )}`;
@ -32,7 +34,7 @@ export class Conductor {
} }
showMainContent() { showMainContent() {
this.setTitle(); Conductor.setTitle();
const mute = document.getElementById("mute"); const mute = document.getElementById("mute");
mute.addEventListener("click", () => { mute.addEventListener("click", () => {
@ -80,7 +82,7 @@ export class Conductor {
inny.style.opacity = "1"; inny.style.opacity = "1";
} }
padZero(num) { static padZero(num) {
return num.toString().padStart(2, "0"); return num.toString().padStart(2, "0");
} }

View File

@ -1,3 +1,5 @@
import { Conductor } from "./conductor";
export class Renderer { export class Renderer {
timeIndicator; timeIndicator;
currStaveNumber; currStaveNumber;
@ -76,7 +78,7 @@ export class Renderer {
this.currStaveNumber = 1; this.currStaveNumber = 1;
// Assuming setTitle() exists globally or is handled elsewhere // Assuming setTitle() exists globally or is handled elsewhere
setTitle(); Conductor.setTitle();
if (reload) location.reload(); if (reload) location.reload();
} }