Spaces:
Running
Running
Commit
·
39ed59e
1
Parent(s):
c0b864d
Update static/app.js
Browse files- static/app.js +1 -1
static/app.js
CHANGED
|
@@ -37,7 +37,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 |
-
let html = `<h2>Found ${allResults.length} puzzles${allResults.length > 0 ? ` in ${window.searchTimeMs.toFixed(0)}ms
|
| 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>`; });
|
|
|
|
| 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 |
+
let html = `<h2>Found ${allResults.length} puzzles${allResults.length > 0 ? ` in ${window.searchTimeMs.toFixed(0)}ms (page ${currentPage + 1} of ${totalPages})` : ''}</h2>`;
|
| 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>`; });
|