commit
47486b73db
35
Gruntfile.js
35
Gruntfile.js
@ -3,23 +3,16 @@
|
||||
module.exports = function(grunt) {
|
||||
|
||||
//Load NPM tasks
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-css');
|
||||
grunt.loadNpmTasks('grunt-markdown');
|
||||
grunt.loadNpmTasks('grunt-macreload');
|
||||
|
||||
// Project Configuration
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
jshint: {
|
||||
all: {
|
||||
src: ['Gruntfile.js', 'public/src/js/**/*.js'],
|
||||
options: {
|
||||
jshintrc: true
|
||||
}
|
||||
}
|
||||
},
|
||||
concat: {
|
||||
options: {
|
||||
process: function(src, filepath) {
|
||||
@ -83,15 +76,33 @@ module.exports = function(grunt) {
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
macreload: {
|
||||
chrome: {
|
||||
browser: 'chrome',
|
||||
editor: 'macvim'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
main: {
|
||||
files: ['public/src/js/**/*.js'],
|
||||
tasks: ['concat:main', 'uglify:main', 'macreload'],
|
||||
},
|
||||
css: {
|
||||
files: ['public/src/css/**/*.css'],
|
||||
tasks: ['concat:css', 'cssmin', 'macreload'],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
//Making grunt default to force in order not to break the project.
|
||||
grunt.option('force', true);
|
||||
|
||||
//Default task(s).
|
||||
grunt.registerTask('default', ['jshint']);
|
||||
grunt.registerTask('default', ['watch']);
|
||||
|
||||
//Compile task (concat + minify)
|
||||
grunt.registerTask('compile', ['concat', 'uglify', 'cssmin']);
|
||||
grunt.registerTask('compile', ['concat', 'uglify', 'cssmin', 'macreload']);
|
||||
|
||||
|
||||
};
|
||||
|
||||
28
README.md
28
README.md
@ -59,10 +59,36 @@ To compile and minify the web application's assets:
|
||||
|
||||
```$ grunt compile```
|
||||
|
||||
There is a convinent Gruntfile.js for automation during editing the code
|
||||
|
||||
```$ grunt```
|
||||
|
||||
|
||||
|
||||
In case you are developing *insight* and *insight-api* toghether, you can do the following:
|
||||
|
||||
* Install insight and insight-api on the same path ($IROOT)
|
||||
```
|
||||
$ cd $IROOT/insight
|
||||
$ grunt
|
||||
```
|
||||
in other terminal:
|
||||
```
|
||||
$ cd $IROOT/insight-api
|
||||
$ ln -s ../insight/public
|
||||
$ INSIGHT_PUBLIC_PATH=public node insight.js
|
||||
```
|
||||
|
||||
|
||||
```INSIGHT_PUBLIC_PATH=insight/public grunt```
|
||||
at insight-api's home path (edit the path according your setup).
|
||||
|
||||
**also** in the insight-api path. (So you will have to grunt process running, one for insight and one for insight-api).
|
||||
|
||||
|
||||
## Note
|
||||
|
||||
For more details about the *insight API* configs and end-poinst, just go to [insight API github repository](https://github.com/bitpay/insight-api) or read the [documentation](https://github.com/bitpay/insight-api/blob/master/README.md)
|
||||
For more details about the *insight API* configs and end-point, just go to [insight API github repository](https://github.com/bitpay/insight-api) or read the [documentation](https://github.com/bitpay/insight-api/blob/master/README.md)
|
||||
|
||||
## Contribute
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "insight-bitcore",
|
||||
"description": "An open-source frontend for the Insight API. The Insight API provides you with a convenient, powerful and simple way to query and broadcast data on the bitcoin network and build your own services with it.",
|
||||
"version": "0.1.3",
|
||||
"version": "0.1.4",
|
||||
"author": {
|
||||
"name": "Ryan X Charles",
|
||||
"email": "ryan@bitpay.com"
|
||||
@ -47,7 +47,7 @@
|
||||
"start": "INSIGHT_PUBLIC_PATH=public node node_modules/insight-bitcore-api/insight.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"insight-bitcore-api": "git://github.com/bitpay/insight-api"
|
||||
"insight-bitcore-api": "~0.1.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bower": "~1.2.8",
|
||||
@ -56,6 +56,8 @@
|
||||
"grunt-contrib-jshint": "~0.8.0",
|
||||
"grunt-contrib-concat": "~0.3.0",
|
||||
"grunt-contrib-uglify": "~0.3.2",
|
||||
"grunt-contrib-watch": "*",
|
||||
"grunt-macreload": "*",
|
||||
"grunt-css": "~0.5.4",
|
||||
"grunt-markdown": "~0.5.0"
|
||||
}
|
||||
|
||||
8
public/css/main.min.css
vendored
8
public/css/main.min.css
vendored
File diff suppressed because one or more lines are too long
18
public/js/angularjs-all.min.js
vendored
18
public/js/angularjs-all.min.js
vendored
File diff suppressed because one or more lines are too long
2
public/js/main.min.js
vendored
2
public/js/main.min.js
vendored
File diff suppressed because one or more lines are too long
4
public/js/vendors.min.js
vendored
4
public/js/vendors.min.js
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -2,6 +2,7 @@
|
||||
-------------------------------------------------- */
|
||||
@charset "UTF-8";
|
||||
|
||||
|
||||
html,
|
||||
body {
|
||||
color: #373D42;
|
||||
|
||||
@ -4,8 +4,28 @@ angular.module('insight.address').controller('AddressController',
|
||||
function($scope, $rootScope, $routeParams, $location, Global, Address, getSocket) {
|
||||
$scope.global = Global;
|
||||
|
||||
|
||||
var socket = getSocket($scope);
|
||||
|
||||
var _startSocket = function () {
|
||||
socket.emit('subscribe', $routeParams.addrStr);
|
||||
socket.on($routeParams.addrStr, function(tx) {
|
||||
$rootScope.$broadcast('tx', tx);
|
||||
var beep = new Audio('/sound/transaction.mp3');
|
||||
beep.play();
|
||||
});
|
||||
};
|
||||
|
||||
socket.on('connect', function() {
|
||||
_startSocket();
|
||||
});
|
||||
|
||||
$scope.params = $routeParams;
|
||||
|
||||
|
||||
$scope.findOne = function() {
|
||||
$rootScope.currentAddr = $routeParams.addrStr;
|
||||
_startSocket();
|
||||
|
||||
Address.get({
|
||||
addrStr: $routeParams.addrStr
|
||||
@ -27,15 +47,4 @@ angular.module('insight.address').controller('AddressController',
|
||||
});
|
||||
};
|
||||
|
||||
var socket = getSocket($scope);
|
||||
socket.on('connect', function() {
|
||||
socket.emit('subscribe', $routeParams.addrStr);
|
||||
socket.on($routeParams.addrStr, function(tx) {
|
||||
console.log('AddressTx event received ' + tx);
|
||||
$rootScope.$broadcast('tx', tx);
|
||||
});
|
||||
});
|
||||
|
||||
$scope.params = $routeParams;
|
||||
|
||||
});
|
||||
|
||||
@ -17,9 +17,9 @@ angular.module('insight.system').controller('IndexController',
|
||||
};
|
||||
|
||||
var socket = getSocket($scope);
|
||||
socket.on('connect', function() {
|
||||
socket.emit('subscribe', 'inv');
|
||||
|
||||
var _startSocket = function() {
|
||||
socket.emit('subscribe', 'inv');
|
||||
socket.on('tx', function(tx) {
|
||||
$scope.txs.unshift(tx);
|
||||
if (parseInt($scope.txs.length, 10) >= parseInt(TRANSACTION_DISPLAYED, 10)) {
|
||||
@ -30,9 +30,14 @@ angular.module('insight.system').controller('IndexController',
|
||||
socket.on('block', function() {
|
||||
_getBlocks();
|
||||
});
|
||||
};
|
||||
|
||||
socket.on('connect', function() {
|
||||
_startSocket();
|
||||
});
|
||||
|
||||
|
||||
|
||||
$scope.humanSince = function(time) {
|
||||
var m = moment.unix(time);
|
||||
return m.max().fromNow();
|
||||
@ -40,6 +45,7 @@ angular.module('insight.system').controller('IndexController',
|
||||
|
||||
$scope.index = function() {
|
||||
_getBlocks();
|
||||
_startSocket();
|
||||
};
|
||||
|
||||
$scope.txs = [];
|
||||
|
||||
@ -26,7 +26,21 @@ angular.module('insight.status').controller('StatusController',
|
||||
$scope.sync = sync;
|
||||
};
|
||||
|
||||
var _startSocket = function () {
|
||||
socket.emit('subscribe', 'sync');
|
||||
socket.on('status', function(sync) {
|
||||
_onSyncUpdate(sync);
|
||||
});
|
||||
};
|
||||
|
||||
var socket = getSocket($scope);
|
||||
socket.on('connect', function() {
|
||||
_startSocket();
|
||||
});
|
||||
|
||||
|
||||
$scope.getSync = function() {
|
||||
_startSocket();
|
||||
Sync.get({},
|
||||
function(sync) {
|
||||
_onSyncUpdate(sync);
|
||||
@ -38,12 +52,4 @@ angular.module('insight.status').controller('StatusController',
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
var socket = getSocket($scope);
|
||||
socket.on('connect', function() {
|
||||
socket.emit('subscribe', 'sync');
|
||||
socket.on('status', function(sync) {
|
||||
_onSyncUpdate(sync);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user