Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
68 lines (61 sloc) 2.21 KB
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Crypti</title>
<link rel="stylesheet" href="css/main.css" />
<link rel="stylesheet" href="css/animate.css" />
<!-- Material icons font hosted by Google -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<!-- Material icons CSS toolkit -->
<link rel="stylesheet" href="node_modules/material-icons/css/material-icons.min.css">
</head>
<body>
<div id="drag-region"></div>
<!--<i class="mi mi-info-outline" id="info"></i>-->
<h1 id="btcPrice">Searching</h1>
<div class="refresh-control">
<span id="timer"></span>
</div>
<img id="btc-icon" src="images/btc-icon.svg" />
<p style="float: left;">USD - BTC</p>
<div class="refresh-bar">
<div id="progress"></div>
</div>
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<span class="close">&times;</span>
<p>Some text in the Modal..</p>
</div>
</div>
</body>
<script>
// You can also require other files to run in this process
require('./renderer.js')
var currentPrice = document.getElementById('btcPrice');
var counter = 60;
var progress = 0;
var request = require('request');
request('https://api.coinmarketcap.com/v1/ticker/bitcoin/', function(error, response, body) {
currentPrice.innerHTML = '$' + JSON.parse(body)[0].price_usd;
});
var requestLoop = setInterval(function() {
//document.getElementById('timer').innerHTML = Math.ceil(counter);
document.getElementById('progress').style.width = progress/60*100 + "%";
if(counter === 0) {
request('https://api.coinmarketcap.com/v1/ticker/bitcoin/', function(error, response, body) {
currentPrice.innerHTML = '$' + JSON.parse(body)[0].price_usd;
});
counter = 60;
progress = 0;
}
counter--
progress++
}, 1000);
</script>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
</html>