diff --git a/.gitignore b/.gitignore index aabec27..7321330 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,5 @@ npm-debug.log .DS_Store public/lib/* +db/* diff --git a/app/controllers/currency.js b/app/controllers/currency.js index e635a7b..244ef32 100644 --- a/app/controllers/currency.js +++ b/app/controllers/currency.js @@ -40,11 +40,6 @@ exports.index = function(req, res) { // Init var currentTime = +new Date(); - console.log('-----------------------------------'); - console.log(timestamp); - console.log(currentTime); - console.log(currentTime >= (timestamp + delay)); - console.log('-----------------------------------'); if (bitstampRate === 0 || currentTime >= (timestamp + delay)) { timestamp = currentTime; @@ -53,19 +48,13 @@ exports.index = function(req, res) { res.jsonp({ status: 200, - data: { - bitstamp: bitstampRate, - delay: delay - } + data: { bitstamp: bitstampRate } }); }); } else { res.jsonp({ status: 200, - data: { - bitstamp: bitstampRate, - delay: delay - } + data: { bitstamp: bitstampRate } }); } }; diff --git a/app/controllers/transactions.js b/app/controllers/transactions.js index e69b76d..a86f71e 100644 --- a/app/controllers/transactions.js +++ b/app/controllers/transactions.js @@ -50,10 +50,12 @@ var getTransaction = function(txid, cb) { } if (!tx || !tx.info) { -console.log('[transactions.js.48]:: TXid %s not found in RPC. CHECK THIS.', tx.txid); //TODO +console.log('[transactions.js.48]:: TXid %s not found in RPC. CHECK THIS.', txid); //TODO // not check this. no - tx.info = { - txid: tx.txid + tx = { + info: { + txid: txid + } }; } diff --git a/app/views/includes/foot.jade b/app/views/includes/foot.jade index 323f372..23b6ce8 100755 --- a/app/views/includes/foot.jade +++ b/app/views/includes/foot.jade @@ -1,21 +1,21 @@ #footer(data-ng-include="'/views/includes/footer.html'", role='navigation') script(type='text/javascript', src='/socket.io/socket.io.js') -script(type='text/javascript', src='/lib/momentjs/moment.js') +script(type='text/javascript', src='/lib/momentjs/min/moment.min.js') script(type='text/javascript', src='/lib/qrcode-generator/js/qrcode.js') script(type='text/javascript', src='/lib/zeroclipboard/ZeroClipboard.min.js') //AngularJS -script(type='text/javascript', src='/lib/angular/angular.js') -script(type='text/javascript', src='/lib/angular-resource/angular-resource.js') -script(type='text/javascript', src='/lib/angular-route/angular-route.js') +script(type='text/javascript', src='/lib/angular/angular.min.js') +script(type='text/javascript', src='/lib/angular-resource/angular-resource.min.js') +script(type='text/javascript', src='/lib/angular-route/angular-route.min.js') script(type='text/javascript', src='/lib/angular-qrcode/qrcode.js') -script(type='text/javascript', src='/lib/angular-animate/angular-animate.js') +script(type='text/javascript', src='/lib/angular-animate/angular-animate.min.js') //Angular UI -script(type='text/javascript', src='/lib/angular-bootstrap/ui-bootstrap.js') -script(type='text/javascript', src='/lib/angular-bootstrap/ui-bootstrap-tpls.js') -script(type='text/javascript', src='/lib/angular-ui-utils/ui-utils.js') +script(type='text/javascript', src='/lib/angular-bootstrap/ui-bootstrap.min.js') +script(type='text/javascript', src='/lib/angular-bootstrap/ui-bootstrap-tpls.min.js') +script(type='text/javascript', src='/lib/angular-ui-utils/ui-utils.min.js') //Application Init script(type='text/javascript', src='/js/app.js') @@ -35,11 +35,12 @@ script(type='text/javascript', src='/js/services/currency.js') //Application Controllers script(type='text/javascript', src='/js/controllers/index.js') script(type='text/javascript', src='/js/controllers/header.js') +script(type='text/javascript', src='/js/controllers/search.js') script(type='text/javascript', src='/js/controllers/blocks.js') script(type='text/javascript', src='/js/controllers/transactions.js') script(type='text/javascript', src='/js/controllers/address.js') -script(type='text/javascript', src='/js/controllers/search.js') script(type='text/javascript', src='/js/controllers/status.js') script(type='text/javascript', src='/js/controllers/footer.js') script(type='text/javascript', src='/js/controllers/connection.js') +script(type='text/javascript', src='/js/controllers/currency.js') script(type='text/javascript', src='/js/init.js') diff --git a/public/css/common.css b/public/css/common.css index f84e5a6..9a1fa2f 100644 --- a/public/css/common.css +++ b/public/css/common.css @@ -196,25 +196,24 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { .block-id { background-color: #373D42; border: 3px solid #FFFFFF; - height: 165px; - margin: 10px auto; + margin: 0 auto; width: 165px; + color: #fff; + text-align: center; + font-size: 80px; } -.block-id h1 { +.block-id span { + margin-top: 10px; +} + +.block-id h2 { color: #FFFFFF; font-weight: bold; line-height: 30px; - text-align: center; - font-size: 24px; -} - -.block-id h3 { - color: #FFFFFF; - font-weight: bold; - line-height: 30px; - text-align: center; font-size: 24px; + margin-top: 0; + margin-bottom: 10px; } .icon-block { @@ -223,6 +222,10 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { margin-top: 10px; } +.icon-block h3 { + color: #fff; +} + .block-tx { -moz-border-radius: 2px; -webkit-border-radius: 2px; @@ -231,6 +234,7 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { margin: 20px 0 10px; overflow: hidden; padding: 15px; + border: 1px solid #ccc; } .btn { @@ -267,6 +271,30 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { border: 2px solid #6C0000; } +.label { + padding: .7em 2em; + font-size: 13px; + text-transform: uppercase; + font-weight:100; +} + +.label-primary { + background-color: #8DC429; +} + +.label-default { + background-color: #ffffff; + color: #333; +} + +.label-success { + background-color: #2FA4D7; +} + +.label-danger { + background-color: #AC0015; +} + .progress-bar-info { background-color: #8DC429; } /* Set the fixed height of the footer here */ @@ -278,9 +306,10 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { overflow: hidden; } -#footer .currency a:active { - color: #fff; +.currency a.active { + color: #000; text-decoration: underline; + cursor: default; } #footer a.insight { @@ -303,7 +332,7 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { .line-mid { padding: 15px 0;} .line-top { border-top: 1px solid #EAEAEA; - padding: 15px 0; + padding: 15px 0 0 0; } /* Custom page CSS @@ -412,14 +441,38 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { width: 30px; } .btn-copy { margin-left: 5px; } +.btn-copy .tooltip { + display: inline-block; + margin-left: 10px; + margin-top: -2px; + opacity: 0; +} +.btn-copy.zeroclipboard-is-hover { color: #2a6496; } +.btn-copy.zeroclipboard-is-active .tooltip { opacity: 1; } .btn-expand { margin-right: 5px; } +@media (max-width: 991px) { + .btn-copy { + display: none; + } +} + +.txid { + line-height: 26px; +} + +.tx-id { + background-color: #373D42; + border: 3px solid #FFFFFF; + margin: 0 auto; + width: 165px; + color: #FFFFFF; + font-size: 80px; + text-align: center; +} + .transaction-vin-vout .ellipsis { margin-bottom: 10px; } .transaction-vin-vout .btc-value { margin-left: 15px; } .page-header { margin-top: 0; } -.block_hash { - margin-left: 46px; - text-align: center; -} diff --git a/public/img/icons/favicon.ico b/public/img/icons/favicon.ico index 93d1349..7e25304 100644 Binary files a/public/img/icons/favicon.ico and b/public/img/icons/favicon.ico differ diff --git a/public/js/config.js b/public/js/config.js index 4d3a625..b5399ad 100755 --- a/public/js/config.js +++ b/public/js/config.js @@ -53,5 +53,6 @@ angular.module('insight') $rootScope.titleDetail = ''; $rootScope.title = $route.current.title; $rootScope.isCollapsed = true; + $rootScope.currentAddr = null; }); }); diff --git a/public/js/controllers/connection.js b/public/js/controllers/connection.js index ae94e0e..b30850a 100644 --- a/public/js/controllers/connection.js +++ b/public/js/controllers/connection.js @@ -4,6 +4,7 @@ angular.module('insight.connection').controller('ConnectionController', function($scope, $window, Status, Sync, getSocket) { // Set initial values + $scope.apiOnline = true; $scope.serverOnline = true; $scope.clienteOnline = true; @@ -22,7 +23,7 @@ function($scope, $window, Status, Sync, getSocket) { $scope.getConnStatus = function() { Sync.get({}, function(sync) { - $scope.apiOnline = (sync.status !== 'aborted' && sync.status !== 'error') ? true : false; + $scope.apiOnline = (sync.status !== 'aborted' && sync.status !== 'error'); }, function() { $scope.apiOnline = false; @@ -31,7 +32,7 @@ function($scope, $window, Status, Sync, getSocket) { socket.emit('subscribe', 'sync'); socket.on('status', function(sync) { - $scope.apiOnline = (sync.status !== 'aborted' && sync.status !== 'error') ? true : false; + $scope.apiOnline = (sync.status !== 'aborted' && sync.status !== 'error'); }); // Check for the client conneciton diff --git a/public/js/controllers/currency.js b/public/js/controllers/currency.js new file mode 100644 index 0000000..ad68f95 --- /dev/null +++ b/public/js/controllers/currency.js @@ -0,0 +1,51 @@ +'use strict'; + +angular.module('insight.currency').controller('CurrencyController', + function($scope, $rootScope, Currency) { + + var _roundFloat = function(x, n) { + if(!parseInt(n, 10) || !parseFloat(x)) n = 0; + + return Math.round(x * Math.pow(10, n)) / Math.pow(10, n); + }; + + $rootScope.currency.getConvertion = function(value) { + if (typeof value !== 'undefined' && value !== null) { + var response; + + if (this.symbol === 'USD') { + response = _roundFloat((value * this.factor), 2); + } else if (this.symbol === 'mBTC') { + this.factor = 1000; + response = _roundFloat((value * this.factor), 5); + } else { + this.factor = 1; + response = value; + } + + return response + ' ' + this.symbol; + } + + return 'value error'; + }; + + $scope.setCurrency = function(currency) { + $rootScope.currency.symbol = currency; + + if (currency === 'USD') { + Currency.get({}, function(res) { + $rootScope.currency.factor = $rootScope.currency.bitstamp = res.data.bitstamp; + }); + } else if (currency === 'mBTC') { + $rootScope.currency.factor = 1000; + } else { + $rootScope.currency.factor = 1; + } + }; + + // Get initial value + Currency.get({}, function(res) { + $rootScope.currency.bitstamp = res.data.bitstamp; + }); + + }); diff --git a/public/js/controllers/footer.js b/public/js/controllers/footer.js index 8ad61ab..047ba1e 100644 --- a/public/js/controllers/footer.js +++ b/public/js/controllers/footer.js @@ -1,54 +1,7 @@ 'use strict'; angular.module('insight.system').controller('FooterController', - function($rootScope, $scope, Version, Currency) { - - var _roundFloat = function(x, n) { - if(!parseInt(n, 10)) n = 0; - - if(!parseFloat(x)) return false; - - return Math.round(x * Math.pow(10, n)) / Math.pow(10, n); - }; - - $rootScope.currency = { - factor: 1, - symbol: 'BTC', - bitstamp: 0, - getConversion: function(value) { - if (value !== 'undefined' && value !== null) { - var response; - - if (this.symbol === 'USD') { - response = _roundFloat((value * this.factor), 2); - } else if (this.symbol === 'mBTC') { - this.factor = 1000; - response = _roundFloat((value * this.factor), 5); - } else { - this.factor = 1; - response = value; - } - - return response + ' ' + this.symbol; - } - - return null; - } - }; - - $scope.setCurrency = function(currency) { - if (currency === 'USD') { - Currency.get({}, function(res) { - $rootScope.currency.factor = res.data.bitstamp; - }); - } else if (currency === 'mBTC') { - $rootScope.currency.factor = 1000; - } else { - $rootScope.currency.factor = 1; - } - - $rootScope.currency.symbol = currency; - }; + function($scope, Version) { var _getVersion = function() { Version.get({}, diff --git a/public/js/controllers/header.js b/public/js/controllers/header.js index 25f2d0b..7147272 100755 --- a/public/js/controllers/header.js +++ b/public/js/controllers/header.js @@ -1,10 +1,14 @@ 'use strict'; angular.module('insight.system').controller('HeaderController', - function($scope, $rootScope, getSocket, Global, Block, Currency) { + function($scope, $rootScope, getSocket, Global, Block) { $scope.global = Global; - Currency.get(); + $rootScope.currency = { + factor: 1, + bitstamp: 0, + symbol: 'BTC' + }; $scope.menu = [ { diff --git a/public/js/controllers/transactions.js b/public/js/controllers/transactions.js index 5d4da03..0107c56 100644 --- a/public/js/controllers/transactions.js +++ b/public/js/controllers/transactions.js @@ -75,7 +75,7 @@ function($scope, $rootScope, $routeParams, $location, Global, Transaction, Trans tx.voutSimple = _aggregateItems(tx.vout); }; - var _paginate = function (data) { + var _paginate = function(data) { $scope.loading = false; pagesTotal = data.pagesTotal; diff --git a/public/js/directives.js b/public/js/directives.js index 2d90b27..ed0b1cf 100755 --- a/public/js/directives.js +++ b/public/js/directives.js @@ -39,6 +39,7 @@ angular.module('insight') return { restric: 'A', scope: { clipCopy: '=clipCopy' }, + template: '
Copied!
', link: function(scope, elm) { var clip = new ZeroClipboard(elm); @@ -48,6 +49,9 @@ angular.module('insight') }; client.on('mousedown', onMousedown); + client.on('noflash wrongflash', function() { + return elm.remove(); + }); scope.$on('$destroy', function() { client.off('mousedown', onMousedown); diff --git a/public/views/address.html b/public/views/address.html index 76c06ff..4c5e9df 100644 --- a/public/views/address.html +++ b/public/views/address.html @@ -5,10 +5,10 @@

Address

-
- - {{address.addrStr}} -
+
+
+ + {{address.addrStr}}

Summary

@@ -16,15 +16,15 @@ Total Received - {{address.totalReceived}} BTC + {{$root.currency.getConvertion(address.totalReceived)}} Total Sent - {{address.totalSent}} BTC + {{$root.currency.getConvertion(address.totalSent)}} Final Balance - {{address.balance}} BTC + {{$root.currency.getConvertion(address.balance)}} No. Transactions @@ -33,6 +33,7 @@
+
diff --git a/public/views/block.html b/public/views/block.html index 53e4aae..07662f5 100644 --- a/public/views/block.html +++ b/public/views/block.html @@ -2,15 +2,14 @@
+

Block

-
- -
-

Block #{{ block.height }}

+ +

#{{ block.height }}

Hashes

@@ -31,6 +30,7 @@
+
diff --git a/public/views/includes/currency.html b/public/views/includes/currency.html new file mode 100644 index 0000000..c9acb46 --- /dev/null +++ b/public/views/includes/currency.html @@ -0,0 +1,8 @@ +
+ + Currency: + USD · + BTC · + mBTC + +
diff --git a/public/views/includes/footer.html b/public/views/includes/footer.html index 5395a66..e87127e 100644 --- a/public/views/includes/footer.html +++ b/public/views/includes/footer.html @@ -1,9 +1,3 @@
-
- Currency: - USD - - BTC - - mBTC -
Insight API v{{version}}
diff --git a/public/views/transaction.html b/public/views/transaction.html index abb4533..bcf0074 100644 --- a/public/views/transaction.html +++ b/public/views/transaction.html @@ -1,55 +1,58 @@
-

- Transaction - View information about a bitcoin transaction -

- -
-
-
- -
-
-

Summary

- - - - - - - - - - - - -
Size {{tx.size}} (bytes)
Received Time {{tx.time * 1000|date:'medium'}}
Block - - - {{tx.blockhash}} -
+
+
+

Transaction

+
+
-
+
+ + +
+

Summary

+ + + + + + + + + + + +
Size {{tx.size}} (bytes)
Received Time {{tx.time * 1000|date:'medium'}}
+
+
+
+

+ Details + View information about a bitcoin transaction +

+
+
+
+

Inputs and Outputs

- + - + - +
Total Input{{tx.valueIn}} BTC{{$root.currency.getConvertion(tx.valueIn)}}
Total Output{{tx.valueOut}} BTC{{$root.currency.getConvertion(tx.valueOut)}}
Fees{{tx.fees}} BTC{{$root.currency.getConvertion(tx.fees)}}
-
- diff --git a/public/views/transaction/list.html b/public/views/transaction/list.html index 76bf5b4..ac81fd6 100644 --- a/public/views/transaction/list.html +++ b/public/views/transaction/list.html @@ -1,5 +1,5 @@
There are not transactions
-
+
diff --git a/public/views/transaction/tx.html b/public/views/transaction/tx.html index 0b7062e..e5eddc7 100644 --- a/public/views/transaction/tx.html +++ b/public/views/transaction/tx.html @@ -1,102 +1,119 @@ -
- - - {{tx.txid}} - +
+
+ + +
-
-
-
-
-
{{$root.currency.getConversion(vin.reward)}}
+
+ +
+
+
+
+
+
+
{{$root.currency.getConvertion(vin.reward)}}
+
+ No Inputs (Newly Generated Coins) +
+
+
+
+
+
+
{{$root.currency.getConvertion(vin.value)}}
- No Inputs (Newly Generated Coins) + {{vin.addr}} + {{vin.addr}} + {{vin.addr}}
-
-
-
-
{{$root.currency.getConversion(vin.value)}}
-
- {{vin.addr}} - {{vin.addr}} - {{vin.addr}} -
+
+
+
{{$root.currency.getConvertion(vin.value)}}
+
+    + {{vin.addr}} + {{vin.addr}}
-
-
-
{{$root.currency.getConversion(vin.value)}}
-
-    - {{vin.addr}} - {{vin.addr}} -
-
-
-
-
- - scriptSig - {{vin.scriptSig.asm}} - -
-
-
-
-
-
- - -
-
-
-
-
{{$root.currency.getConversion(vout.value)}}
-
- {{vout.addr}} - {{vout.addr}} - {{address}} -
-
-
-
-
-
{{$root.currency.getConversion(vout.value)}}
- -
-
-
-
- -

- Type - {{vout.scriptPubKey.type}} -

-

- scriptPubKey - {{vout.scriptPubKey.asm}} -

-
-
+
+
+
+ + scriptSig + {{vin.scriptSig.asm}} +
-
- Fees: {{tx.fees}} -
- - - + + +
+
+
+
+
{{$root.currency.getConvertion(vout.value)}}
+
+ {{vout.addr}} + {{vout.addr}} + {{address}} +
+
+
+
+
+
{{$root.currency.getConvertion(vout.value)}}
+ +
+
+
+
+ +

+ Type + {{vout.scriptPubKey.type}} +

+

+ scriptPubKey + {{vout.scriptPubKey.asm}} +

+
+
+
+
+
+
+
+
+ + BlockHash + {{tx.blockhash}} + + +
+
+
+
+ Fees: {{$root.currency.getConvertion(tx.fees)}} +
+
+ {{tx.confirmations}} Confirmations + Unconfirmed Transaction! + {{$root.currency.getConvertion(tx.valueOut)}} +
+