APmanageur Wi-Fi V1.0

This commit is contained in:
yoannmultigaming committed 2026-11-20 01:04:46 +01:00
1 parent 33cf355785
commit f78e380236
3 files changed
+157 -17

No files matched your search

+1 -4
View File
@@ -14523,11 +14523,8 @@ ${vpnBadgeTopo}
});
}
// Attacher le déclencheur aux barres de recherche de l'onglet Avancé
attachEasterEggTrigger($('vpnClientsSearchInput'));
// Attacher le déclencheur uniquement à la barre de recherche Capture de paquets dans l'onglet Avancé
attachEasterEggTrigger($('packetFilterInput'));
// Et pour une meilleure accessibilité, à la recherche des appareils également
attachEasterEggTrigger($('devicesSearchInput'));
// Fermeture par la touche Échap et clic extérieur
window.addEventListener('keydown', (e) => {
+132 -4
View File
@@ -279,6 +279,7 @@
<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">
@@ -309,13 +310,11 @@
} else {
delete document.documentElement.dataset.macosMode;
}
if (typeof ctx !== 'undefined' && ctx && typeof board !== 'undefined' && board) {
draw();
drawNext();
}
// Initialize theme from URL query param
const urlParams = new URLSearchParams(window.location.search);
setTheme(urlParams.get('theme') || 'dark', urlParams.get('macosMode'));
}
window.addEventListener('message', e => {
if (e.data && e.data.type === 'themeChange') {
@@ -373,6 +372,127 @@
} catch (e) {}
}
// Tetris Theme Music (Korobeiniki 8-bit Chiptune)
let isMusicEnabled = true;
let musicTimeout = null;
let musicStep = 0;
const T_TEMPO = 146;
const T_BEAT = 60 / T_TEMPO; // ~0.41s per quarter note
const KOROBEINIKI = [
// Part A
{ f: 659.25, d: 4 }, // E5
{ f: 493.88, d: 2 }, // B4
{ f: 523.25, d: 2 }, // C5
{ f: 587.33, d: 4 }, // D5
{ f: 523.25, d: 2 }, // C5
{ f: 493.88, d: 2 }, // B4
{ f: 440.00, d: 4 }, // A4
{ f: 440.00, d: 2 }, // A4
{ f: 523.25, d: 2 }, // C5
{ f: 659.25, d: 4 }, // E5
{ f: 587.33, d: 2 }, // D5
{ f: 523.25, d: 2 }, // C5
{ f: 493.88, d: 6 }, // B4
{ f: 523.25, d: 2 }, // C5
{ f: 587.33, d: 4 }, // D5
{ f: 659.25, d: 4 }, // E5
{ f: 523.25, d: 4 }, // C5
{ f: 440.00, d: 4 }, // A4
{ f: 440.00, d: 4 }, // A4
{ f: 0, d: 4 }, // Pause
// Part B
{ f: 587.33, d: 6 }, // D5
{ f: 698.46, d: 2 }, // F5
{ f: 880.00, d: 4 }, // A5
{ f: 783.99, d: 2 }, // G5
{ f: 698.46, d: 2 }, // F5
{ f: 659.25, d: 6 }, // E5
{ f: 523.25, d: 2 }, // C5
{ f: 659.25, d: 4 }, // E5
{ f: 587.33, d: 2 }, // D5
{ f: 523.25, d: 2 }, // C5
{ f: 493.88, d: 4 }, // B4
{ f: 493.88, d: 2 }, // B4
{ f: 523.25, d: 2 }, // C5
{ f: 587.33, d: 4 }, // D5
{ f: 659.25, d: 4 }, // E5
{ f: 523.25, d: 4 }, // C5
{ f: 440.00, d: 4 }, // A4
{ f: 440.00, d: 4 }, // A4
{ f: 0, d: 4 } // Pause
];
function playMusicNote(freq, durSec) {
if (!isMusicEnabled || isPaused || isGameOver || freq <= 0) return;
try {
if (!audioCtx) audioCtx = new (window.AudioContext || window.webkitAudioContext)();
if (audioCtx.state === 'suspended') audioCtx.resume();
const osc = audioCtx.createOscillator();
const gain = audioCtx.createGain();
osc.type = 'square';
osc.frequency.setValueAtTime(freq, audioCtx.currentTime);
const vol = 0.035;
gain.gain.setValueAtTime(vol, audioCtx.currentTime);
gain.gain.setValueAtTime(vol * 0.85, audioCtx.currentTime + durSec * 0.7);
gain.gain.linearRampToValueAtTime(0.0001, audioCtx.currentTime + durSec * 0.95);
osc.connect(gain);
gain.connect(audioCtx.destination);
osc.start();
osc.stop(audioCtx.currentTime + durSec * 0.95);
} catch (e) {}
}
function scheduleMusic() {
if (musicTimeout) clearTimeout(musicTimeout);
if (!isMusicEnabled || isPaused || isGameOver) return;
const item = KOROBEINIKI[musicStep];
const durSec = item.d * (T_BEAT / 4);
if (item.f > 0) {
playMusicNote(item.f, durSec);
}
musicStep = (musicStep + 1) % KOROBEINIKI.length;
musicTimeout = setTimeout(scheduleMusic, durSec * 1000);
}
function startMusic() {
if (musicTimeout) clearTimeout(musicTimeout);
musicStep = 0;
if (isMusicEnabled && !isPaused && !isGameOver) {
scheduleMusic();
}
}
function stopMusic() {
if (musicTimeout) {
clearTimeout(musicTimeout);
musicTimeout = null;
}
}
function toggleMusic() {
isMusicEnabled = !isMusicEnabled;
const btn = document.getElementById('musicBtn');
if (btn) btn.textContent = isMusicEnabled ? '🎵 Musique : ON' : '🔇 Musique : OFF';
if (isMusicEnabled) {
if (!isPaused && !isGameOver) scheduleMusic();
} else {
stopMusic();
}
}
function resumeAudioOnGesture() {
if (!audioCtx) audioCtx = new (window.AudioContext || window.webkitAudioContext)();
if (audioCtx.state === 'suspended') audioCtx.resume();
if (isMusicEnabled && !musicTimeout && !isPaused && !isGameOver) {
scheduleMusic();
}
}
window.addEventListener('keydown', resumeAudioOnGesture);
window.addEventListener('pointerdown', resumeAudioOnGesture);
const canvas = document.getElementById('tetris');
const ctx = canvas.getContext('2d');
const nextCanvas = document.getElementById('next');
@@ -519,6 +639,7 @@
if (collide(board, player)) {
isGameOver = true;
stopMusic();
playSound('gameover');
document.getElementById('gameOverlay').style.display = 'flex';
document.getElementById('overlayTitle').textContent = 'GAME OVER';
@@ -609,12 +730,14 @@
document.getElementById('pauseBtn').textContent = isPaused ? 'REPRENDRE' : 'PAUSE (P)';
const ov = document.getElementById('gameOverlay');
if (isPaused) {
stopMusic();
ov.style.display = 'flex';
document.getElementById('overlayTitle').textContent = 'PAUSE';
document.getElementById('overlayScore').textContent = 'Score: ' + player.score;
} else {
ov.style.display = 'none';
lastTime = performance.now();
if (isMusicEnabled) scheduleMusic();
}
}
@@ -752,6 +875,7 @@
nextPiece = null;
playerReset();
lastTime = performance.now();
startMusic();
}
window.addEventListener('keydown', e => {
@@ -771,6 +895,10 @@
else if (e.key === ' ') hardDrop();
});
// Initialize theme from URL query param safely after all variables exist
const urlParams = new URLSearchParams(window.location.search);
setTheme(urlParams.get('theme') || 'dark', urlParams.get('macosMode'));
startGame();
update();
</script>
+24 -9
View File
@@ -285,17 +285,21 @@
/* SVG overlay for path */
.path-svg {
position: absolute;
inset: 8px;
top: 8px;
left: 8px;
width: calc(100% - 16px);
height: calc(100% - 16px);
pointer-events: none;
z-index: 5;
z-index: 10;
overflow: visible !important;
}
.path-line {
fill: none;
stroke: var(--path-stroke);
stroke-width: 6;
stroke: var(--path-stroke, #5ca7ff);
stroke-width: 7;
stroke-linecap: round;
stroke-linejoin: round;
filter: drop-shadow(0 0 6px var(--path-stroke));
filter: drop-shadow(0 0 6px var(--path-stroke, #5ca7ff));
}
.bottom-actions {
@@ -747,15 +751,25 @@
// Draw SVG polyline
const svg = document.getElementById('pathSvg');
const grid = document.getElementById('gridEl');
if (!svg || !grid) return;
svg.innerHTML = '';
const w = grid.offsetWidth;
const h = grid.offsetHeight;
svg.setAttribute('width', w);
svg.setAttribute('height', h);
svg.setAttribute('viewBox', `0 0 ${w} ${h}`);
svg.style.width = w + 'px';
svg.style.height = h + 'px';
if (path.length < 2) return;
const gridRect = document.getElementById('gridEl').getBoundingClientRect();
const points = path.map(p => {
const c = document.querySelector(`.cell[data-x="${p.x}"][data-y="${p.y}"]`);
const r = c.getBoundingClientRect();
const cx = r.left - gridRect.left + r.width / 2;
const cy = r.top - gridRect.top + r.height / 2;
if (!c) return '0,0';
const cx = c.offsetLeft + c.offsetWidth / 2;
const cy = c.offsetTop + c.offsetHeight / 2;
return `${cx},${cy}`;
}).join(' ');
@@ -909,6 +923,7 @@
}
});
window.addEventListener('resize', () => { renderPath(); });
initLevel(LEVELS[1]);
</script>
</body>