aboutsummaryrefslogtreecommitdiffstats
path: root/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'index.html')
-rw-r--r--index.html111
1 files changed, 11 insertions, 100 deletions
diff --git a/index.html b/index.html
index 4593e9b7..8d3d6785 100644
--- a/index.html
+++ b/index.html
@@ -3,108 +3,18 @@
<head>
<meta charset="utf-8" />
<title>Bitcoin Payment Calculator</title>
- <script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
- <script src="qr.js"></script>
-
- <script language="javascript" type="text/javascript">
- $(function() {
- var websocket = new WebSocket("ws://api.blockchain.info:8335/inv");
- var exchange = 0;
- var total = 0;
- var received = 0;
- var address = getParameterByName('address');
-
- setupqr();
-
- if (address == "")
- window.location = 'index.html?address=1SoLtySab29J2tAdF2x3PosjnwWF37wEY'
-
- $('#address').html(address);
-
- websocket.onopen = function() {
- websocket.send('{"op":"addr_sub", "addr":"' + address + '"}');
- }
-
- websocket.onmessage = function(e) {
- var results = eval('(' + e.data + ')');
- var from_address = '';
-
- $.each(results.x.out, function(i, v) {
- if (v.addr == address) {
- received += v.value / 100000000;
- }
- });
-
- $.each(results.x.inputs, function(i, v) {
- from_address = v.prev_out.addr
- if (v.prev_out.addr == address) {
- input -= v.prev_out.value / 100000000;
- }
- });
-
- $('#status').html('Received: ' + received.toString());
- if (total <= received) {
- $('#status').css('color', 'green');
- }
-
- $.get('record_transaction.php',
- {
- address: from_address,
- date: getFormattedDate(),
- received: received,
- exchange: exchange
- }
- );
- }
-
- $.getJSON('ticker.json', function (data) {
- exchange = 100 / data.out;
- exchange = exchange + exchange * 0.03;
- exchange = Math.ceil(exchange * 100) / 100;
- $('#exchange').html(exchange);
- updateTotal();
- });
-
- $('#owing').keyup(updateTotal);
- $('#owing').focus();
-
- function updateTotal() {
- var owing = parseFloat($('#owing').val());
- total = owing / exchange;
- total = Math.ceil(total * 10000) / 10000;
- if (!$.isNumeric(total)) total = '';
- $('#total').html(total.toString());
- doqr('bitcoin:' + address + '?amount=' + total.toString());
- }
- });
-
- function getParameterByName(name) {
- name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
- var regexS = "[\\?&]" + name + "=([^&#]*)";
- var regex = new RegExp(regexS);
- var results = regex.exec(window.location.search);
- if(results == null)
- return "";
- else
- return decodeURIComponent(results[1].replace(/\+/g, " "));
- }
-
- function getFormattedDate() {
- var date = new Date();
- var str = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
-
- return str;
- }
- </script>
-
- <style>
- body, input { font-family: 'Arial'; font-size: 20px; }
- body { width: 100% }
- #total { font-size: 32px; }
- #status { color: red }
- </style>
+ <link href="css/bootstrap.min.css" rel="stylesheet" />
+ <link href="css/bootstrap-responsive.min.css" rel="stylesheet" />
+ <script src="js/jquery-1.8.2.min.js"></script>
+ <script src="js/qr.js"></script>
+ <script src="js/bootstrap.min.js"></script>
+ <script src="js/bitcoin.js"></script>
</head>
<body>
+ <div class="container">
+
+ <img src="img/banner.jpg" />
+
<div>
$<input type="text" id="owing" value="0" size="4" /> CAD @
<span id="exchange"></span>
@@ -130,5 +40,6 @@
<span id="status">Waiting for Payment</span>
</div>
+ </div> <!-- /container -->
</body>
</html>