Skip to content

Commit

Permalink
Few fixes:
Browse files Browse the repository at this point in the history
- handle IX messages (IX bubbles have different collor and 2x speed)
- add IX to debug mode
- small changes to the way donations are handled
- small changes to title and keywords
  • Loading branch information
UdjinM6 committed Feb 10, 2016
1 parent 84818c3 commit d0f225f
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 18 deletions.
4 changes: 2 additions & 2 deletions bitlisten.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bitlisten.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>BitListen - Dash Transaction Visualizer</title>
<title>Dash Transaction Visualizer</title>
<meta name="description" content="Realtime Dash transaction visualizer. See and hear new transactions, trades and blocks as they occur.">
<meta name="keywords" content="BitListen,Listen To Dash,Dash,transactions,visualizer,trades,mtgox,blockchain">
<meta name="keywords" content="Listen To Dash,Dash,transactions,visualizer,poloniex,bitstamp,blockchain">
<link rel="stylesheet" type="text/css" href="jquery.nouislider.custom.css">
<link rel="stylesheet" type="text/css" href="engine.css">
<!--[if IE]>
Expand Down
7 changes: 5 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ $(document).ready(function() {
volume = Math.random() * 1000;
}

if (Math.random() < 0.5)
new Transaction(volume, false);
var randType = Math.random();
if (randType < 0.5)
new Transaction(volume, Math.random() < 0.1);
else if (randType < 0.8)
new Transaction(volume, false, null, null, true);
else
new Transaction(volume, false, volume * 75, 'USD');
}
Expand Down
23 changes: 16 additions & 7 deletions src/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ TransactionSocket.init = function() {
});


function newTx(bitcoins) {
new Transaction(bitcoins);
function newTx(bitcoins, isDonation, currency, currencyName, isIX) {
new Transaction(bitcoins, isDonation, currency, currencyName, isIX);
}

connection.on("tx", function(data){
function spawnTransaction(data, isIX){
// console.log('insight.masternode.io:3000: tx data: ' + JSON.stringify(data) + ' vout length: ' + data.vout.length);

// Dash volume is quite low - show bubble for every output
Expand All @@ -52,10 +52,10 @@ TransactionSocket.init = function() {
// transacted += vout[i][Object.keys(vout[i])];
// console.log('insight.masternode.io:3000: tx data: ' + Object.keys(vout[i]) + ' ' + vout[i][Object.keys(vout[i])]);
var bitcoins = vout[i][Object.keys(vout[i])] / satoshi;
if (Object.keys(vout[i]) == DONATION_ADDRESS)
new Transaction(bitcoins, true);
else
setTimeout(newTx(bitcoins), Math.random() * DELAY_CAP);
setTimeout(newTx(bitcoins,
Object.keys(vout[i]) == DONATION_ADDRESS,
'', '', isIX),
isIX ? 0 : Math.random() * DELAY_CAP);
// console.log('insight.masternode.io:3000: tx data: ' + transacted);
}

Expand All @@ -77,7 +77,16 @@ TransactionSocket.init = function() {
// setTimeout(function() {
// new Transaction(bitcoins);
// }, Math.random() * DELAY_CAP);
}

connection.on("tx", function(data){
spawnTransaction(data, false);
});

connection.on("ix", function(data){
spawnTransaction(data, true);
});

connection.on("block", function(blockHash){
// console.log('insight.masternode.io:3000: blockHash: ' + blockHash);
$.getJSON('http://insight.masternode.io:3000/api/block/' + blockHash, function(blockData) {
Expand Down
13 changes: 9 additions & 4 deletions src/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @constructor
* @extends Floatable
*/
function Transaction(bitcoins, highlight, currency, currencyName) {
function Transaction(bitcoins, isDonation, currency, currencyName, isIX) {
if (document.visibilityState === "visible") {
Floatable.call(this);

Expand All @@ -20,11 +20,16 @@ function Transaction(bitcoins, highlight, currency, currencyName) {
bitcoinString = "<span class='bitcoinsymbol'>&nbsp;&nbsp;&nbsp;</span>" + bitcoinVal;
}

if (!highlight) {
if(isIX) {
this.velocity.y = -2;
this.addText('<span style="color: cyan;">' + bitcoinString + '</span><br />');
} else
this.addText(bitcoinString);
} else {
this.addText('<span style="color: yellow;">' + bitcoinString + '</span><br /><span style="color: cyan;">Donation</span><br /><span style="color: lime;">Thanks!</span>');

if (isDonation) {
this.addText('<br /><span style="color: yellow;">Donation</span><br /><span style="color: lime;">Thanks!</span>');
}

if (currency && currencyName) {
this.addText('<br />' + currency.toFixed(2) + ' ' + currencyName);
}
Expand Down

0 comments on commit d0f225f

Please sign in to comment.