+ beautifier

* version info
This commit is contained in:
Taegus
2019-03-03 10:37:19 +01:00
parent de73afd5cd
commit b0cd7d517a
19 changed files with 1648 additions and 1697 deletions

View File

@@ -1,18 +1,17 @@
// In renderer process (web page).
const {ipcRenderer} = require('electron');
const {ipcRenderer} = require("electron");
// Set the provider you want from Web3.providers
SyncProgress = new ProgressBar.Line('#syncProgress',
{
SyncProgress = new ProgressBar.Line("#syncProgress", {
strokeWidth: 6,
easing: 'easeInOut',
easing: "easeInOut",
duration: 1400,
color: "#7A1336",
trailColor: '#eee',
trailColor: "#eee",
trailWidth: 1,
text: {
style: {
color: '#bbb',
color: "#bbb",
position: "absolute",
left: "50%",
top: "-1px",
@@ -23,107 +22,113 @@ SyncProgress = new ProgressBar.Line('#syncProgress',
},
autoStyleContainer: false
},
from: {color: '#FFEA82'},
to: {color: '#ED6A5A'}
from: {
color: "#FFEA82"
},
to: {
color: "#ED6A5A"
}
});
// set initial value for the progress text
SyncProgress.setText("Waiting for blockchain, please wait...");
isFullySynced = false;
var peerCountInterval = setInterval(function()
{
web3Local.eth.net.getPeerCount(function(error, count) {
var peerCountInterval = setInterval(function () {
web3Local.eth.net.getPeerCount(function (error, count) {
$("#peerCount").html(vsprintf("Peer Count: %d", [count]));
});
}, 5000);
}, 5000);
function StartSyncProcess() {
var alreadyCatchedUp = false;
var nodeSyncInterval = null;
var subscription = web3Local.eth.subscribe('syncing', function(error, sync){
var subscription = web3Local.eth.subscribe("syncing", function (error, sync) {
if (!error) {
if (!sync) {
if (nodeSyncInterval) {
clearInterval(nodeSyncInterval);
clearInterval(nodeSyncInterval);
}
nodeSyncInterval = setInterval(function()
{
web3Local.eth.getBlock("latest", function(error, localBlock) {
nodeSyncInterval = setInterval(function () {
web3Local.eth.getBlock("latest", function (error, localBlock) {
if (!error) {
if (localBlock.number > 0) {
if (!EthoTransactions.getIsSyncing()) {
SyncProgress.animate(1);
SyncProgress.setText(vsprintf('%d/%d (100%%)', [localBlock.number, localBlock.number]));
SyncProgress.animate(1);
SyncProgress.setText(vsprintf("%d/%d (100%%)", [localBlock.number, localBlock.number]));
}
if (alreadyCatchedUp == false)
{
if (alreadyCatchedUp == false) {
// clear the repeat interval and render wallets
$(document).trigger("onNewAccountTransaction");
alreadyCatchedUp = true;
isFullySynced = true;
// enable the keep in sync feature
EthoTransactions.enableKeepInSync();
// sync all the transactions to the current block
EthoTransactions.syncTransactionsForAllAddresses(localBlock.number);
// signal that the sync is complete
$(document).trigger("onSyncComplete");
}
}
}
}
} else {
EthoMainGUI.showGeneralError(error);
}
});
}, 10000);
});
}, 10000);
}
} else {
EthoMainGUI.showGeneralError(error);
}
}).on("data", function(sync){
if ((sync) && (sync.HighestBlock > 0)) {
}).on("data", function (sync) {
if (sync && sync.HighestBlock > 0) {
SyncProgress.animate(sync.CurrentBlock / sync.HighestBlock);
SyncProgress.setText(vsprintf('%d/%d (%d%%)', [sync.CurrentBlock, sync.HighestBlock, Math.floor(sync.CurrentBlock / sync.HighestBlock * 100)]));
SyncProgress.setText(vsprintf("%d/%d (%d%%)", [
sync.CurrentBlock,
sync.HighestBlock,
Math.floor(sync.CurrentBlock / sync.HighestBlock * 100)
]));
}
}).on("changed", function(isSyncing){
if(isSyncing) {
nodeSyncInterval = setInterval(function()
{
web3Local.eth.isSyncing(function(error, sync){
if ((!error) && (sync)) {
}).on("changed", function (isSyncing) {
if (isSyncing) {
nodeSyncInterval = setInterval(function () {
web3Local.eth.isSyncing(function (error, sync) {
if (!error && sync) {
SyncProgress.animate(sync.currentBlock / sync.highestBlock);
SyncProgress.setText(vsprintf('%d/%d (%d%%)', [sync.currentBlock, sync.highestBlock, Math.floor(sync.currentBlock / sync.highestBlock * 100)]));
SyncProgress.setText(vsprintf("%d/%d (%d%%)", [
sync.currentBlock,
sync.highestBlock,
Math.floor(sync.currentBlock / sync.highestBlock * 100)
]));
} else if (error) {
EthoMainGUI.showGeneralError(error);
}
});
}, 2000);
});
}, 2000);
} else {
if (nodeSyncInterval) {
clearInterval(nodeSyncInterval);
clearInterval(nodeSyncInterval);
}
}
});
});
}
var InitWeb3 = setInterval(function()
{
var InitWeb3 = setInterval(function () {
try {
web3Local = new Web3(new Web3.providers.WebsocketProvider('ws://localhost:8546'));
web3Local = new Web3(new Web3.providers.WebsocketProvider("ws://localhost:8546"));
web3Local.eth.net.isListening(function(error, success) {
web3Local.eth.net.isListening(function (error, success) {
if (!error) {
$(document).trigger("onGethReady");
clearInterval(InitWeb3);
StartSyncProcess();
StartSyncProcess();
}
});
}
catch(err) {
} catch (err) {
EthoMainGUI.showGeneralError(err);
}
}, 2000);
}, 2000);