diff --git a/bal.js b/bal.js index 4546dea..d19fe1d 100644 --- a/bal.js +++ b/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); + } } } diff --git a/index.html b/index.html index 70cd0f6..2656e7b 100644 --- a/index.html +++ b/index.html @@ -712,8 +712,9 @@ async function fetchData() { async function fetchMinAmount() { const chain = getChain(); try { - const r = await fetch('/min_deposit/' + chain); - const val = parseInt(await r.text(), 10); + const r = await fetch('/ranking_info/' + chain); + const data = await r.json(); + const val = parseInt(data.amount, 10); if (isNaN(val)) throw new Error('invalid'); minAmount = val; document.getElementById('thr-min').textContent = fmt(val); diff --git a/terms.html b/terms.html index 28bdf2d..35d2d69 100644 --- a/terms.html +++ b/terms.html @@ -724,8 +724,9 @@ l-49 -25 -880 0 -880 0 -3 704 c-2 557 0 706 10 713 7 4 407 7 888 5 818 -2 // The #thr-min span is inside Section 1 (01 ยท PAYMENT). const chain = location.hash ? location.hash.slice(1) : 'bitcoin'; try { - const r = await fetch('/min_deposit/' + chain); - const val = parseInt(await r.text(), 10); + const r = await fetch('/ranking_info/' + chain); + const data = await r.json(); + const val = parseInt(data.amount, 10); if (!isNaN(val)) { const txt = Number(val).toLocaleString('en-US'); document.getElementById('thr-min').textContent = txt; diff --git a/weinfo.html b/weinfo.html index a99c699..e48ddc2 100644 --- a/weinfo.html +++ b/weinfo.html @@ -166,9 +166,8 @@ footer a{color:var(--accent);text-decoration:none}

WeTime rounds

Each round: the block hash sent by this server and how fast it was. Chain: . The full list is in the download below.
- - - Latest 100 rounds + +
@@ -348,18 +347,17 @@ footer a{color:var(--accent);text-decoration:none} } else { tableBody.innerHTML = ''; } - var prev=0; - var next=0; - if (data.times && data.times.length > 0){ - prev = data.times[0].blockHeight+data.times.length; - next = data.times[data.times.length-1].blockHeight; - if (prev < 0 ){ - prev = 0; - } - } - - const paginator = {prev:prev,next:next}; - return paginator; + const urlParams = new URLSearchParams(window.location.search); + const currentPage = Math.max(parseInt(urlParams.get('page') || '0', 10) || 0, 0); + const pageSize = Math.min(Number(limit) || 100, 100); + const hasNext = !!data.times && data.times.length >= pageSize; + return { + page: currentPage, + prev: Math.max(currentPage - 1, 0), + next: currentPage + 1, + hasPrev: currentPage > 0, + hasNext: hasNext, + }; },{elementName:"download",fileName:"weinfo_"+cdate+".json",linkText:"download"}) }
No rounds yet.