Spaces:
Running
Running
Commit
·
c4f8a1f
1
Parent(s):
6af1df5
Update static/app.js
Browse files- static/app.js +1 -3
static/app.js
CHANGED
|
@@ -14,7 +14,6 @@ function updateInfo() {
|
|
| 14 |
document.getElementById('fen').textContent = 'FEN: ' + board.fen();
|
| 15 |
let pos = board.position();
|
| 16 |
let pieces = Object.keys(pos).length;
|
| 17 |
-
document.getElementById('position-info').textContent = `Pieces on board: ${pieces}`;
|
| 18 |
}
|
| 19 |
|
| 20 |
function search() {
|
|
@@ -37,8 +36,7 @@ function search() {
|
|
| 37 |
|
| 38 |
function displayPage() {
|
| 39 |
const start = currentPage * RESULTS_PER_PAGE, end = start + RESULTS_PER_PAGE, pageResults = allResults.slice(start, end), totalPages = Math.ceil(allResults.length / RESULTS_PER_PAGE);
|
| 40 |
-
|
| 41 |
-
html += `<div class="pagination"><button onclick="prevPage()" ${currentPage === 0 ? 'disabled' : ''}>Previous</button><button onclick="nextPage()" ${end >= allResults.length ? 'disabled' : ''}>Next</button></div>`;
|
| 42 |
html += `<div class="puzzle-grid">`;
|
| 43 |
pageResults.forEach((p, i) => { const idx = start + i; html += `<div class="puzzle"><div class="puzzle-board" id="result-board-${idx}"></div><div class="puzzle-info"><h3><a href="https://lichess.org/training/${p.PuzzleId}" target="_blank">${p.PuzzleId}</a></h3><p>Rating: ${p.Rating} | Pop: ${p.Popularity}%</p><div class="themes">${p.Themes.map(t => `<span class="theme">${t}</span>`).join(' ')}</div><p>Move ${p.MatchedMove}</p></div></div>`; });
|
| 44 |
html += `</div>`;
|
|
|
|
| 14 |
document.getElementById('fen').textContent = 'FEN: ' + board.fen();
|
| 15 |
let pos = board.position();
|
| 16 |
let pieces = Object.keys(pos).length;
|
|
|
|
| 17 |
}
|
| 18 |
|
| 19 |
function search() {
|
|
|
|
| 36 |
|
| 37 |
function displayPage() {
|
| 38 |
const start = currentPage * RESULTS_PER_PAGE, end = start + RESULTS_PER_PAGE, pageResults = allResults.slice(start, end), totalPages = Math.ceil(allResults.length / RESULTS_PER_PAGE);
|
| 39 |
+
let html = `<h2>Found ${allResults.length} puzzles${allResults.length > 0 ? ` in ${window.searchTimeMs.toFixed(0)}ms (page ${currentPage + 1} of ${totalPages})` : ''}</h2>`; html += `<div class="pagination"><button onclick="prevPage()" ${currentPage === 0 ? 'disabled' : ''}>Previous</button><button onclick="nextPage()" ${end >= allResults.length ? 'disabled' : ''}>Next</button></div>`;
|
|
|
|
| 40 |
html += `<div class="puzzle-grid">`;
|
| 41 |
pageResults.forEach((p, i) => { const idx = start + i; html += `<div class="puzzle"><div class="puzzle-board" id="result-board-${idx}"></div><div class="puzzle-info"><h3><a href="https://lichess.org/training/${p.PuzzleId}" target="_blank">${p.PuzzleId}</a></h3><p>Rating: ${p.Rating} | Pop: ${p.Popularity}%</p><div class="themes">${p.Themes.map(t => `<span class="theme">${t}</span>`).join(' ')}</div><p>Move ${p.MatchedMove}</p></div></div>`; });
|
| 42 |
html += `</div>`;
|