-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrates.html
98 lines (90 loc) · 4.03 KB
/
rates.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Bitcoin Rates</title>
<style type="text/css">
html, body {
height: 100%;
margin: 0;
padding: 0;
background: #000000;
color: #FF6600; /* ca Text color */
}
#text {
text-align: center;
vertical-align: middle;
font-family: Arial, sans-serif;
font-size:50px;
font-weight:bold;
}
body{
/*width:100%;display:block;position:absolute;*/
background-color:#111;
background-image: radial-gradient(#300 50%, #300 60%,transparent 65%);
background-size:10px 10px;
background-position: 0 0;
/*text-align:center;*/
}
/*
@media screen and (-webkit-min-device-pixel-ratio:0) {
#text{
color: #e00;
background-image: radial-gradient(#f00 50%, #600 60%,transparent 65%);
background-size:5px 5px;
background-position: 0 0;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
*/
.footer a { text-decoration:none;color:white }
.footer a:hover { text-decoration:underline }
</style>
<script type="text/javascript">
//tinyxhr by Shimon Doodkin
function tinyxhr(url,cb,method,post,contenttype){var c=url,a=cb,i=method,f=post,b=contenttype;var d,h;try{h=new XMLHttpRequest()}catch(g){try{h=new ActiveXObject("Msxml2.XMLHTTP")}catch(g){if(console){console.log("tinyxhr: XMLHttpRequest not supported")}return null}}d=setTimeout(function(){h.abort();a(new Error("tinyxhr: aborted by a timeout"),"",h)},10000);h.onreadystatechange=function(){if(h.readyState!=4){return}clearTimeout(d);a(h.status!=200?new Error("tinyxhr: server respnse status is "+h.status):false,h.responseText,h)};h.open(i?i.toUpperCase():"GET",c,true);if(!f){h.send()}else{h.setRequestHeader("Content-type",b?b:"application/x-www-form-urlencoded");h.send(f)}};
Number.prototype.formatMoney = function(c, d, t){
var n = this,
c = isNaN(c = Math.abs(c)) ? 2 : c,
d = d == undefined ? "." : d,
t = t == undefined ? "," : t,
s = n < 0 ? "-" : "",
i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
};
var lastText = "";
function update()
{
tinyxhr("/rates",function (err,data,xhr)
{
if (err) { try{ console.log("goterr ",err,'status='+xhr.status); }catch(e){} }
//console.log(data)
var rates=JSON.parse(data);
var p=5;
var text='Bits of Gold '+(rates.bitsofgold.sell/1000).formatMoney(p, '.', ',')+' <br>'+
'Bit2c '+(rates.bit2c.ll/1000).formatMoney(p, '.', ',')+' <br>'+
'BitGo '+(rates.bitgo.currentSellingPrice/1000).formatMoney(p, '.', ',')+'<br>'+
'Bitcoin Average '+(rates.bitcoinaverageUSD.ask/1000).formatMoney(p, '.', ',')+' USD='+(rates.bitcoinaverageUSD.ask*rates.dollar[1]/1000).formatMoney(p, '.', ',')+' ILS<br>'+
'Bitcoin Average '+(rates.bitcoinaverageEUR.ask/1000).formatMoney(p, '.', ',')+' EUR='+(rates.bitcoinaverageEUR.ask*rates.euro[1]/1000).formatMoney(p, '.', ',')+' ILS<br>'+
'Bitstamp '+(rates.bitstamp.ask/1000).formatMoney(p, '.', ',')+' USD='+(rates.bitstamp.ask*rates.dollar[1]/1000).formatMoney(p, '.', ',')+' ILS<br>'+
'Btc-e '+(rates.btce.ticker.sell/1000).formatMoney(p, '.', ',')+' USD='+(rates.btce.ticker.sell*rates.dollar[1]/1000).formatMoney(p, '.', ',')+' ILS<br>' +
'Bitpay '+(rates.bitpay.filter(function(a){return a.code=='USD'})[0].rate/1000).formatMoney(p, '.', ',')+' USD='+(rates.bitpay.filter(function(a){return a.code=='ILS'})[0].rate/1000).formatMoney(p, '.', ',')+' ILS<br>'
if (lastText != text)
{
document.getElementById('text').innerHTML=text
lastText = text;
}
});
}
window.onload=function(){update();setInterval(update, 1000);};
</script>
</head>
<body>
<div style="width:100%; height:80%; display:table">
<div id="text" style="width:100%; height:80%; display:table-cell"></div>
</div>
<div class="footer" align="center"><span style="color:white">send tips to me: 1QJybGtq3wA3vz8izWvDMRTsrQL3RVDK9T</span></div>
</body>
</html>