Add all thing to the code

something
This commit is contained in:
2026-04-12 21:42:48 +02:00
commit 408acdc23b
12 changed files with 1304 additions and 0 deletions

87
www/js/ClockFrontEnd.js Normal file
View File

@@ -0,0 +1,87 @@
let white = document.getElementById("white_button");
let black = document.getElementById("black_button");
let white_time = document.getElementById("TimeWhite")
let black_time = document.getElementById("TimeBlack")
let black_move_left = document.getElementById("MoveLeftBlack")
let white_move_left = document.getElementById("MoveLeftWhite")
let BlockType = document.getElementById("BlockType")
let BlockTime = document.getElementById("BlockTime")
let trais = true
function msToMinSec(ms) {
const totalSeconds = Math.floor(ms / 1000);
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
}
function toggle_trais(){
trais = !trais
if (trais){
showGlowRight()
}else{
showGlowLeft()
}
}
function change_move_left_white(number){
white_move_left.innerText = `Coup restant Blanc : ${number}`
}
function change_move_left_black(number){
black_move_left.innerText = `Coup restant Noire : ${number}`
}
function change_time_block(Time){
BlockTime.innerText = `temps restant Block : ${msToMinSec(Time)}`
}
function set_block_type(type){
// true = +
// false = -
if (type){
BlockType.innerText = "Block +"
}else{
BlockType.innerText = "Block -"
}
}
function change_time_white(Time){
white_time.innerText = msToMinSec(Time)
}
function change_time_black(Time){
black_time.innerText = msToMinSec(Time)
}
white.addEventListener("pointerdown", () => {
if (!trais) white.classList.add("click");
if (!has_start) start()
else white_touch()
});
white.addEventListener("pointerup", () => {
white.classList.remove("click");
});
black.addEventListener("pointerdown", () => {
if (trais )black.classList.add("click");
black_touch()
});
black.addEventListener("pointerup", () => {
black.classList.remove("click");
});
function showGlowLeft() {
document.body.classList.remove("glow-right");
document.body.classList.add("glow-left");
}
function showGlowRight() {
document.body.classList.remove("glow-left");
document.body.classList.add("glow-right");
}
function hideGlow() {
document.body.classList.remove("glow-left", "glow-right");
}