diff --git a/public/js/analytics.js b/public/js/analytics.js new file mode 100644 index 00000000..e04085e3 --- /dev/null +++ b/public/js/analytics.js @@ -0,0 +1,5 @@ + window.dataLayer = window.dataLayer || []; + function gtag(){dataLayer.push(arguments);} + gtag('js', new Date()); + + gtag('config', 'UA-111639102-2'); diff --git a/public/js/price.js b/public/js/price.js new file mode 100644 index 00000000..afd62911 --- /dev/null +++ b/public/js/price.js @@ -0,0 +1,18 @@ +function process_data(response){ + console.log(response); + console.log(response[0]); + var priceUSD = response[0]["price_usd"]; + //var priceJPY = response[0]["price_jpy"]; + var priceBTC = response[0]["price_btc"]; + document.getElementById("price-usd").innerHTML = parseFloat(priceUSD).toFixed(2); + // document.getElementById("price-jpy").innerHTML = parseFloat(priceJPY).toFixed(2); + document.getElementById("price-btc").innerHTML = priceBTC; + }; + +var $j = jQuery.noConflict(); + $j(document).ready(function() { + const http = new XMLHttpRequest() + http.open("GET", "https://api.coinmarketcap.com/v1/ticker/ellaism/?convert=eur"); + http.send(); + http.onload = () => process_data(JSON.parse(http.responseText)); + }); diff --git a/public/siteicon.png b/public/siteicon.png new file mode 100644 index 00000000..37fc060d Binary files /dev/null and b/public/siteicon.png differ diff --git a/views/index.pug b/views/index.pug index aaf7d0a1..1587129d 100644 --- a/views/index.pug +++ b/views/index.pug @@ -1,13 +1,36 @@ extends layout - block content + div(class="row", style="margin-top:15px;") + + div(class="row text-center text-lg-left", style="margin-top:30px;") + div(class="well well-sm col-sm-3 ") + h5 + span(class="glyphicon glyphicon-usd", style="margin-right:2pt;") + | Price + p + span(id="price-btc") + | ₿  |  + span(id="price-usd") + | $ + div(class="well well-sm col-sm-3 col-sm-offset-1") + h5 + span(class="glyphicon glyphicon-record", style="margin-right:2pt;") + | Difficulty + p #{(diff/1e12).toFixed(2)}TH + div(class="well well-sm col-sm-3 col-sm-offset-1") + h5 + span(class="glyphicon glyphicon-flash", style="margin-right:2pt;") + | Hashrate + p #{(diff/15/1e9).toFixed(2)}G -> #{(diff/13/1e9).toFixed(2)}G + h3 Recent blocks - table.table + + table.table(class='table-responsive table-striped') thead tr th Number th Miner - th Timestamp + th Time th # Tx th # Uncles tbody @@ -15,16 +38,23 @@ block content tr td a(href="/block/" + block.number) #{block.number} - td - a(href="/account/" + block.author) #{nameformatter.format(block.author)} - td #{moment.unix(block.timestamp).format()} + td + a(href="/account/" + block.author) + - var dataURL = blockies.createDataURL({ seed: block.author}) + img(src=dataURL,class="img-rounded space-right") + |#{nameformatter.format(block.author)} + - var duration = moment().diff(moment.unix(block.timestamp), 'seconds'); + if duration < 50 + td #{duration} seconds ago + else + td #{moment.unix(block.timestamp).fromNow()} td #{block.transactions.length} td #{block.uncles.length} h3 Recent Transactions if txs.length === 0 p No transactions during the last 10 blocks else - table.table + table.table(class='table-responsive table-striped') thead tr th Hash @@ -37,10 +67,16 @@ block content td a(href="/tx/" + tx.hash) #{tx.hash.substr(0,10)}... td - a(href="/account/" + tx.from) #{nameformatter.format(tx.from)} + a(href="/account/" + tx.from) + - var dataURL = blockies.createDataURL({ seed: tx.from }) + img(src=dataURL,class="img-rounded space-right") + |#{nameformatter.format(tx.from)} td if tx.to - a(href="/account/" + tx.to) #{nameformatter.format(tx.to)} + a(href="/account/" + tx.to) + - var dataURL = blockies.createDataURL({ seed: tx.to }) + img(src=dataURL,class="img-rounded space-right") + | #{nameformatter.format(tx.to)} else | New Contract - td #{ethformatter(tx.value)} \ No newline at end of file + td #{ethformatter(tx.value)} diff --git a/views/layout.pug b/views/layout.pug index b13d83f1..61ef692a 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -7,11 +7,17 @@ html(lang="en") // The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags meta(name='description', content='The explorer for the Ellaism blockchain') + meta(name='author', content='ellaism') + meta(name='keywords', content='ethereum, explorer, blockchain, Ellaism , Ella, etherchain, cryptocurrency, cryptocurrencies, bitcoin') - title Ellaism Explorer + title Ellaism Block Explorer link(rel='stylesheet', href='/stylesheets/theme.css') link(rel='stylesheet', href='/stylesheets/style.css') + script(src='/js/analytics.js') + script(src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js") + script(src="https://files.coinmarketcap.com/static/widget/currency.js") + script(src='/js/price.js') link(rel="icon", type="image/png", href="https://www.gravatar.com/avatar/98abb59df18a837592a8079e31fd9c47?s=16", sizes="16x16") link(rel="icon", type="image/png", href="https://www.gravatar.com/avatar/98abb59df18a837592a8079e31fd9c47?s=32", sizes="32x32") @@ -60,6 +66,34 @@ html(lang="en") a(href='/contract/verify') Verify Contract li a(href='/signature/verify') Verify Signature + li + a(href='https://ellaism.github.io/ellawallet/') Web Wallet + li + a(href='https://stats.ellaism.org/') Network Stats + li.dropdown + a.dropdown-toggle(href='#', data-toggle='dropdown', role='button', aria-haspopup='true', aria-expanded='false') + | Pools + span.caret + ul.dropdown-menu + li + a(href='https://pool.ellaism.org/') Dev Pool + li + a(href='https://pool.ellaism.io/') Ellaism.io + li + a(href='http://ella.minerpool.net/') MinerPool + li + a(href='http://ella.cryptobitpool.eu/') Cryptobitpool + li + a(href='http://ella.pool.sexy/#/') Pool Sexy + li + a(href='http://ella.cryptopools.info/') Cryptopools + li + a(href='https://ella.epool.io/') Epool.io + li + a(href='http://ellaismpool.com/') Ellaismpool + li + a(href='https://minerpool.net/pools/ellaism/') Full list + form.navbar-form.navbar-right(action="/search", method="POST") .form-group @@ -80,5 +114,5 @@ html(lang="en") hr footer p - a(href="https://github.com/ellaism/etherchain-light") Etherchain Light + a(href="https://github.com/ellaism/etherchain-light") Ellaism Block Explorer. | | #{nodeStatus.version} | #{nodeStatus.nbrPeers} Peers connected