Files
purple-explorer/views/block.pug
T
joeuhren 79a8e967ab Use digit grouping and small decimals for most numeric values
-Numeric values with fixed decimals now truncates trailing zeros to a minimum of 2
2020-12-25 19:07:03 -07:00

131 lines
6.4 KiB
Plaintext

extends layout
block content
include ./includes/common.pug
- var time = format_unixtime(block.time);
- var block_difficulty = parseFloat(block.difficulty).toFixed(4);
- var theadClasses = [];
if settings.display.table_header_bgcolor != null && settings.display.table_header_bgcolor != ''
- theadClasses.push('thead-' + settings.display.table_header_bgcolor);
script.
$(document).ready(function() {
$('#block-summary').dataTable({
info: false,
paging: false,
searching: false,
ordering: false,
responsive: true,
scrollX: true,
fnDrawCallback: function(settings) {
fixDataTableColumns();
}
})
});
.col-xs-12.col-md-12
.card.card-default.border-0.cardSpacer
.card-header(style='padding-left:25px;padding-right:25px;')
.row
if block.previousblockhash != null
a(href='/block/' + block.previousblockhash)
span.fa.fa-chevron-left.iquidus.block-last(data-toggle='tooltip', data-placement='top', title=settings.locale.block_previous)
strong.d-none.d-md-block #{settings.symbol} block: #{block.hash}
strong.d-block.d-md-none #{settings.locale.ex_summary}
else
strong.d-none.d-md-block(style='margin-left:10px;') #{settings.symbol} #{settings.locale.ex_block}: #{block.hash}
strong.d-block.d-md-none(style='margin-left:10px;') #{settings.locale.ex_summary}
if block.nextblockhash != null
a(href='/block/' + block.nextblockhash)
span.fa.fa-chevron-right.iquidus.block-next(data-toggle='tooltip', data-placement='top', title=settings.locale.block_next)
a.d-none.d-md-block(href='/api/getblock?hash=' + block.hash, style='margin-left:auto;', data-toggle='tooltip', data-placement='top', title=settings.locale.view_raw_block_data)
span.fa.fa-info-circle.iquidus
table#block-summary.table.table-bordered.summary-table(style='border-top:0;margin-top:0 !important;')
thead(class=theadClasses)
tr
th.text-center #{settings.locale.height}
th.text-center #{settings.locale.difficulty}
th.text-center #{settings.locale.confirmations}
if settings.heavy == true
th.text-center Vote
th.text-center #{settings.locale.size} (kB)
th.text-center #{settings.locale.bits}
th.text-center #{settings.locale.nonce}
th.text-center #{settings.locale.timestamp}
tbody
- var difficulty = Number(block.difficulty).toLocaleString('en',{'minimumFractionDigits':4,'maximumFractionDigits':4,'useGrouping':true});
- var splitDifficulty = difficulty.split('.');
- var block_size = Number(block.size/1024).toLocaleString('en',{'minimumFractionDigits':2,'maximumFractionDigits':2,'useGrouping':true});
- var splitBlockSize = block_size.split('.');
if block.confirmations >= confirmations
tr.bg-success.text-dark
td.text-center=block.height
td.text-center #{splitDifficulty[0]}.
span.decimal #{splitDifficulty[1]}
td.text-center=block.confirmations
if settings.heavy == true
td.text-center=block.vote
td.text-center #{splitBlockSize[0]}.
span.decimal #{splitBlockSize[1]}
td.text-center=block.bits
td.text-center=block.nonce
td.text-center=time
else
if block.confirmations < (confirmations / 2)
tr.bg-danger
td.text-center=block.height
td.text-center #{splitDifficulty[0]}.
span.decimal #{splitDifficulty[1]}
td.text-center=block.confirmations
if settings.heavy == true
td.text-center=block.vote
td.text-center #{splitBlockSize[0]}.
span.decimal #{splitBlockSize[1]}
td.text-center=block.bits
td.text-center=block.nonce
td.text-center=time
else
tr.table-warning
td.text-center=block.height
td.text-center #{splitDifficulty[0]}.
span.decimal #{splitDifficulty[1]}
td.text-center=block.confirmations
if settings.heavy == true
td.text-center=block.vote
td.text-center #{splitBlockSize[0]}.
span.decimal #{splitBlockSize[1]}
td.text-center=block.bits
td.text-center=block.nonce
td.text-center=time
if block.hash == settings.genesis_block
.alert.alert-info(role='alert', style='text-align:center;')
strong #{settings.locale.block_genesis}
else
.card.card-default.border-0
.card-header
strong #{settings.locale.ex_latest_transactions}
table.table.table-bordered.table-striped.summary-table.mobile-border-right
thead(class=theadClasses)
tr
th.text-center.d-table-cell.d-md-none
th.d-none.d-md-table-cell #{settings.locale.tx_hash}
th.text-center #{settings.locale.tx_recipients}
th.text-center #{settings.locale.mkt_amount}
span.small (#{settings.symbol})
tbody
each txn in txs
tr
td.text-center.d-table-cell.d-md-none
a(href='/tx/' + txn.txid)
span.fa.fa-eye(data-toggle='tooltip', data-placement='top', title=settings.locale.view_tx)
td.d-none.d-md-table-cell
a.breakWord(href='/tx/' + txn.txid) #{txn.txid}
td.text-center #{txn.vout.length}
if txn.vout.length > 0
- var total = Number(txn.total / 100000000).toLocaleString('en',{'minimumFractionDigits':2,'maximumFractionDigits':8,'useGrouping':true});
- var totalParts = total.split('.');
td.text-center #{totalParts[0]}.
span.decimal #{totalParts[1]}
else
- var total = Number(txn.total).toLocaleString('en',{'minimumFractionDigits':2,'maximumFractionDigits':8,'useGrouping':true});
- var totalParts = total.split('.');
td.text-center #{totalParts[0]}.
span.decimal #{totalParts[1]}