Fix all ESLint errors across project

This commit is contained in:
2026-05-25 00:55:16 +02:00
parent 6608d771a2
commit 47e7924a49
8 changed files with 31 additions and 27 deletions

33
app.js
View File

@@ -3,14 +3,12 @@
* Haupt-Application
*/
const PLAYER_NAME = 'Kiesewetter, Lara';
/* global $, parsePGN, filterLaraGames, getLiveGame, getLatestGame, Chess, Chessboard */
let board = null;
let chess = null;
let currentGame = null;
let allLaraGames = [];
let serverLastFetch = null;
let laraColor = null;
let currentMoveIndex = -1;
let userSelectedGame = false;
let userScrolledMoves = false;
@@ -89,14 +87,13 @@ function updateBoard() {
// Spiegele das Brett, wenn Lara Schwarz hat
const laraIsBlack = currentGame.black.toLowerCase().includes('kiesewetter');
const orientation = laraIsBlack ? 'black' : 'white';
laraColor = laraIsBlack ? 'b' : 'w';
// Führe alle Züge aus
const nonResultMoves = currentGame.moves.filter(m => !m.isResult);
for (const move of nonResultMoves) {
try {
chess.move(move.san);
} catch (e) {
} catch {
// Ignoriere ungültige Züge
}
}
@@ -108,7 +105,7 @@ function updateBoard() {
for (let i = 0; i <= currentMoveIndex && i < nonResultMoves.length; i++) {
try {
chess.move(nonResultMoves[i].san);
} catch (e) {
} catch {
break;
}
}
@@ -153,7 +150,7 @@ function goToMove(index) {
for (let i = 0; i <= index; i++) {
try {
chess.move(nonResultMoves[i].san);
} catch (err) {
} catch {
break;
}
}
@@ -265,21 +262,19 @@ function highlightActivePlayer() {
* Highlight den letzten Zug auf dem Brett
*/
function highlightLastMove() {
if (!board || !chess) return;
if (!board || !chess || !currentGame) return;
$('#board [data-square]').removeClass('last-move-highlight');
const nonResultMoves = currentGame.moves.filter(m => !m.isResult);
if (currentMoveIndex >= 0 && currentMoveIndex < nonResultMoves.length) {
const lastMove = nonResultMoves[currentMoveIndex];
// Parse die SAN-Züge, um Start- und Zielfelder zu finden
const moves = chess.history({ verbose: true });
if (moves.length > 0) {
const lastMoveData = moves[moves.length - 1];
board.highlightSquare(lastMoveData.from, lastMoveData.to);
$(`#board [data-square="${lastMoveData.from}"]`).addClass('last-move-highlight');
$(`#board [data-square="${lastMoveData.to}"]`).addClass('last-move-highlight');
}
} else {
board.clearHighlights();
}
}
@@ -501,12 +496,11 @@ async function updateStandings() {
<span class="standings-value">${data.losses}</span>
</div>
`;
serverLastFetch = Date.now();
return;
}
}
document.getElementById('standings-content').innerHTML = '<div class="standings-loading">Daten nicht verfügbar</div>';
} catch (err) {
} catch {
document.getElementById('standings-content').innerHTML = '<div class="standings-loading">Daten nicht verfügbar</div>';
}
}
@@ -564,11 +558,6 @@ function showLoading(show) {
document.getElementById('loading-overlay').style.display = show ? 'flex' : 'none';
}
function showError(msg) {
document.getElementById('error-message').textContent = msg;
document.getElementById('error-overlay').style.display = 'flex';
}
function hideError() {
document.getElementById('error-overlay').style.display = 'none';
}
@@ -609,8 +598,6 @@ document.getElementById('copy-pgn-btn').addEventListener('click', async () => {
document.addEventListener('keydown', (e) => {
if (!currentGame) return;
const nonResultMoves = currentGame.moves.filter(m => !m.isResult);
if (e.key === 'ArrowLeft') {
e.preventDefault();
goToMove(currentMoveIndex - 1);