Skip to content

Commit daa1f2f

Browse files
authored
Merge pull request EverexIO#76 from ilyaeverex/hist-price-scrollable
  , >0.00 and media fixes
2 parents 92ad683 + bee2677 commit daa1f2f

File tree

2 files changed

+33
-20
lines changed

2 files changed

+33
-20
lines changed

css/ethplorer.css

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,16 +596,19 @@ a.dashed {
596596
.diff-down {
597597
color: #ae2525 !important;
598598
}
599+
#transfer-operation-value .diff-up,
600+
#transfer-operation-value .diff-zero,
601+
#transfer-operation-value .diff-down{
602+
padding-left: 6px;
603+
}
599604

600605
#transfer-operation-value .diff-up{
601606
color: #28d028 !important;
602-
padding-left: 6px;
603607
font-size: 0.9em;
604608
}
605609

606610
#transfer-operation-value .diff-down{
607611
color: #a92626 !important;
608-
padding-left: 6px;
609612
font-size: 0.9em;
610613
}
611614

@@ -651,6 +654,11 @@ a.dashed {
651654
.transfer-usd span{
652655
padding-left: 6px;
653656
}
657+
@media screen and (max-width: 1199px) and (min-width: 767px) {
658+
.transfer-usd span{
659+
display: block;
660+
}
661+
}
654662

655663
.hash-from-to, .cut-long-text {
656664
max-width: 40vw;
@@ -1391,6 +1399,7 @@ a.token-update {
13911399
100%{transform:rotate(360deg)}
13921400
}
13931401
.historical-price {
1402+
display: block;
13941403
font-size: 0.7em;
13951404
color: rgba(255, 255, 255, 0.4);
13961405
}

js/ethplorer.js

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ Ethplorer = {
329329
var pf = parseFloat(totalSupply.replace(/\,/g,'').split(' ')[0]);
330330
if(pf){
331331
pf = Ethplorer.Utils.round(pf * oToken.price.rate, 2);
332-
totalSupply = totalSupply + '<br><span class="total-supply-usd">$ ' + Ethplorer.Utils.formatNum(pf, true, 2, true) + '</span>';
332+
totalSupply = totalSupply + '<br><span class="total-supply-usd">$&nbsp;' + Ethplorer.Utils.formatNum(pf, true, 2, true) + '</span>';
333333
$('#transaction-token-totalSupply').html(totalSupply);
334334
}
335335
}
@@ -363,7 +363,7 @@ Ethplorer = {
363363
}
364364
var value = oOperation.value;
365365
if(valFloat && oToken.price && oToken.price.rate){
366-
value = value + '<br><span class="tx-value-price">$ ' + Ethplorer.Utils.formatNum(oToken.price.rate * valFloat, true, 2, true, true) + '</span>';
366+
value = value + '<br><span class="tx-value-price">$&nbsp;' + Ethplorer.Utils.formatNum(oToken.price.rate * valFloat, true, 2, true, true) + '</span>';
367367
value += getHistDiffPriceString(op.usdPrice, oToken.price.rate);
368368
}
369369
$('#transfer-operation-value').html(value);
@@ -510,7 +510,7 @@ Ethplorer = {
510510
var pf = parseFloat(totalSupply.replace(/\,/g,'').split(' ')[0]);
511511
if(pf){
512512
pf = Ethplorer.Utils.round(pf * oToken.price.rate, 2);
513-
totalSupply = totalSupply + '<br><span class="total-supply-usd">$ ' + Ethplorer.Utils.formatNum(pf, true, 2, true) + '</span>';
513+
totalSupply = totalSupply + '<br><span class="total-supply-usd">$&nbsp;' + Ethplorer.Utils.formatNum(pf, true, 2, true) + '</span>';
514514
$('#transaction-token-totalSupply').html(totalSupply);
515515
}
516516
}
@@ -609,7 +609,7 @@ Ethplorer = {
609609
if(oOperation.value){
610610
var value = oOperation.value;
611611
if(valFloat && oToken.price && oToken.price.rate){
612-
value = value + '<br><span class="tx-value-price">$ ' + Ethplorer.Utils.formatNum(oToken.price.rate * valFloat, true, 2, true, true) + '</span>';
612+
value = value + '<br><span class="tx-value-price">$&nbsp;' + Ethplorer.Utils.formatNum(oToken.price.rate * valFloat, true, 2, true, true) + '</span>';
613613
value += getHistDiffPriceString(oOperation.usdPrice, oToken.price.rate);
614614
}
615615
$('#transfer-operation-value').html(value);
@@ -853,7 +853,7 @@ Ethplorer = {
853853
var pf = parseFloat(totalSupply.replace(/\,/g,'').split(' ')[0]);
854854
if(pf){
855855
pf = Ethplorer.Utils.round(pf * oToken.price.rate, 2);
856-
totalSupply = totalSupply + '<br><span class="total-supply-usd">$ ' + Ethplorer.Utils.formatNum(pf, true, 2, true) + '</span>';
856+
totalSupply = totalSupply + '<br><span class="total-supply-usd">$&nbsp;' + Ethplorer.Utils.formatNum(pf, true, 2, true) + '</span>';
857857
$('#address-token-totalSupply').html(totalSupply);
858858
}
859859
}
@@ -913,7 +913,7 @@ Ethplorer = {
913913
if(balances[k].price){
914914
var rate = oToken.price;
915915
var price = balances[k].balanceUSD;
916-
value += ('<br><div class="balances-price" title="$' + price + '">$ ' + Ethplorer.Utils.formatNum(price, true, 2, true) + ' ');
916+
value += ('<br><div class="balances-price" title="$' + price + '">$&nbsp;' + Ethplorer.Utils.formatNum(price, true, 2, true) + ' ');
917917
if(rate.diff){
918918
var cls = getDiffClass(rate.diff);
919919
var hint = 'Updated at ' + Ethplorer.Utils.ts2date(rate.ts, true);
@@ -946,7 +946,7 @@ Ethplorer = {
946946
$('#address-token-balances table').append(row);
947947
}
948948
if(totalPrice){
949-
var value = '~ $ ' + Ethplorer.Utils.formatNum(totalPrice, true, 2, true, true);
949+
var value = '~ $&nbsp;' + Ethplorer.Utils.formatNum(totalPrice, true, 2, true, true);
950950
if(totalDiff){
951951
var cls = getDiffClass(totalDiff);
952952
if(totalDiff > 0){
@@ -1130,7 +1130,7 @@ Ethplorer = {
11301130
value = (tx.type && ('burn' === tx.type)) ? '-' + value + '<br>&#128293;&nbsp;Burn' : value + '<br>&#9874;&nbsp;Issuance';
11311131
}
11321132
var pf = parseFloat(value.replace(/\,/g,'').split(' ')[0]);
1133-
var usdPrice = '';
1133+
var usdPrice = '<br>';
11341134
if(pf){
11351135

11361136
// Fill the tx.usdPrice if tx age less 10 minutes, because of delay price update scripts
@@ -1140,22 +1140,25 @@ Ethplorer = {
11401140

11411141
if(txToken.price && txToken.price.rate){
11421142
var usdval = Ethplorer.Utils.formatNum(Math.abs(Ethplorer.Utils.round(pf * txToken.price.rate, 2)), true, 2, true);
1143-
value = value + '<br><span class="transfer-usd" title="now">$ ' + usdval +
1143+
value = value + '<br><span class="transfer-usd" title="now">$&nbsp;' + usdval +
11441144
getHistDiffPriceString(tx.usdPrice, txToken.price.rate) + '</span>';
11451145
}
11461146
if (tx.usdPrice && Ethplorer.showHistoricalPrice){
11471147
var hint = 'estimated at tx date';
11481148
var totalHistoryPrice = Ethplorer.Utils.formatNum(Math.abs(Ethplorer.Utils.round(pf*tx.usdPrice, 2)), true, 2, true);
11491149
var historyPrice = Ethplorer.Utils.formatNum(Math.abs(Ethplorer.Utils.round(tx.usdPrice, 2)), true, 2, true);
1150-
usdPrice = '<br><span class="historical-price" title="' + hint + '">~$ '
1150+
if (historyPrice === '0.00') {
1151+
historyPrice = '>0.00';
1152+
}
1153+
usdPrice = '<span class="historical-price" title="' + hint + '">~$&nbsp;'
11511154
+ totalHistoryPrice +'<span class="mrgnl-10">@&nbsp;'+ historyPrice +'</span></span>'
11521155
}
11531156
}
11541157
value += usdPrice;
11551158
divData.html(
11561159
'<span class="show_small">Date:&nbsp;' + date + '<br></span>' +
11571160
(!data.token ? ('<span class="address-token-inline">Token:&nbsp;' + token + '<br></span>') : '') +
1158-
'<span class="show_small ' + rowClass + '">Value:&nbsp;' + value + '<br></span>' +
1161+
'<span class="show_small ' + rowClass + '">Value:&nbsp;' + value + '</span>' +
11591162
'Tx:&nbsp;' + Ethplorer.Utils.getEthplorerLink(tx.transactionHash) + '<br>' +
11601163
(from ? ('From:&nbsp;' + from + '<br>To:&nbsp;' + to) : ('Address:&nbsp;' + _address))
11611164
);
@@ -1240,7 +1243,7 @@ Ethplorer = {
12401243
if(pf){
12411244
pf = Ethplorer.Utils.round(pf * oToken.price.rate, 2);
12421245
var usdval = Ethplorer.Utils.formatNum(Math.abs(pf), true, 2, true);
1243-
value = value + '<br><span class="transfer-usd">$ ' + usdval + '</span>';
1246+
value = value + '<br><span class="transfer-usd">$&nbsp;' + usdval + '</span>';
12441247
}
12451248
}
12461249
tdQty.html(value);
@@ -1289,7 +1292,7 @@ Ethplorer = {
12891292
if(pf){
12901293
pf = Ethplorer.Utils.round(pf * oToken.price.rate, 2);
12911294
var usdval = Ethplorer.Utils.formatNum(Math.abs(pf), true, 2, true);
1292-
balance = balance + '<br><span class="transfer-usd">$ ' + usdval + '</span>';
1295+
balance = balance + '<br><span class="transfer-usd">$&nbsp;' + usdval + '</span>';
12931296
}
12941297
}
12951298

@@ -1639,9 +1642,10 @@ Ethplorer = {
16391642
case 'price':
16401643
if(value && value.rate){
16411644
var rate = value;
1642-
var hint = '$' +rate.rate + ' : Updated at ' + Ethplorer.Utils.ts2date(rate.ts, true);
1645+
var hint = 'Updated at ' + Ethplorer.Utils.ts2date(rate.ts, true);
1646+
var price = rate.rate < 0.01 ? rate.rate : Ethplorer.Utils.formatNum(rate.rate, true, 2, true);
16431647

1644-
value = '<span title="' + hint + '">$ ' + Ethplorer.Utils.formatNum(rate.rate, true, 2, true) + '</span><br>';
1648+
value = '<span title="' + hint + '">$&nbsp;' + price + '</span><br>';
16451649

16461650
value = value + '<span class="diff-span">24h<span class="' + getDiffClass(rate.diff) + '">'
16471651
+ getDiffString(rate.diff) +'</span></span>'
@@ -1672,7 +1676,7 @@ Ethplorer = {
16721676
var cls = change > 0 ? 'diff-up' : 'diff-down';
16731677
var diff = "";
16741678
// var diff = change ? (' <span class="' + cls + '">(' + Ethplorer.Utils.round(change, 2) + '%)</span>') : '';
1675-
res = res + '<br /><span class="transfer-usd">$ ' + price + diff + '</span>';
1679+
res = res + '<br /><span class="transfer-usd">$&nbsp;' + price + diff + '</span>';
16761680
}
16771681
}
16781682
value = res;
@@ -2295,10 +2299,10 @@ function getHistUsdPriceString(histPrice, valFloat){
22952299
var usdPrice = '';
22962300
if(histPrice && Ethplorer.showHistoricalPrice && valFloat){
22972301
var hint = 'estimated at tx date';
2298-
var historyPrice = Ethplorer.Utils.formatNum(histPrice, true, 2, true, true);
2302+
// var historyPrice = Ethplorer.Utils.formatNum(histPrice, true, 2, true, true);
22992303
var totalHistoryPrice = Ethplorer.Utils.formatNum(histPrice * valFloat, true, 2, true, true);
23002304

2301-
usdPrice = '<span title="' + hint + '">~$ ' + totalHistoryPrice +'<span class="mrgnl-10">@&nbsp;'+ historyPrice +'</span></span>'
2305+
usdPrice = '<span title="' + hint + '">~$&nbsp;' + totalHistoryPrice +'<span class="mrgnl-10">@&nbsp;'+ histPrice +'</span></span>'
23022306
}
23032307
return usdPrice;
23042308
}

0 commit comments

Comments
 (0)