Skip to content

Commit

Permalink
misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nano2dev authored Feb 16, 2024
1 parent 0d0848d commit 766da1b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions latest.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// NanoGoal
// NanoGoal 1.0.2
// https://github.com/fwd/nano-goal
// Follow me on Twitter @nano2dev
;(async () => {
// (c) Nano.to <[email protected]>
// Released under MIT License
;(() => {

if (window.nano === undefined) window.nano = { debug: false }
if (window.nano === undefined) window.nano = { version: '1.0.2' }

var rpc = {

Expand Down Expand Up @@ -34,7 +35,6 @@

style.type = 'text/css';
if (style.styleSheet){
// This is required for IE8 and below.
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
Expand Down Expand Up @@ -64,6 +64,10 @@
bulk.push(temp)
}

function kFormatter(num) {
return Math.abs(num) > 999 ? Math.sign(num)*((Math.abs(num)/1000).toFixed(1)) + 'K' : Math.sign(num)*Math.abs(num)
}

rpc.post(config.endpoint ? config.endpoint : rpc.endpoint, {
action: 'accounts_balances',
accounts: bulk.map(a => a.address),
Expand Down Expand Up @@ -114,7 +118,7 @@
<div class="flex-item">
<div class="goal-stat">${config.title || 'Funding Goal'}</div>
<div class="goal-stat">
<span style="font-size: 80%">Ӿ</span> ${config.amount}
<span style="font-size: 80%; margin-right: -3px">Ӿ</span> ${kFormatter(config.amount)}
</div>
</div>
<div id="glass">
Expand All @@ -132,7 +136,7 @@
</div>
<div class="goal-stat">
<span class="goal-number">
<span style="font-size: 80%">Ӿ</span> ${ Number(_balance.balance_nano).toFixed(2) }
<span style="font-size: 80%; margin-right: -1px">Ӿ</span> ${ kFormatter(Number(_balance.balance_nano).toFixed(2)) }
<b>${config.strings && config.strings.raised ? config.strings.raised : 'Raised'}</b>
</span>
</div>
Expand Down

0 comments on commit 766da1b

Please sign in to comment.