APmanageur Wi-Fi V1.0
This commit is contained in:
1 parent
f78e380236
commit
2b33e31589
4 files changed
+423
-119
No files matched your search
+52
-25
@@ -601,17 +601,31 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Boutons de sélection de jeu Easter Egg */
|
/* Boutons de sélection de jeu Easter Egg */
|
||||||
.game-switch-btn.active {
|
button.game-switch-btn,
|
||||||
background: var(--blue) !important;
|
.game-switch-btn {
|
||||||
color: var(--blue-text, #071326) !important;
|
background: var(--panel2) !important;
|
||||||
|
color: var(--text) !important;
|
||||||
|
border: 1px solid var(--line) !important;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.15s ease !important;
|
||||||
|
}
|
||||||
|
button.game-switch-btn:hover,
|
||||||
|
.game-switch-btn:hover {
|
||||||
border-color: var(--blue) !important;
|
border-color: var(--blue) !important;
|
||||||
|
color: var(--blue) !important;
|
||||||
|
}
|
||||||
|
html[data-theme] button.game-switch-btn.active,
|
||||||
|
html button.game-switch-btn.active,
|
||||||
|
button.game-switch-btn.active,
|
||||||
|
.game-switch-btn.active {
|
||||||
|
background: var(--blue, #007aff) !important;
|
||||||
|
color: #ffffff !important;
|
||||||
|
border-color: var(--blue, #007aff) !important;
|
||||||
|
box-shadow: 0 0 14px rgba(92, 167, 255, 0.45) !important;
|
||||||
font-weight: 700 !important;
|
font-weight: 700 !important;
|
||||||
}
|
}
|
||||||
html[data-theme="light"] .game-switch-btn.active,
|
html[data-theme] button.game-switch-btn.active span,
|
||||||
html[data-theme="winxp"] .game-switch-btn.active,
|
button.game-switch-btn.active span {
|
||||||
html[data-theme="macos"][data-macos-mode="light"] .game-switch-btn.active,
|
|
||||||
html[data-theme="macos"]:not([data-macos-mode="dark"]) .game-switch-btn.active {
|
|
||||||
background: var(--blue) !important;
|
|
||||||
color: #ffffff !important;
|
color: #ffffff !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6275,14 +6289,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="display:flex;align-items:center;gap:6px;flex-wrap:wrap">
|
<div style="display:flex;align-items:center;gap:6px;flex-wrap:wrap">
|
||||||
<button type="button" id="btnEggGame_tetris" class="secondary game-switch-btn active" onclick="switchEasterEggGame('tetris')" style="padding:5px 12px;font-size:12px;border-radius:6px;display:inline-flex;align-items:center;gap:4px">🧱 <span>Tetris</span></button>
|
<button type="button" id="btnEggGame_tetris" class="game-switch-btn active" onclick="switchEasterEggGame('tetris')" style="padding:5px 12px;font-size:12px;border-radius:6px;display:inline-flex;align-items:center;gap:4px">🧱 <span>Tetris</span></button>
|
||||||
<button type="button" id="btnEggGame_dino" class="secondary game-switch-btn" onclick="switchEasterEggGame('dino')" style="padding:5px 12px;font-size:12px;border-radius:6px;display:inline-flex;align-items:center;gap:4px">🦖 <span>Dino T-Rex</span></button>
|
<button type="button" id="btnEggGame_dino" class="game-switch-btn" onclick="switchEasterEggGame('dino')" style="padding:5px 12px;font-size:12px;border-radius:6px;display:inline-flex;align-items:center;gap:4px">🦖 <span>Dino T-Rex</span></button>
|
||||||
<button type="button" id="btnEggGame_zipline" class="secondary game-switch-btn" onclick="switchEasterEggGame('zipline')" style="padding:5px 12px;font-size:12px;border-radius:6px;display:inline-flex;align-items:center;gap:4px">⚡ <span>Zip (LinkedIn)</span></button>
|
<button type="button" id="btnEggGame_zipline" class="game-switch-btn" onclick="switchEasterEggGame('zipline')" style="padding:5px 12px;font-size:12px;border-radius:6px;display:inline-flex;align-items:center;gap:4px">⚡ <span>Zip (LinkedIn)</span></button>
|
||||||
<button type="button" class="secondary" style="padding:4px 10px;font-size:16px;margin-left:4px" onclick="closeEasterEggModal()" title="Fermer (Échap)">✕</button>
|
<button type="button" class="secondary" style="padding:4px 10px;font-size:16px;margin-left:4px" onclick="closeEasterEggModal()" title="Fermer (Échap)">✕</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body" style="padding:0;flex:1;background:#071326;display:flex;justify-content:center;align-items:center;min-height:560px">
|
<div class="modal-body" style="padding:0;flex:1;background:var(--bg,#071326);display:flex;justify-content:center;align-items:center;min-height:640px">
|
||||||
<iframe id="easterEggGameIframe" src="" style="width:100%;height:580px;border:0;display:block" title="Easter Egg Game" allow="autoplay"></iframe>
|
<iframe id="easterEggGameIframe" src="" style="width:100%;height:640px;border:0;display:block" title="Easter Egg Game" allow="autoplay"></iframe>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -9123,12 +9137,6 @@ ${vpnBadgeTopo}
|
|||||||
const pct = qBytes > 0 ? Math.min(100, Math.round((usageBytes / qBytes) * 100)) : 0;
|
const pct = qBytes > 0 ? Math.min(100, Math.round((usageBytes / qBytes) * 100)) : 0;
|
||||||
const remaining = Math.max(0, qBytes - usageBytes);
|
const remaining = Math.max(0, qBytes - usageBytes);
|
||||||
|
|
||||||
if ($('quotaExceededBadge')) $('quotaExceededBadge').style.display = exceeded ? 'inline-block' : 'none';
|
|
||||||
|
|
||||||
if ($('quotaUsageLabel')) {
|
|
||||||
$('quotaUsageLabel').textContent = `${usageStr} / ${formatBytes(qBytes)} (${pct}%)`;
|
|
||||||
$('quotaUsageLabel').style.color = exceeded ? 'var(--red)' : (pct >= 85 ? '#f59e0b' : 'var(--text)');
|
|
||||||
}
|
|
||||||
if ($('quotaUsageBar')) {
|
if ($('quotaUsageBar')) {
|
||||||
$('quotaUsageBar').style.width = `${pct}%`;
|
$('quotaUsageBar').style.width = `${pct}%`;
|
||||||
$('quotaUsageBar').style.background = exceeded ? 'var(--red)' : (pct >= 85 ? '#f59e0b' : 'var(--blue)');
|
$('quotaUsageBar').style.background = exceeded ? 'var(--red)' : (pct >= 85 ? '#f59e0b' : 'var(--blue)');
|
||||||
@@ -14463,13 +14471,29 @@ ${vpnBadgeTopo}
|
|||||||
document.querySelectorAll('.game-switch-btn').forEach(btn => {
|
document.querySelectorAll('.game-switch-btn').forEach(btn => {
|
||||||
const isActive = (btn.id === 'btnEggGame_' + gameName);
|
const isActive = (btn.id === 'btnEggGame_' + gameName);
|
||||||
btn.classList.toggle('active', isActive);
|
btn.classList.toggle('active', isActive);
|
||||||
|
if (isActive) {
|
||||||
|
btn.style.setProperty('background', 'var(--blue)', 'important');
|
||||||
|
btn.style.setProperty('color', '#ffffff', 'important');
|
||||||
|
btn.style.setProperty('border-color', 'var(--blue)', 'important');
|
||||||
|
btn.style.setProperty('box-shadow', '0 0 14px rgba(92,167,255,0.45)', 'important');
|
||||||
|
btn.style.setProperty('font-weight', '700', 'important');
|
||||||
|
} else {
|
||||||
|
btn.style.removeProperty('background');
|
||||||
|
btn.style.removeProperty('color');
|
||||||
|
btn.style.removeProperty('border-color');
|
||||||
|
btn.style.removeProperty('box-shadow');
|
||||||
|
btn.style.removeProperty('font-weight');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const iframe = $('easterEggGameIframe');
|
const iframe = $('easterEggGameIframe');
|
||||||
if (iframe) {
|
if (iframe) {
|
||||||
const activeTheme = document.documentElement.dataset.theme || 'dark';
|
const activeTheme = document.documentElement.dataset.theme || 'dark';
|
||||||
const activeMacosMode = document.documentElement.dataset.macosMode || '';
|
const activeMacosMode = document.documentElement.dataset.macosMode || '';
|
||||||
const themeQuery = '?theme=' + encodeURIComponent(activeTheme) + (activeMacosMode ? '&macosMode=' + encodeURIComponent(activeMacosMode) : '');
|
const activeLang = (typeof currentLanguage !== 'undefined' ? currentLanguage : (document.documentElement.lang || 'fr'));
|
||||||
|
const themeQuery = '?theme=' + encodeURIComponent(activeTheme) +
|
||||||
|
(activeMacosMode ? '&macosMode=' + encodeURIComponent(activeMacosMode) : '') +
|
||||||
|
'&lang=' + encodeURIComponent(activeLang);
|
||||||
iframe.src = '/jeux/' + gameName + '.html' + themeQuery;
|
iframe.src = '/jeux/' + gameName + '.html' + themeQuery;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
try { iframe.focus(); if (iframe.contentWindow) iframe.contentWindow.focus(); } catch (e) { }
|
try { iframe.focus(); if (iframe.contentWindow) iframe.contentWindow.focus(); } catch (e) { }
|
||||||
@@ -14479,14 +14503,17 @@ ${vpnBadgeTopo}
|
|||||||
|
|
||||||
function parseEasterEggGameName(rawVal) {
|
function parseEasterEggGameName(rawVal) {
|
||||||
if (!rawVal || typeof rawVal !== 'string') return null;
|
if (!rawVal || typeof rawVal !== 'string') return null;
|
||||||
const clean = rawVal.trim();
|
const clean = rawVal.trim().toLowerCase();
|
||||||
const m = clean.match(/^jeu\s*:\s*(.*)$/i) || (clean.toLowerCase() === 'jeu' ? ['', 'tetris'] : null);
|
if (clean === 'jeu' || clean === 'game' || clean === 'arcade' || clean === 'easteregg' || clean === 'easter egg') {
|
||||||
|
return 'tetris';
|
||||||
|
}
|
||||||
|
const m = clean.match(/^(?:jeu|game|arcade)\s*:\s*(.*)$/i);
|
||||||
if (!m) return null;
|
if (!m) return null;
|
||||||
let g = (m[1] || 'tetris').trim().toLowerCase();
|
let g = (m[1] || 'tetris').trim().toLowerCase();
|
||||||
if (g === 'dinausore' || g === 'dinosaure' || g === 'trex' || g === 't-rex' || g === 'chrome') return 'dino';
|
if (g === 'dino' || g === 'dinausore' || g === 'dinosaure' || g === 'trex' || g === 't-rex' || g === 'chrome' || g === 'runner') return 'dino';
|
||||||
if (g === 'zip' || g === 'zipline' || g === 'linkedin') return 'zipline';
|
if (g === 'zip' || g === 'zipline' || g === 'linkedin') return 'zipline';
|
||||||
if (g === 'tetris' || g === '') return 'tetris';
|
if (g === 'tetris' || g === 'brique' || g === 'bricks' || g === '') return 'tetris';
|
||||||
return g;
|
return 'tetris';
|
||||||
}
|
}
|
||||||
|
|
||||||
function attachEasterEggTrigger(inputEl) {
|
function attachEasterEggTrigger(inputEl) {
|
||||||
|
|||||||
+87
-20
@@ -267,7 +267,7 @@
|
|||||||
|
|
||||||
<div class="game-card">
|
<div class="game-card">
|
||||||
<div class="header-bar">
|
<div class="header-bar">
|
||||||
<div>🦖 <strong>Chrome T-Rex Runner</strong></div>
|
<div>🦖 <strong id="dinoTitleText">Chrome T-Rex Runner</strong></div>
|
||||||
<div class="scores">
|
<div class="scores">
|
||||||
<span class="hi">HI <span id="hiScore">00000</span></span>
|
<span class="hi">HI <span id="hiScore">00000</span></span>
|
||||||
<span id="currentScore">00000</span>
|
<span id="currentScore">00000</span>
|
||||||
@@ -277,20 +277,20 @@
|
|||||||
<div class="canvas-wrap" id="canvasWrap">
|
<div class="canvas-wrap" id="canvasWrap">
|
||||||
<canvas id="dinoCanvas" width="640" height="220"></canvas>
|
<canvas id="dinoCanvas" width="640" height="220"></canvas>
|
||||||
<div id="gameOverlay" class="overlay-message" style="display:none">
|
<div id="gameOverlay" class="overlay-message" style="display:none">
|
||||||
<h2>G A M E O V E R</h2>
|
<h2 id="dinoGameOverText">G A M E O V E R</h2>
|
||||||
<button class="restart-btn" onclick="resetGame()">🔄 REJOUER (Espace)</button>
|
<button id="dinoRestartBtn" class="restart-btn" onclick="resetGame()">🔄 REJOUER (Espace)</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="controls-hint">
|
<div class="controls-hint" id="dinoControlsHint">
|
||||||
<div><kbd>Espace</kbd> ou <kbd>⬆️</kbd> : Sauter</div>
|
<div id="dinoHintJump"><kbd>Espace</kbd> ou <kbd>⬆️</kbd> : Sauter</div>
|
||||||
<div><kbd>⬇️</kbd> : Se baisser / descente rapide</div>
|
<div id="dinoHintDuck"><kbd>⬇️</kbd> : Se baisser / descente rapide</div>
|
||||||
<div>Toucher l'écran pour sauter</div>
|
<div id="dinoHintTouch">Toucher l'écran pour sauter</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Theme Management
|
// Theme & i18n Management
|
||||||
function setTheme(theme, macosMode) {
|
function setTheme(theme, macosMode) {
|
||||||
if (!theme) theme = 'dark';
|
if (!theme) theme = 'dark';
|
||||||
document.documentElement.dataset.theme = theme;
|
document.documentElement.dataset.theme = theme;
|
||||||
@@ -304,10 +304,51 @@
|
|||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
setTheme(urlParams.get('theme') || 'dark', urlParams.get('macosMode'));
|
setTheme(urlParams.get('theme') || 'dark', urlParams.get('macosMode'));
|
||||||
|
|
||||||
|
// Dictionnaire i18n
|
||||||
|
const I18N_DINO = {
|
||||||
|
fr: {
|
||||||
|
title: "Chrome T-Rex Runner",
|
||||||
|
game_over: "G A M E O V E R",
|
||||||
|
restart_btn: "🔄 REJOUER (Espace)",
|
||||||
|
hint_jump: "<kbd>Espace</kbd> ou <kbd>⬆️</kbd> : Sauter",
|
||||||
|
hint_duck: "<kbd>⬇️</kbd> : Se baisser / descente rapide",
|
||||||
|
hint_touch: "Toucher l'écran pour sauter"
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
title: "Chrome T-Rex Runner",
|
||||||
|
game_over: "G A M E O V E R",
|
||||||
|
restart_btn: "🔄 REPLAY (Space)",
|
||||||
|
hint_jump: "<kbd>Space</kbd> or <kbd>⬆️</kbd>: Jump",
|
||||||
|
hint_duck: "<kbd>⬇️</kbd>: Duck / Fast drop",
|
||||||
|
hint_touch: "Tap screen to jump"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function applyDinoLang(lang) {
|
||||||
|
const l = (lang && (lang.startsWith('en') ? 'en' : 'fr')) || 'fr';
|
||||||
|
const dict = I18N_DINO[l] || I18N_DINO.fr;
|
||||||
|
const tEl = document.getElementById('dinoTitleText');
|
||||||
|
const goEl = document.getElementById('dinoGameOverText');
|
||||||
|
const rbEl = document.getElementById('dinoRestartBtn');
|
||||||
|
const hjEl = document.getElementById('dinoHintJump');
|
||||||
|
const hdEl = document.getElementById('dinoHintDuck');
|
||||||
|
const htEl = document.getElementById('dinoHintTouch');
|
||||||
|
if (tEl) tEl.textContent = dict.title;
|
||||||
|
if (goEl) goEl.innerHTML = dict.game_over;
|
||||||
|
if (rbEl) rbEl.textContent = dict.restart_btn;
|
||||||
|
if (hjEl) hjEl.innerHTML = dict.hint_jump;
|
||||||
|
if (hdEl) hdEl.innerHTML = dict.hint_duck;
|
||||||
|
if (htEl) htEl.textContent = dict.hint_touch;
|
||||||
|
}
|
||||||
|
applyDinoLang(urlParams.get('lang'));
|
||||||
|
|
||||||
window.addEventListener('message', e => {
|
window.addEventListener('message', e => {
|
||||||
if (e.data && e.data.type === 'themeChange') {
|
if (e.data && e.data.type === 'themeChange') {
|
||||||
setTheme(e.data.theme, e.data.macosMode);
|
setTheme(e.data.theme, e.data.macosMode);
|
||||||
}
|
}
|
||||||
|
if (e.data && e.data.type === 'langChange') {
|
||||||
|
applyDinoLang(e.data.lang);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function getThemeProp(name, fallback) {
|
function getThemeProp(name, fallback) {
|
||||||
@@ -367,7 +408,7 @@
|
|||||||
let gameOver = false;
|
let gameOver = false;
|
||||||
let score = 0;
|
let score = 0;
|
||||||
let gameSpeed = 6;
|
let gameSpeed = 6;
|
||||||
let nextObstacleTimer = 0;
|
let nextObstacleTimer = 90; // Période de grâce au lancement
|
||||||
let isNight = false;
|
let isNight = false;
|
||||||
|
|
||||||
// Dinosaur
|
// Dinosaur
|
||||||
@@ -436,6 +477,7 @@
|
|||||||
gameStarted = true;
|
gameStarted = true;
|
||||||
score = 0;
|
score = 0;
|
||||||
gameSpeed = 6;
|
gameSpeed = 6;
|
||||||
|
nextObstacleTimer = 90; // Période de grâce de 1.5s à chaque reprise
|
||||||
obstacles = [];
|
obstacles = [];
|
||||||
dino.y = GROUND_Y - 44;
|
dino.y = GROUND_Y - 44;
|
||||||
dino.vy = 0;
|
dino.vy = 0;
|
||||||
@@ -448,12 +490,35 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function spawnObstacle() {
|
function spawnObstacle() {
|
||||||
const type = (score > 250 && Math.random() < 0.3) ? 'ptero' : 'cactus';
|
// Les ptérodactyles n'apparaissent qu'à partir de 450 points
|
||||||
|
const allowPtero = score > 450;
|
||||||
|
const type = (allowPtero && Math.random() < 0.28) ? 'ptero' : 'cactus';
|
||||||
|
|
||||||
if (type === 'cactus') {
|
if (type === 'cactus') {
|
||||||
const isBig = Math.random() < 0.4;
|
let isBig = false;
|
||||||
const count = isBig ? (Math.random() < 0.5 ? 2 : 1) : Math.floor(Math.random() * 3) + 1;
|
let count = 1;
|
||||||
|
|
||||||
|
// Difficulté progressive équitable
|
||||||
|
if (score < 100) {
|
||||||
|
// Début : 1 seul petit cactus (accessible pour s'échauffer)
|
||||||
|
isBig = false;
|
||||||
|
count = 1;
|
||||||
|
} else if (score < 250) {
|
||||||
|
// 1 cactus petit ou grand
|
||||||
|
isBig = Math.random() < 0.45;
|
||||||
|
count = 1;
|
||||||
|
} else if (score < 450) {
|
||||||
|
// 1 ou 2 cactus
|
||||||
|
isBig = Math.random() < 0.4;
|
||||||
|
count = Math.random() < 0.6 ? 1 : 2;
|
||||||
|
} else {
|
||||||
|
// Vitesse élevée : jusqu'à 3 petits ou 2 grands
|
||||||
|
isBig = Math.random() < 0.45;
|
||||||
|
count = isBig ? (Math.random() < 0.65 ? 1 : 2) : (Math.floor(Math.random() * 3) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
const w = (isBig ? 24 : 16) * count;
|
const w = (isBig ? 24 : 16) * count;
|
||||||
const h = isBig ? 46 : 34;
|
const h = isBig ? 44 : 32;
|
||||||
obstacles.push({
|
obstacles.push({
|
||||||
type: 'cactus',
|
type: 'cactus',
|
||||||
x: canvas.width + 20,
|
x: canvas.width + 20,
|
||||||
@@ -463,8 +528,8 @@
|
|||||||
isBig: isBig
|
isBig: isBig
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Pterodactyl fly height (low, mid, high)
|
// Ptérodactyles : hauteurs adaptées (haut = passer dessous, bas = sauter par dessus)
|
||||||
const heights = [GROUND_Y - 32, GROUND_Y - 55, GROUND_Y - 80];
|
const heights = [GROUND_Y - 32, GROUND_Y - 55, GROUND_Y - 78];
|
||||||
const h = heights[Math.floor(Math.random() * heights.length)];
|
const h = heights[Math.floor(Math.random() * heights.length)];
|
||||||
obstacles.push({
|
obstacles.push({
|
||||||
type: 'ptero',
|
type: 'ptero',
|
||||||
@@ -479,7 +544,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkCollision(r1, r2) {
|
function checkCollision(r1, r2) {
|
||||||
const p = 6;
|
const p = 8; // Marge de tolérance équitable pour les collisions
|
||||||
return (
|
return (
|
||||||
r1.x + p < r2.x + r2.width &&
|
r1.x + p < r2.x + r2.width &&
|
||||||
r1.x + r1.width - p > r2.x &&
|
r1.x + r1.width - p > r2.x &&
|
||||||
@@ -632,12 +697,14 @@
|
|||||||
dino.legTimer = 0;
|
dino.legTimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obstacle timer
|
// Décompte de l'obstacle : 1 frame par itération pour un timing stable
|
||||||
nextObstacleTimer -= gameSpeed;
|
nextObstacleTimer -= 1;
|
||||||
if (nextObstacleTimer <= 0) {
|
if (nextObstacleTimer <= 0) {
|
||||||
spawnObstacle();
|
spawnObstacle();
|
||||||
// Random interval based on speed
|
// Intervalle équitable garantissant au joueur le temps de réatterrir (minimum 50 frames même à pleine vitesse)
|
||||||
nextObstacleTimer = Math.floor(Math.random() * 60) + (100 - Math.min(gameSpeed * 5, 50));
|
const minFrames = Math.max(50, 95 - Math.floor(score / 40));
|
||||||
|
const randomVariance = Math.floor(Math.random() * 45);
|
||||||
|
nextObstacleTimer = minFrames + randomVariance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move obstacles
|
// Move obstacles
|
||||||
|
|||||||
+152
-45
@@ -133,25 +133,36 @@
|
|||||||
.sidebar {
|
.sidebar {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 12px;
|
gap: 8px;
|
||||||
width: 140px;
|
width: 154px;
|
||||||
}
|
}
|
||||||
.panel-box {
|
.panel-box {
|
||||||
background: var(--panel-box);
|
background: var(--panel-box);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 10px;
|
padding: 8px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.panel-box h3 {
|
.stats-box {
|
||||||
font-size: 11px;
|
display: grid;
|
||||||
text-transform: uppercase;
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
letter-spacing: 1px;
|
gap: 2px;
|
||||||
color: var(--muted);
|
padding: 6px 2px;
|
||||||
margin-bottom: 6px;
|
|
||||||
}
|
}
|
||||||
.panel-box .value {
|
.stat-col {
|
||||||
font-size: 20px;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.stat-col h3 {
|
||||||
|
font-size: 10px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
color: var(--muted);
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
.stat-col .value {
|
||||||
|
font-size: 15px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: var(--blue);
|
color: var(--blue);
|
||||||
font-family: "Courier New", Courier, monospace;
|
font-family: "Courier New", Courier, monospace;
|
||||||
@@ -163,14 +174,19 @@
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
.btn-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
.btn {
|
.btn {
|
||||||
background: var(--blue);
|
background: var(--blue);
|
||||||
color: var(--blue-btn-text);
|
color: var(--blue-btn-text);
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 8px 12px;
|
padding: 7px 8px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 13px;
|
font-size: 12px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all .15s ease;
|
transition: all .15s ease;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -184,12 +200,12 @@
|
|||||||
}
|
}
|
||||||
.btn.secondary:hover { opacity: 0.85; }
|
.btn.secondary:hover { opacity: 0.85; }
|
||||||
.controls-help {
|
.controls-help {
|
||||||
font-size: 11px;
|
font-size: 10.5px;
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
line-height: 1.5;
|
line-height: 1.45;
|
||||||
background: rgba(0,0,0,0.12);
|
background: rgba(0,0,0,0.12);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 8px;
|
padding: 6px 8px;
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
}
|
}
|
||||||
.controls-help kbd {
|
.controls-help kbd {
|
||||||
@@ -257,37 +273,41 @@
|
|||||||
<div id="gameOverlay" class="overlay-msg" style="display:none">
|
<div id="gameOverlay" class="overlay-msg" style="display:none">
|
||||||
<h2 id="overlayTitle">GAME OVER</h2>
|
<h2 id="overlayTitle">GAME OVER</h2>
|
||||||
<div id="overlayScore" style="color:var(--blue);font-size:16px;font-weight:700">Score: 0</div>
|
<div id="overlayScore" style="color:var(--blue);font-size:16px;font-weight:700">Score: 0</div>
|
||||||
<button class="btn" style="width:auto;padding:8px 24px" onclick="startGame()">REJOUER</button>
|
<button id="overlayReplayBtn" class="btn" style="width:auto;padding:8px 24px" onclick="startGame()">REJOUER</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<div class="panel-box">
|
<div class="panel-box" style="padding:6px">
|
||||||
<h3>Prochaine</h3>
|
<h3 id="labelNext" style="font-size:10px;margin-bottom:4px">Prochaine</h3>
|
||||||
<canvas id="next" class="preview-canvas" width="80" height="80"></canvas>
|
<canvas id="next" class="preview-canvas" width="80" height="74"></canvas>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-box">
|
<div class="panel-box stats-box">
|
||||||
<h3>Score</h3>
|
<div class="stat-col">
|
||||||
<div id="score" class="value">0</div>
|
<h3 id="labelScore">Score</h3>
|
||||||
|
<div id="score" class="value">0</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat-col" style="border-left:1px solid var(--border);border-right:1px solid var(--border)">
|
||||||
|
<h3 id="labelLines">Lignes</h3>
|
||||||
|
<div id="lines" class="value">0</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat-col">
|
||||||
|
<h3 id="labelLevel">Niveau</h3>
|
||||||
|
<div id="level" class="value">1</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-box">
|
<div class="btn-row">
|
||||||
<h3>Lignes</h3>
|
<button id="pauseBtn" class="btn secondary" style="padding:6px 2px;font-size:11px" onclick="togglePause()">⏸️ Pause</button>
|
||||||
<div id="lines" class="value">0</div>
|
<button id="musicBtn" class="btn secondary" style="padding:6px 2px;font-size:11px" onclick="toggleMusic()">🎵 Son</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-box">
|
<button id="newGameBtn" class="btn" style="padding:7px;font-size:12px" onclick="startGame()">▶ Nouveau</button>
|
||||||
<h3>Niveau</h3>
|
|
||||||
<div id="level" class="value">1</div>
|
|
||||||
</div>
|
|
||||||
<button id="pauseBtn" class="btn secondary" onclick="togglePause()">PAUSE (P)</button>
|
|
||||||
<button id="musicBtn" class="btn secondary" onclick="toggleMusic()">🎵 Musique : ON</button>
|
|
||||||
<button class="btn" onclick="startGame()">NOUVEAU</button>
|
|
||||||
|
|
||||||
<div class="controls-help">
|
<div class="controls-help">
|
||||||
<div><kbd>⬅️</kbd> <kbd>➡️</kbd> : Gauche / Droite</div>
|
<div id="cmdMove"><kbd>⬅️</kbd> <kbd>➡️</kbd> : Gauche / Droite</div>
|
||||||
<div><kbd>⬆️</kbd> : Pivoter</div>
|
<div id="cmdRotate"><kbd>⬆️</kbd> : Pivoter</div>
|
||||||
<div><kbd>⬇️</kbd> : Chute rapide</div>
|
<div id="cmdSoftDrop"><kbd>⬇️</kbd> : Descente rapide</div>
|
||||||
<div><kbd>Espace</kbd> : Drop direct</div>
|
<div id="cmdHardDrop"><kbd>Espace</kbd> : Drop direct</div>
|
||||||
<div><kbd>P</kbd> : Mettre en pause</div>
|
<div id="cmdPause"><kbd>P</kbd> : Mettre en pause</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -301,7 +321,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Theme Management
|
// Theme & i18n Management
|
||||||
function setTheme(theme, macosMode) {
|
function setTheme(theme, macosMode) {
|
||||||
if (!theme) theme = 'dark';
|
if (!theme) theme = 'dark';
|
||||||
document.documentElement.dataset.theme = theme;
|
document.documentElement.dataset.theme = theme;
|
||||||
@@ -316,10 +336,91 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
setTheme(urlParams.get('theme') || 'dark', urlParams.get('macosMode'));
|
||||||
|
|
||||||
|
const I18N_TETRIS = {
|
||||||
|
fr: {
|
||||||
|
next: "Prochaine",
|
||||||
|
score: "Score",
|
||||||
|
lines: "Lignes",
|
||||||
|
level: "Niveau",
|
||||||
|
pause: "⏸️ Pause (P)",
|
||||||
|
resume: "▶️ Reprendre",
|
||||||
|
music_on: "🎵 Musique : ON",
|
||||||
|
music_off: "🔇 Musique : OFF",
|
||||||
|
new_game: "▶ Nouveau",
|
||||||
|
replay: "REJOUER",
|
||||||
|
game_over: "GAME OVER",
|
||||||
|
paused_title: "EN PAUSE",
|
||||||
|
cmd_move: "<kbd>⬅️</kbd> <kbd>➡️</kbd> : Gauche / Droite",
|
||||||
|
cmd_rotate: "<kbd>⬆️</kbd> : Pivoter",
|
||||||
|
cmd_soft_drop: "<kbd>⬇️</kbd> : Descente rapide",
|
||||||
|
cmd_hard_drop: "<kbd>Espace</kbd> : Drop direct",
|
||||||
|
cmd_pause: "<kbd>P</kbd> : Mettre en pause"
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
next: "Next",
|
||||||
|
score: "Score",
|
||||||
|
lines: "Lines",
|
||||||
|
level: "Level",
|
||||||
|
pause: "⏸️ Pause (P)",
|
||||||
|
resume: "▶️ Resume",
|
||||||
|
music_on: "🎵 Music: ON",
|
||||||
|
music_off: "🔇 Music: OFF",
|
||||||
|
new_game: "▶ New Game",
|
||||||
|
replay: "RESTART",
|
||||||
|
game_over: "GAME OVER",
|
||||||
|
paused_title: "PAUSED",
|
||||||
|
cmd_move: "<kbd>⬅️</kbd> <kbd>➡️</kbd>: Left / Right",
|
||||||
|
cmd_rotate: "<kbd>⬆️</kbd>: Rotate",
|
||||||
|
cmd_soft_drop: "<kbd>⬇️</kbd>: Soft drop",
|
||||||
|
cmd_hard_drop: "<kbd>Space</kbd>: Hard drop",
|
||||||
|
cmd_pause: "<kbd>P</kbd>: Pause game"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let currentTetrisLang = 'fr';
|
||||||
|
function applyTetrisLang(lang) {
|
||||||
|
currentTetrisLang = (lang && (lang.startsWith('en') ? 'en' : 'fr')) || 'fr';
|
||||||
|
const dict = I18N_TETRIS[currentTetrisLang] || I18N_TETRIS.fr;
|
||||||
|
const ln = document.getElementById('labelNext');
|
||||||
|
const ls = document.getElementById('labelScore');
|
||||||
|
const ll = document.getElementById('labelLines');
|
||||||
|
const lv = document.getElementById('labelLevel');
|
||||||
|
const pb = document.getElementById('pauseBtn');
|
||||||
|
const mb = document.getElementById('musicBtn');
|
||||||
|
const nb = document.getElementById('newGameBtn');
|
||||||
|
const rb = document.getElementById('overlayReplayBtn');
|
||||||
|
const cm = document.getElementById('cmdMove');
|
||||||
|
const cr = document.getElementById('cmdRotate');
|
||||||
|
const cs = document.getElementById('cmdSoftDrop');
|
||||||
|
const ch = document.getElementById('cmdHardDrop');
|
||||||
|
const cp = document.getElementById('cmdPause');
|
||||||
|
|
||||||
|
if (ln) ln.textContent = dict.next;
|
||||||
|
if (ls) ls.textContent = dict.score;
|
||||||
|
if (ll) ll.textContent = dict.lines;
|
||||||
|
if (lv) lv.textContent = dict.level;
|
||||||
|
if (pb) pb.textContent = (typeof isPaused !== 'undefined' && isPaused) ? dict.resume : dict.pause;
|
||||||
|
if (mb) mb.textContent = (typeof isMusicEnabled !== 'undefined' && !isMusicEnabled) ? dict.music_off : dict.music_on;
|
||||||
|
if (nb) nb.textContent = dict.new_game;
|
||||||
|
if (rb) rb.textContent = dict.replay;
|
||||||
|
if (cm) cm.innerHTML = dict.cmd_move;
|
||||||
|
if (cr) cr.innerHTML = dict.cmd_rotate;
|
||||||
|
if (cs) cs.innerHTML = dict.cmd_soft_drop;
|
||||||
|
if (ch) ch.innerHTML = dict.cmd_hard_drop;
|
||||||
|
if (cp) cp.innerHTML = dict.cmd_pause;
|
||||||
|
}
|
||||||
|
applyTetrisLang(urlParams.get('lang'));
|
||||||
|
|
||||||
window.addEventListener('message', e => {
|
window.addEventListener('message', e => {
|
||||||
if (e.data && e.data.type === 'themeChange') {
|
if (e.data && e.data.type === 'themeChange') {
|
||||||
setTheme(e.data.theme, e.data.macosMode);
|
setTheme(e.data.theme, e.data.macosMode);
|
||||||
}
|
}
|
||||||
|
if (e.data && e.data.type === 'langChange') {
|
||||||
|
applyTetrisLang(e.data.lang);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Audio synthesizer
|
// Audio synthesizer
|
||||||
@@ -473,8 +574,9 @@
|
|||||||
|
|
||||||
function toggleMusic() {
|
function toggleMusic() {
|
||||||
isMusicEnabled = !isMusicEnabled;
|
isMusicEnabled = !isMusicEnabled;
|
||||||
|
const dict = I18N_TETRIS[currentTetrisLang] || I18N_TETRIS.fr;
|
||||||
const btn = document.getElementById('musicBtn');
|
const btn = document.getElementById('musicBtn');
|
||||||
if (btn) btn.textContent = isMusicEnabled ? '🎵 Musique : ON' : '🔇 Musique : OFF';
|
if (btn) btn.textContent = isMusicEnabled ? dict.music_on : dict.music_off;
|
||||||
if (isMusicEnabled) {
|
if (isMusicEnabled) {
|
||||||
if (!isPaused && !isGameOver) scheduleMusic();
|
if (!isPaused && !isGameOver) scheduleMusic();
|
||||||
} else {
|
} else {
|
||||||
@@ -641,9 +743,11 @@
|
|||||||
isGameOver = true;
|
isGameOver = true;
|
||||||
stopMusic();
|
stopMusic();
|
||||||
playSound('gameover');
|
playSound('gameover');
|
||||||
|
const dict = I18N_TETRIS[currentTetrisLang] || I18N_TETRIS.fr;
|
||||||
document.getElementById('gameOverlay').style.display = 'flex';
|
document.getElementById('gameOverlay').style.display = 'flex';
|
||||||
document.getElementById('overlayTitle').textContent = 'GAME OVER';
|
document.getElementById('overlayTitle').textContent = dict.game_over;
|
||||||
document.getElementById('overlayScore').textContent = 'Score final : ' + player.score;
|
document.getElementById('overlayScore').textContent = (currentTetrisLang.startsWith('en') ? 'Final Score: ' : 'Score final : ') + player.score;
|
||||||
|
document.getElementById('overlayReplayBtn').textContent = dict.replay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,13 +831,15 @@
|
|||||||
function togglePause() {
|
function togglePause() {
|
||||||
if (isGameOver) return;
|
if (isGameOver) return;
|
||||||
isPaused = !isPaused;
|
isPaused = !isPaused;
|
||||||
document.getElementById('pauseBtn').textContent = isPaused ? 'REPRENDRE' : 'PAUSE (P)';
|
const dict = I18N_TETRIS[currentTetrisLang] || I18N_TETRIS.fr;
|
||||||
|
document.getElementById('pauseBtn').textContent = isPaused ? dict.resume : dict.pause;
|
||||||
const ov = document.getElementById('gameOverlay');
|
const ov = document.getElementById('gameOverlay');
|
||||||
if (isPaused) {
|
if (isPaused) {
|
||||||
stopMusic();
|
stopMusic();
|
||||||
ov.style.display = 'flex';
|
ov.style.display = 'flex';
|
||||||
document.getElementById('overlayTitle').textContent = 'PAUSE';
|
document.getElementById('overlayTitle').textContent = dict.paused_title;
|
||||||
document.getElementById('overlayScore').textContent = 'Score: ' + player.score;
|
document.getElementById('overlayScore').textContent = 'Score: ' + player.score;
|
||||||
|
document.getElementById('overlayReplayBtn').textContent = dict.replay;
|
||||||
} else {
|
} else {
|
||||||
ov.style.display = 'none';
|
ov.style.display = 'none';
|
||||||
lastTime = performance.now();
|
lastTime = performance.now();
|
||||||
@@ -869,8 +975,9 @@
|
|||||||
dropInterval = 1000;
|
dropInterval = 1000;
|
||||||
isGameOver = false;
|
isGameOver = false;
|
||||||
isPaused = false;
|
isPaused = false;
|
||||||
|
const dict = I18N_TETRIS[currentTetrisLang] || I18N_TETRIS.fr;
|
||||||
document.getElementById('gameOverlay').style.display = 'none';
|
document.getElementById('gameOverlay').style.display = 'none';
|
||||||
document.getElementById('pauseBtn').textContent = 'PAUSE (P)';
|
document.getElementById('pauseBtn').textContent = dict.pause;
|
||||||
updateScore();
|
updateScore();
|
||||||
nextPiece = null;
|
nextPiece = null;
|
||||||
playerReset();
|
playerReset();
|
||||||
|
|||||||
+132
-29
@@ -303,14 +303,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.bottom-actions {
|
.bottom-actions {
|
||||||
display: flex;
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr 1.25fr;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.btn {
|
.btn {
|
||||||
flex: 1;
|
padding: 10px 12px;
|
||||||
padding: 9px 12px;
|
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
@@ -318,16 +318,36 @@
|
|||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
background: var(--panel-box);
|
background: var(--panel-box);
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
transition: all 0.15s ease;
|
transition: all 0.2s ease;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
|
user-select: none;
|
||||||
|
box-shadow: 0 2px 6px rgba(0,0,0,0.15);
|
||||||
|
}
|
||||||
|
.btn:hover {
|
||||||
|
background: var(--cell-hover);
|
||||||
|
border-color: var(--blue);
|
||||||
|
color: var(--blue);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
.btn.btn-action-accent {
|
||||||
|
background: rgba(92, 167, 255, 0.12);
|
||||||
|
border-color: var(--blue);
|
||||||
|
color: var(--blue);
|
||||||
|
font-weight: 700;
|
||||||
|
box-shadow: 0 0 10px rgba(92, 167, 255, 0.2);
|
||||||
|
}
|
||||||
|
.btn.btn-action-accent:hover {
|
||||||
|
background: var(--blue);
|
||||||
|
color: var(--blue-btn-text, #ffffff);
|
||||||
|
box-shadow: 0 0 14px rgba(92, 167, 255, 0.4);
|
||||||
|
transform: translateY(-1px);
|
||||||
}
|
}
|
||||||
.btn:hover { background: var(--cell-hover); border-color: var(--blue); }
|
|
||||||
.btn.primary {
|
.btn.primary {
|
||||||
background: var(--blue);
|
background: var(--blue);
|
||||||
color: var(--blue-btn-text);
|
color: var(--blue-btn-text, #ffffff);
|
||||||
border-color: var(--blue);
|
border-color: var(--blue);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
@@ -335,10 +355,10 @@
|
|||||||
|
|
||||||
.instructions {
|
.instructions {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
font-size: 11px;
|
font-size: 11.5px;
|
||||||
color: #9aa8c5;
|
color: var(--muted);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 1.4;
|
line-height: 1.45;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Win overlay */
|
/* Win overlay */
|
||||||
@@ -372,20 +392,20 @@
|
|||||||
|
|
||||||
<div class="game-container">
|
<div class="game-container">
|
||||||
<div class="top-bar">
|
<div class="top-bar">
|
||||||
<div class="title-badge">⚡ <span>Zip</span> <span style="font-size:11px;color:#9aa8c5;font-weight:normal">(LinkedIn)</span></div>
|
<div class="title-badge">⚡ <span>Zip</span> <span style="font-size:11px;color:var(--muted);font-weight:normal">(LinkedIn)</span></div>
|
||||||
<div class="level-selector">
|
<div class="level-selector">
|
||||||
<select id="levelSelect" onchange="loadSelectedLevel()">
|
<select id="levelSelect" onchange="loadSelectedLevel()">
|
||||||
<option value="1">Niveau 1 (5×5 Facile)</option>
|
<option id="optLevel1" value="1">Niveau 1 (5×5 Facile)</option>
|
||||||
<option value="2">Niveau 2 (5×5 Intermédiaire)</option>
|
<option id="optLevel2" value="2">Niveau 2 (5×5 Intermédiaire)</option>
|
||||||
<option value="3">Niveau 3 (6×6 Expert)</option>
|
<option id="optLevel3" value="3">Niveau 3 (6×6 Expert)</option>
|
||||||
<option value="random">Générateur infini 🎲</option>
|
<option id="optLevelRandom" value="random">Générateur infini 🎲</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="stats-bar">
|
<div class="stats-bar">
|
||||||
<div>Cases : <strong id="cellCount">1 / 25</strong></div>
|
<div><span id="labelCellCount">Cases :</span> <strong id="cellCount">1 / 25</strong></div>
|
||||||
<div>Objectif : <strong id="nextTargetNum">Atteindre le 2</strong></div>
|
<div><span id="labelTarget">Objectif :</span> <strong id="nextTargetNum">Atteindre le 2</strong></div>
|
||||||
<div>⏱️ <strong id="timerDisplay">00:00</strong></div>
|
<div>⏱️ <strong id="timerDisplay">00:00</strong></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -398,26 +418,26 @@
|
|||||||
<div id="gridEl" class="grid"></div>
|
<div id="gridEl" class="grid"></div>
|
||||||
|
|
||||||
<div id="winOverlay" class="win-overlay" style="display:none">
|
<div id="winOverlay" class="win-overlay" style="display:none">
|
||||||
<h2>🎉 FÉLICITATIONS !</h2>
|
<h2 id="winTitle">🎉 FÉLICITATIONS !</h2>
|
||||||
<p style="color:#eef4ff;font-size:14px">Grille entièrement résolue !</p>
|
<p id="winSub" style="color:var(--text);font-size:14px">Grille entièrement résolue !</p>
|
||||||
<p id="winTime" style="color:#5ca7ff;font-size:13px;font-weight:bold"></p>
|
<p id="winTime" style="color:var(--blue);font-size:13px;font-weight:bold"></p>
|
||||||
<button class="btn primary" onclick="nextLevelOrReplay()" style="margin-top:8px;padding:8px 24px">Niveau suivant ➡️</button>
|
<button id="winNextBtn" class="btn primary" onclick="nextLevelOrReplay()" style="margin-top:8px;padding:8px 24px">Niveau suivant ➡️</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bottom-actions">
|
<div class="bottom-actions">
|
||||||
<button class="btn" onclick="undoMove()">↩️ Annuler</button>
|
<button id="btnZipUndo" class="btn" onclick="undoMove()">↩️ Annuler</button>
|
||||||
<button class="btn" onclick="resetCurrentLevel()">🔄 Recommencer</button>
|
<button id="btnZipRestart" class="btn" onclick="resetCurrentLevel()">🔄 Recommencer</button>
|
||||||
<button class="btn primary" onclick="generateRandomLevel()">🎲 Nouveau défi</button>
|
<button id="btnZipChallenge" class="btn btn-action-accent" onclick="generateRandomLevel()">🎲 Nouveau défi</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="instructions">
|
<div id="zipInstructions" class="instructions">
|
||||||
Reliez tous les chiffres dans l'ordre (1 ➔ 2 ➔ 3...) en passant par <strong>TOUTES les cases</strong> de la grille exactement une fois, sans croiser les murs rouges ! (Glissez ou cliquez)
|
Reliez tous les chiffres dans l'ordre (1 ➔ 2 ➔ 3...) en passant par <strong>TOUTES les cases</strong> de la grille exactement une fois, sans croiser les murs rouges ! (Glissez ou cliquez)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Theme Management
|
// Theme & i18n Management
|
||||||
function setTheme(theme, macosMode) {
|
function setTheme(theme, macosMode) {
|
||||||
if (!theme) theme = 'dark';
|
if (!theme) theme = 'dark';
|
||||||
document.documentElement.dataset.theme = theme;
|
document.documentElement.dataset.theme = theme;
|
||||||
@@ -431,10 +451,91 @@
|
|||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
setTheme(urlParams.get('theme') || 'dark', urlParams.get('macosMode'));
|
setTheme(urlParams.get('theme') || 'dark', urlParams.get('macosMode'));
|
||||||
|
|
||||||
|
const I18N_ZIP = {
|
||||||
|
fr: {
|
||||||
|
cell_count: "Cases :",
|
||||||
|
target: "Objectif :",
|
||||||
|
target_reach: "Atteindre le ",
|
||||||
|
target_cover: "Couvrir les {n} case(s) restante(s)",
|
||||||
|
target_done: "Terminé ! 🎉",
|
||||||
|
level_1: "Niveau 1 (5×5 Facile)",
|
||||||
|
level_2: "Niveau 2 (5×5 Intermédiaire)",
|
||||||
|
level_3: "Niveau 3 (6×6 Expert)",
|
||||||
|
level_random: "Générateur infini 🎲",
|
||||||
|
btn_undo: "↩️ Annuler",
|
||||||
|
btn_restart: "🔄 Recommencer",
|
||||||
|
btn_challenge: "🎲 Nouveau défi",
|
||||||
|
win_title: "🎉 FÉLICITATIONS !",
|
||||||
|
win_sub: "Grille entièrement résolue !",
|
||||||
|
win_time: "Temps : ",
|
||||||
|
win_next: "Niveau suivant ➡️",
|
||||||
|
instructions: "Reliez tous les chiffres dans l'ordre (1 ➔ 2 ➔ 3...) en passant par <strong>TOUTES les cases</strong> de la grille exactement une fois, sans croiser les murs rouges ! (Glissez ou cliquez)"
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
cell_count: "Cells:",
|
||||||
|
target: "Goal:",
|
||||||
|
target_reach: "Reach ",
|
||||||
|
target_cover: "Cover {n} remaining cell(s)",
|
||||||
|
target_done: "Completed! 🎉",
|
||||||
|
level_1: "Level 1 (5×5 Easy)",
|
||||||
|
level_2: "Level 2 (5×5 Medium)",
|
||||||
|
level_3: "Level 3 (6×6 Expert)",
|
||||||
|
level_random: "Infinite Generator 🎲",
|
||||||
|
btn_undo: "↩️ Undo",
|
||||||
|
btn_restart: "🔄 Restart",
|
||||||
|
btn_challenge: "🎲 New Challenge",
|
||||||
|
win_title: "🎉 CONGRATULATIONS!",
|
||||||
|
win_sub: "Grid completed successfully!",
|
||||||
|
win_time: "Time: ",
|
||||||
|
win_next: "Next Level ➡️",
|
||||||
|
instructions: "Connect all numbers in order (1 ➔ 2 ➔ 3...) visiting <strong>EVERY grid cell</strong> exactly once, without crossing red walls! (Drag or click)"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let currentZipLang = 'fr';
|
||||||
|
function applyZipLang(lang) {
|
||||||
|
currentZipLang = (lang && (lang.startsWith('en') ? 'en' : 'fr')) || 'fr';
|
||||||
|
const dict = I18N_ZIP[currentZipLang] || I18N_ZIP.fr;
|
||||||
|
|
||||||
|
const lc = document.getElementById('labelCellCount');
|
||||||
|
const lt = document.getElementById('labelTarget');
|
||||||
|
const o1 = document.getElementById('optLevel1');
|
||||||
|
const o2 = document.getElementById('optLevel2');
|
||||||
|
const o3 = document.getElementById('optLevel3');
|
||||||
|
const or = document.getElementById('optLevelRandom');
|
||||||
|
const bu = document.getElementById('btnZipUndo');
|
||||||
|
const br = document.getElementById('btnZipRestart');
|
||||||
|
const bc = document.getElementById('btnZipChallenge');
|
||||||
|
const wt = document.getElementById('winTitle');
|
||||||
|
const ws = document.getElementById('winSub');
|
||||||
|
const wn = document.getElementById('winNextBtn');
|
||||||
|
const zi = document.getElementById('zipInstructions');
|
||||||
|
|
||||||
|
if (lc) lc.textContent = dict.cell_count;
|
||||||
|
if (lt) lt.textContent = dict.target;
|
||||||
|
if (o1) o1.textContent = dict.level_1;
|
||||||
|
if (o2) o2.textContent = dict.level_2;
|
||||||
|
if (o3) o3.textContent = dict.level_3;
|
||||||
|
if (or) or.textContent = dict.level_random;
|
||||||
|
if (bu) bu.textContent = dict.btn_undo;
|
||||||
|
if (br) br.textContent = dict.btn_restart;
|
||||||
|
if (bc) bc.textContent = dict.btn_challenge;
|
||||||
|
if (wt) wt.textContent = dict.win_title;
|
||||||
|
if (ws) ws.textContent = dict.win_sub;
|
||||||
|
if (wn) wn.textContent = dict.win_next;
|
||||||
|
if (zi) zi.innerHTML = dict.instructions;
|
||||||
|
|
||||||
|
if (typeof updateProgressUI === 'function') updateProgressUI();
|
||||||
|
}
|
||||||
|
applyZipLang(urlParams.get('lang'));
|
||||||
|
|
||||||
window.addEventListener('message', e => {
|
window.addEventListener('message', e => {
|
||||||
if (e.data && e.data.type === 'themeChange') {
|
if (e.data && e.data.type === 'themeChange') {
|
||||||
setTheme(e.data.theme, e.data.macosMode);
|
setTheme(e.data.theme, e.data.macosMode);
|
||||||
}
|
}
|
||||||
|
if (e.data && e.data.type === 'langChange') {
|
||||||
|
applyZipLang(e.data.lang);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Audio synthesizer
|
// Audio synthesizer
|
||||||
@@ -606,12 +707,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dict = I18N_ZIP[currentZipLang] || I18N_ZIP.fr;
|
||||||
if (nextExpected <= maxNumber) {
|
if (nextExpected <= maxNumber) {
|
||||||
document.getElementById('nextTargetNum').textContent = `Atteindre le ${nextExpected}`;
|
document.getElementById('nextTargetNum').textContent = `${dict.target_reach}${nextExpected}`;
|
||||||
} else if (count < total) {
|
} else if (count < total) {
|
||||||
document.getElementById('nextTargetNum').textContent = `Couvrir les ${total - count} case(s) restante(s)`;
|
document.getElementById('nextTargetNum').textContent = dict.target_cover.replace('{n}', total - count);
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('nextTargetNum').textContent = `Terminé ! 🎉`;
|
document.getElementById('nextTargetNum').textContent = dict.target_done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -797,7 +899,8 @@
|
|||||||
// VICTORY!
|
// VICTORY!
|
||||||
if (timerInterval) clearInterval(timerInterval);
|
if (timerInterval) clearInterval(timerInterval);
|
||||||
playBeep('win');
|
playBeep('win');
|
||||||
document.getElementById('winTime').textContent = `Temps : ${document.getElementById('timerDisplay').textContent}`;
|
const dict = I18N_ZIP[currentZipLang] || I18N_ZIP.fr;
|
||||||
|
document.getElementById('winTime').textContent = `${dict.win_time}${document.getElementById('timerDisplay').textContent}`;
|
||||||
document.getElementById('winOverlay').style.display = 'flex';
|
document.getElementById('winOverlay').style.display = 'flex';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user