Sat Jul 20 20:40:02 CST 2019 Source Update...
This commit is contained in:
@@ -64,6 +64,7 @@ window.IsLocalClient = function ()
|
||||
{
|
||||
return (window.location.protocol.substr(0, 4) !== "http");
|
||||
};
|
||||
var glSession;
|
||||
var ServerHTTP;
|
||||
var MainServer;
|
||||
if(window.nw)
|
||||
@@ -1983,3 +1984,10 @@ function isMobile()
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function DoNewSession()
|
||||
{
|
||||
var arr = new Uint8Array(6);
|
||||
window.crypto.getRandomValues(arr);
|
||||
glSession = GetHexFromArr(arr);
|
||||
};
|
||||
|
||||
@@ -24,6 +24,7 @@ var CONNECT_STATUS = 0;
|
||||
var NotModalClose = 0;
|
||||
window.onload = function ()
|
||||
{
|
||||
DoNewSession();
|
||||
InitAccountsCard();
|
||||
DoLangScript();
|
||||
InitWalletKeyName();
|
||||
@@ -38,7 +39,6 @@ window.onload = function ()
|
||||
if(Data && Data.result)
|
||||
{
|
||||
Storage.setItem("NETWORK", Data.NETWORK);
|
||||
console.log("Default network: " + Data.NETWORK);
|
||||
OnLoad();
|
||||
}
|
||||
});
|
||||
@@ -98,8 +98,8 @@ function OnLoad()
|
||||
LoadValues();
|
||||
InitDappsCard();
|
||||
StartWebWallet();
|
||||
setInterval(UpdatesExplorerData, 1000);
|
||||
setInterval(UpdatesAccountsData, 1000);
|
||||
setInterval(UpdatesExplorerData, 2000);
|
||||
setInterval(UpdatesAccountsData, 2000);
|
||||
DoStableScroll();
|
||||
window.onmousemove = function (event)
|
||||
{
|
||||
@@ -117,12 +117,14 @@ function OnLoad()
|
||||
|
||||
function ChangeNetwork(bStart)
|
||||
{
|
||||
FirstAccountsData = 1;
|
||||
CONNECT_STATUS = 0;
|
||||
NETWORK = $("idCurNetwork").value;
|
||||
Storage.setItem("NETWORK", NETWORK);
|
||||
if(bStart)
|
||||
StartWebWallet();
|
||||
ConnectWebWallet();
|
||||
else
|
||||
ConnectWebWallet();
|
||||
};
|
||||
|
||||
function UpdateTabs()
|
||||
@@ -144,6 +146,7 @@ function OnFindServer()
|
||||
CONNECT_STATUS = 2;
|
||||
Storage.setItem("MainServer", JSON.stringify({ip:MainServer.ip, port:MainServer.port}));
|
||||
FillCurrencyAsync("idAccountCur");
|
||||
SetDataUpdateTime(10);
|
||||
UpdateTabs();
|
||||
};
|
||||
|
||||
@@ -188,10 +191,20 @@ function OnSelectTab(name)
|
||||
SetPrivKey($("idPrivKeyEdit").value.trim());
|
||||
InitPrivKey();
|
||||
}
|
||||
if(name === "TabDapps")
|
||||
if(name === "TabAccounts" || name === "TabSend")
|
||||
{
|
||||
ViewDapps();
|
||||
UpdatesAccountsData(1);
|
||||
}
|
||||
else
|
||||
if(name === "TabExplorer")
|
||||
{
|
||||
UpdatesExplorerData(1);
|
||||
}
|
||||
else
|
||||
if(name === "TabDapps")
|
||||
{
|
||||
ViewDapps();
|
||||
}
|
||||
};
|
||||
|
||||
function SetVisibleTab()
|
||||
@@ -292,8 +305,14 @@ function OnPrivKeyCancel()
|
||||
};
|
||||
var FirstAccountsData = 1;
|
||||
var AccountsCount = - 1;
|
||||
var DataUpdateTime = 0;
|
||||
|
||||
function UpdatesAccountsData()
|
||||
function SetDataUpdateTime(PeriodSec)
|
||||
{
|
||||
DataUpdateTime = Date.now() + 1000 * PeriodSec;
|
||||
};
|
||||
|
||||
function UpdatesAccountsData(bGetData)
|
||||
{
|
||||
if(IsVisibleClass(".accounts-info__add"))
|
||||
return ;
|
||||
@@ -304,7 +323,16 @@ function UpdatesAccountsData()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
GetData("/GetAccountListByKey", {Key:Str, AllData:FirstAccountsData}, function (Data,responseText)
|
||||
if(!bGetData)
|
||||
{
|
||||
if(IsVisibleBlock("TabAccounts") || DataUpdateTime >= Date.now())
|
||||
{
|
||||
bGetData = 1;
|
||||
}
|
||||
}
|
||||
if(!bGetData)
|
||||
return ;
|
||||
GetData("/GetAccountListByKey", {Key:Str, Session:glSession, AllData:FirstAccountsData}, function (Data,responseText)
|
||||
{
|
||||
if(!Data || !Data.result || !Data.arr)
|
||||
return ;
|
||||
@@ -549,8 +577,20 @@ function RestoreAllAccounts()
|
||||
DelAccount(0);
|
||||
};
|
||||
|
||||
function UpdatesExplorerData()
|
||||
function UpdatesExplorerData(bGetData)
|
||||
{
|
||||
var bDiagram = 0;
|
||||
if(IsVisibleBlock("TabExplorer") && IsVisibleBlock("idStatBlock"))
|
||||
bDiagram = 1;
|
||||
if(!bGetData)
|
||||
{
|
||||
if(bDiagram || DataUpdateTime >= Date.now())
|
||||
{
|
||||
bGetData = 1;
|
||||
}
|
||||
}
|
||||
if(!bGetData)
|
||||
return ;
|
||||
var WasSendTr = 0;
|
||||
for(var key in MapSendTransaction)
|
||||
{
|
||||
@@ -561,7 +601,7 @@ function UpdatesExplorerData()
|
||||
break;
|
||||
}
|
||||
}
|
||||
GetData("GetCurrentInfo", {Diagram:IsVisibleBlock("idStatBlock") ? 1 : 0, ArrLog:WasSendTr}, function (Data)
|
||||
GetData("GetCurrentInfo", {Diagram:bDiagram, ArrLog:WasSendTr}, function (Data)
|
||||
{
|
||||
if(!Data || !Data.result)
|
||||
return ;
|
||||
@@ -697,9 +737,11 @@ function downloadKey(fieldID)
|
||||
anchor.click();
|
||||
document.body.removeChild(anchor);
|
||||
};
|
||||
var glWasModal = 0;
|
||||
|
||||
function openModal(id)
|
||||
{
|
||||
glWasModal = 1;
|
||||
var modal = document.querySelector("#" + id);
|
||||
var overlay = document.querySelector("#overlay");
|
||||
modal.style.display = "block";
|
||||
@@ -710,6 +752,7 @@ function closeModal()
|
||||
{
|
||||
if(NotModalClose)
|
||||
return ;
|
||||
glWasModal = 0;
|
||||
var modals = document.querySelectorAll(".modal");
|
||||
var overlay = document.querySelector("#overlay");
|
||||
modals.forEach(function (item)
|
||||
@@ -802,14 +845,24 @@ function SendMobileBefore()
|
||||
SetVisibleClass(".send-page__setting", 0);
|
||||
SetVisibleClass(".send-page__confirm", 1);
|
||||
SetStatus("");
|
||||
UpdatesAccountsData(1);
|
||||
UpdatesExplorerData(1);
|
||||
};
|
||||
|
||||
function OKSend()
|
||||
{
|
||||
SendMoney();
|
||||
ClearSend();
|
||||
SaveValues();
|
||||
SendMoney(function ()
|
||||
{
|
||||
if(glWasModal)
|
||||
{
|
||||
ClearSend();
|
||||
SaveValues();
|
||||
}
|
||||
closeModal();
|
||||
});
|
||||
SetDataUpdateTime(20);
|
||||
CancelSend();
|
||||
openModal('idSending');
|
||||
};
|
||||
|
||||
function CancelSend()
|
||||
@@ -920,6 +973,7 @@ function SetUsePassword(bUse)
|
||||
function DoExitWallet()
|
||||
{
|
||||
ClearSend();
|
||||
SaveValues();
|
||||
NotModalClose = 1;
|
||||
$("Password").value = "";
|
||||
SetWalletPassword("");
|
||||
@@ -1210,7 +1264,7 @@ LangMap["RUS"] = {"TERA WALLET":"TERA КОШЕЛЕК", "Generate key":"Сген
|
||||
"Buy/sell/mine TERA":"Купить/Продать", "+ CREATE NEW":"+ СОЗДАТЬ", "Confirm Transaction":"Подтверждение транзакции", "CREATE DAPPS":"СОЗДАТЬ",
|
||||
"Set pass":"Установить пароль", "Unlock":"Разблокировать", "Entrance to sub-wallet":"Войти в под-кошелек", "Public name":"Публичное имя",
|
||||
"Currency":"Валюта", "Pay to:":"Получатель:", "Amount:":"Сумма:", "Description:":"Описание:", "Welcome to TERA Wallet":"Добропожаловать в кошелек TERA",
|
||||
"Edit your wallet":"Редактирование вашего кошелька", "Key settings":"Задание ключей", "KEY SETTINGS":"ЗАДАНИЕ КЛЮЧЕЙ", "Create an account":"Создание счета",
|
||||
"Edit your wallet":"Редактирование вашего кошелька", "Key settings":"Задание ключей", "KEY SETTINGS":"КЛЮЧИ", "Create an account":"Создание счета",
|
||||
"Sending coins":"Отправка монет", "Decentralized applications (dApps)":"Децентрализованные приложения (Даппс)", "Secure your wallet":"Безопасность вашего кошелька",
|
||||
"Wallet is secured":"Установлен пароль", "Total":"Всего", "Item.Name":"Item.Name", "You have no accounts yet":"У вас нет ни одного счета",
|
||||
"Wait 10-15 sec":"Ждите 10-15 сек", "Creating your account":"Идет создание вашего счета", "From:":"Отправитель:", "Set a password for protect entry":"Установите пароль для безопасности",
|
||||
|
||||
@@ -347,7 +347,7 @@ function SendMoney2()
|
||||
SendMoney();
|
||||
};
|
||||
|
||||
function SendMoney()
|
||||
function SendMoney(F)
|
||||
{
|
||||
if(!CanSendTransaction)
|
||||
{
|
||||
@@ -358,7 +358,9 @@ function SendMoney()
|
||||
if($("idSendButton").disabled)
|
||||
return ;
|
||||
SetVisibleBlock("idBlockOnSend", 0);
|
||||
CreateTransaction(SendMoneyTR, true, ClearAttach);
|
||||
if(!F)
|
||||
F = ClearAttach;
|
||||
CreateTransaction(SendMoneyTR, true, F);
|
||||
};
|
||||
|
||||
function GetJSONFromTransaction(TR)
|
||||
|
||||
Reference in New Issue
Block a user