Compare commits

..

1 Commits

Author SHA1 Message Date
user
bffc463942 style block number with click-to-copy and etherscan link
All checks were successful
check / check (push) Successful in 22s
Add blockNumberHtml() following the same pattern as txHashHtml() and
toAddressHtml(): dashed-underline click-to-copy text plus an external
Etherscan link icon (etherscan.io/block/{number}).

Closes #99
2026-02-28 14:46:46 -08:00

View File

@@ -50,15 +50,6 @@ function toAddressHtml(address) {
return `<div class="flex items-center">${dot}<span class="break-all underline decoration-dashed cursor-pointer" data-copy="${escapeHtml(address)}">${escapeHtml(address)}</span>${extLink}</div>`;
}
function txHashHtml(hash) {
const link = `https://etherscan.io/tx/${hash}`;
const extLink = `<a href="${link}" target="_blank" rel="noopener" class="inline-flex items-center">${EXT_ICON}</a>`;
return (
`<span class="underline decoration-dashed cursor-pointer break-all" data-copy="${escapeHtml(hash)}">${escapeHtml(hash)}</span>` +
extLink
);
}
function blockNumberHtml(blockNumber) {
const num = String(blockNumber);
const link = `https://etherscan.io/block/${num}`;
@@ -69,6 +60,15 @@ function blockNumberHtml(blockNumber) {
);
}
function txHashHtml(hash) {
const link = `https://etherscan.io/tx/${hash}`;
const extLink = `<a href="${link}" target="_blank" rel="noopener" class="inline-flex items-center">${EXT_ICON}</a>`;
return (
`<span class="underline decoration-dashed cursor-pointer break-all" data-copy="${escapeHtml(hash)}">${escapeHtml(hash)}</span>` +
extLink
);
}
function attachCopyHandlers(viewId) {
document
.getElementById(viewId)