run js-beautify on everything
...with two spaces. Command: js-beautify -s 2 -r [filename]
This commit is contained in:
parent
da445e7c69
commit
ea2e2d4e19
49 changed files with 859 additions and 682 deletions
|
|
@ -12,27 +12,27 @@ angular.module('copayApp.controllers').controller('AddressesController',
|
|||
controllerUtils.setSocketHandlers();
|
||||
controllerUtils.updateAddressList();
|
||||
$scope.loading = false;
|
||||
},1);
|
||||
}, 1);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.selectAddress = function (addr) {
|
||||
$scope.selectAddress = function(addr) {
|
||||
$scope.selectedAddr = addr;
|
||||
};
|
||||
|
||||
$rootScope.$watch('addrInfos', function() {
|
||||
$scope.addressList();
|
||||
});
|
||||
});
|
||||
|
||||
$scope.addressList = function () {
|
||||
$scope.addressList = function() {
|
||||
$scope.addresses = [];
|
||||
var addrInfos = $rootScope.addrInfos;
|
||||
if (addrInfos) {
|
||||
for(var i=0;i<addrInfos.length;i++) {
|
||||
for (var i = 0; i < addrInfos.length; i++) {
|
||||
var addrinfo = addrInfos[i];
|
||||
$scope.addresses.push({
|
||||
'address' : addrinfo.address.toString(),
|
||||
'balance' : $rootScope.balanceByAddr ? $rootScope.balanceByAddr[addrinfo.address.toString()] : 0,
|
||||
$scope.addresses.push({
|
||||
'address': addrinfo.address.toString(),
|
||||
'balance': $rootScope.balanceByAddr ? $rootScope.balanceByAddr[addrinfo.address.toString()] : 0,
|
||||
'isChange': addrinfo.isChange
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,35 +2,34 @@
|
|||
|
||||
angular.module('copayApp.controllers').controller('FooterController', function($rootScope, $sce, $scope, $http) {
|
||||
|
||||
if (config.themes && Array.isArray(config.themes) && config.themes[0]) {
|
||||
$scope.themes = config.themes;
|
||||
}
|
||||
else {
|
||||
$scope.themes = ['default'];
|
||||
if (config.themes && Array.isArray(config.themes) && config.themes[0]) {
|
||||
$scope.themes = config.themes;
|
||||
} else {
|
||||
$scope.themes = ['default'];
|
||||
}
|
||||
|
||||
$scope.theme = 'css/tpl-' + $scope.themes[0] + '.css';
|
||||
|
||||
$scope.change_theme = function(name) {
|
||||
$scope.theme = 'css/tpl-' + name + '.css';
|
||||
};
|
||||
$scope.version = copay.version;
|
||||
|
||||
$scope.getVideoURL = function(copayer) {
|
||||
if (config.disableVideo) return;
|
||||
|
||||
var vi = $rootScope.videoInfo[copayer]
|
||||
if (!vi) return;
|
||||
|
||||
if ($rootScope.wallet.getOnlinePeerIDs().indexOf(copayer) === -1) {
|
||||
// peer disconnected, remove his video
|
||||
delete $rootScope.videoInfo[copayer]
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.theme = 'css/tpl-' + $scope.themes[0] + '.css';
|
||||
|
||||
$scope.change_theme = function(name) {
|
||||
$scope.theme = 'css/tpl-' + name + '.css';
|
||||
};
|
||||
$scope.version = copay.version;
|
||||
|
||||
$scope.getVideoURL = function(copayer) {
|
||||
if (config.disableVideo) return;
|
||||
|
||||
var vi = $rootScope.videoInfo[copayer]
|
||||
if (!vi) return;
|
||||
|
||||
if ($rootScope.wallet.getOnlinePeerIDs().indexOf(copayer) === -1) {
|
||||
// peer disconnected, remove his video
|
||||
delete $rootScope.videoInfo[copayer]
|
||||
return;
|
||||
}
|
||||
|
||||
var encoded = vi.url;
|
||||
var url = decodeURI(encoded);
|
||||
var trusted = $sce.trustAsResourceUrl(url);
|
||||
return trusted;
|
||||
};
|
||||
});
|
||||
var encoded = vi.url;
|
||||
var url = decodeURI(encoded);
|
||||
var trusted = $sce.trustAsResourceUrl(url);
|
||||
return trusted;
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
angular.module('copayApp.controllers').controller('HeaderController',
|
||||
function($scope, $rootScope, $location, notification, $http, controllerUtils) {
|
||||
$scope.menu = [
|
||||
{
|
||||
$scope.menu = [{
|
||||
'title': 'Addresses',
|
||||
'icon': 'fi-address-book',
|
||||
'link': '#/addresses'
|
||||
|
|
@ -25,15 +24,23 @@ angular.module('copayApp.controllers').controller('HeaderController',
|
|||
return new Array(num);
|
||||
}
|
||||
|
||||
$http.get('https://api.github.com/repos/bitpay/copay/tags').success(function(data){
|
||||
var toInt = function (s) { return parseInt(s); };
|
||||
$http.get('https://api.github.com/repos/bitpay/copay/tags').success(function(data) {
|
||||
var toInt = function(s) {
|
||||
return parseInt(s);
|
||||
};
|
||||
var latestVersion = data[0].name.replace('v', '').split('.').map(toInt);
|
||||
var currentVersion = copay.version.split('.').map(toInt);
|
||||
if (currentVersion[0] < latestVersion[0]){
|
||||
$scope.updateVersion = {class: 'error', version:data[0].name};
|
||||
if (currentVersion[0] < latestVersion[0]) {
|
||||
$scope.updateVersion = {
|
||||
class: 'error',
|
||||
version: data[0].name
|
||||
};
|
||||
} else if (currentVersion[0] == latestVersion[0] && currentVersion[1] < latestVersion[1]) {
|
||||
$scope.updateVersion = {class: 'info', version:data[0].name};
|
||||
}
|
||||
$scope.updateVersion = {
|
||||
class: 'info',
|
||||
version: data[0].name
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
$rootScope.unitName = config.unitName;
|
||||
|
|
@ -59,7 +66,7 @@ angular.module('copayApp.controllers').controller('HeaderController',
|
|||
$rootScope.$watch('receivedFund', function(receivedFund) {
|
||||
if (receivedFund) {
|
||||
var currentAddr;
|
||||
for(var i=0;i<$rootScope.addrInfos.length;i++) {
|
||||
for (var i = 0; i < $rootScope.addrInfos.length; i++) {
|
||||
var addrinfo = $rootScope.addrInfos[i];
|
||||
if (addrinfo.address.toString() == receivedFund[1] && !addrinfo.isChange) {
|
||||
currentAddr = addrinfo.address.toString();
|
||||
|
|
@ -83,12 +90,12 @@ angular.module('copayApp.controllers').controller('HeaderController',
|
|||
|
||||
|
||||
$scope.isActive = function(item) {
|
||||
if (item.link && item.link.replace('#','') == $location.path()) {
|
||||
if (item.link && item.link.replace('#', '') == $location.path()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
$scope.signout = function() {
|
||||
logout();
|
||||
$scope.clearFlashMessage();
|
||||
|
|
@ -97,7 +104,7 @@ angular.module('copayApp.controllers').controller('HeaderController',
|
|||
$scope.refresh = function() {
|
||||
var w = $rootScope.wallet;
|
||||
w.connectToAll();
|
||||
if ($rootScope.addrInfos.length > 0 ) {
|
||||
if ($rootScope.addrInfos.length > 0) {
|
||||
controllerUtils.updateBalance(function() {
|
||||
$rootScope.$digest();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,11 +5,14 @@ angular.module('copayApp.controllers').controller('ImportController',
|
|||
$scope.title = 'Import a backup';
|
||||
var reader = new FileReader();
|
||||
var _importBackup = function(encryptedObj) {
|
||||
Passphrase.getBase64Async($scope.password, function(passphrase){
|
||||
Passphrase.getBase64Async($scope.password, function(passphrase) {
|
||||
walletFactory.import(encryptedObj, passphrase, function(err, w) {
|
||||
if (err) {
|
||||
$scope.loading = false;
|
||||
$rootScope.$flashMessage = { message: err.errMsg || 'Wrong password', type: 'error'};
|
||||
$rootScope.$flashMessage = {
|
||||
message: err.errMsg || 'Wrong password',
|
||||
type: 'error'
|
||||
};
|
||||
$rootScope.$digest();
|
||||
return;
|
||||
}
|
||||
|
|
@ -43,7 +46,10 @@ angular.module('copayApp.controllers').controller('ImportController',
|
|||
$scope.import = function(form) {
|
||||
if (form.$invalid) {
|
||||
$scope.loading = false;
|
||||
$rootScope.$flashMessage = { message: 'There is an error in the form. Please, try again', type: 'error'};
|
||||
$rootScope.$flashMessage = {
|
||||
message: 'There is an error in the form. Please, try again',
|
||||
type: 'error'
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +59,10 @@ angular.module('copayApp.controllers').controller('ImportController',
|
|||
|
||||
if (!backupFile && !backupText) {
|
||||
$scope.loading = false;
|
||||
$rootScope.$flashMessage = { message: 'Please, select your backup file or paste the text', type: 'error'};
|
||||
$rootScope.$flashMessage = {
|
||||
message: 'Please, select your backup file or paste the text',
|
||||
type: 'error'
|
||||
};
|
||||
$scope.loading = false;
|
||||
return;
|
||||
}
|
||||
|
|
@ -62,8 +71,7 @@ angular.module('copayApp.controllers').controller('ImportController',
|
|||
|
||||
if (backupFile) {
|
||||
reader.readAsBinaryString(backupFile);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
_importBackup(backupText);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
templateUrl: 'addressBookModal.html',
|
||||
windowClass: 'tiny',
|
||||
controller: function($scope, $modalInstance) {
|
||||
|
||||
|
||||
$scope.submitAddressBook = function(form) {
|
||||
if (form.$invalid) {
|
||||
$rootScope.$flashMessage = {
|
||||
|
|
@ -255,8 +255,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
};
|
||||
|
||||
$scope.topAmount = function() {
|
||||
var maxSat = ($rootScope.availableBalance * config.unitToSatoshi).toFixed(0)
|
||||
- bitcore.TransactionBuilder.FEE_PER_1000B_SAT;
|
||||
var maxSat = ($rootScope.availableBalance * config.unitToSatoshi).toFixed(0) - bitcore.TransactionBuilder.FEE_PER_1000B_SAT;
|
||||
$scope.amount = maxSat / config.unitToSatoshi;
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ angular.module('copayApp.controllers').controller('SetupController',
|
|||
|
||||
var updateRCSelect = function(n) {
|
||||
$scope.requiredCopayers = (valid_pairs[[parseInt(n / 2 + 1), n]] > 0 || config.networkName === 'testnet') ?
|
||||
parseInt(n / 2 + 1) : 1;
|
||||
parseInt(n / 2 + 1) : 1;
|
||||
$scope.RCValues = [];
|
||||
for (var m = 1; m <= n; m++) {
|
||||
if (valid_pairs[[m, n]] > 0 || config.networkName === 'testnet') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue