fix: paginate weinfo times and read min deposit from ranking_info
- weinfo.html now pages times with the API's zero-based page offset instead of block heights\n- bal.js renders page metadata and hides dead next links on the last page\n- index.html and terms.html read amount from /ranking_info/{chain}
This commit is contained in:
29
bal.js
29
bal.js
@@ -77,18 +77,39 @@ async function fetchDataAndPopulateTable(url,params,fnPopulateTable,downloadOpt,
|
||||
document.getElementById("chainth").innerHTML = chain;
|
||||
const pag = document.getElementById("paginator");
|
||||
pag.innerHTML = "";
|
||||
const currentPage = paginator && paginator.page != null
|
||||
? paginator.page
|
||||
: (Number(page) || 0);
|
||||
const prevPage = paginator && paginator.prev != null
|
||||
? paginator.prev
|
||||
: Math.max(currentPage - 1, 0);
|
||||
const nextPage = paginator && paginator.next != null
|
||||
? paginator.next
|
||||
: currentPage + 1;
|
||||
const hasPrev = paginator && paginator.hasPrev != null
|
||||
? paginator.hasPrev
|
||||
: currentPage > 0;
|
||||
const hasNext = paginator && paginator.hasNext != null
|
||||
? paginator.hasNext
|
||||
: true;
|
||||
// prev (a plain, dimmed arrow on the first page), "page N", next
|
||||
if (page > 0) {
|
||||
pag.appendChild(createlink("‹","?page="+paginator.prev));
|
||||
if (hasPrev) {
|
||||
pag.appendChild(createlink("‹","?page="+prevPage));
|
||||
} else {
|
||||
const off = document.createElement("span");
|
||||
off.className = "pg-off"; off.innerHTML = "‹";
|
||||
pag.appendChild(off);
|
||||
}
|
||||
const lbl = document.createElement("span");
|
||||
lbl.className = "pg-label"; lbl.textContent = "page " + page;
|
||||
lbl.className = "pg-label"; lbl.textContent = "page " + currentPage;
|
||||
pag.appendChild(lbl);
|
||||
pag.appendChild(createlink("›","?page="+paginator.next));
|
||||
if (hasNext) {
|
||||
pag.appendChild(createlink("›","?page="+nextPage));
|
||||
} else {
|
||||
const off = document.createElement("span");
|
||||
off.className = "pg-off"; off.innerHTML = "›";
|
||||
pag.appendChild(off);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user