diff --git a/Bin/Light/Tera-light.zip b/Bin/Light/Tera-light.zip index bd4d772..c06ab5d 100644 Binary files a/Bin/Light/Tera-light.zip and b/Bin/Light/Tera-light.zip differ diff --git a/Bin/Light/tera_light_setup.exe b/Bin/Light/tera_light_setup.exe index ce18c8d..d323783 100644 Binary files a/Bin/Light/tera_light_setup.exe and b/Bin/Light/tera_light_setup.exe differ diff --git a/Source/HTML/JS/client.js b/Source/HTML/JS/client.js index 1db5032..7445b71 100644 --- a/Source/HTML/JS/client.js +++ b/Source/HTML/JS/client.js @@ -13,6 +13,55 @@ function $(id) { return document.getElementById(id); }; +if(!Math.log2) + Math.log2 = Math.log2 || function (x) + { + return Math.log(x) * Math.LOG2E; + }; +if(!window.crypto) + window.crypto = window.msCrypto; +if(!window.toStaticHTML) + toStaticHTML = function (Str) + { + return Str; + }; +if(!String.prototype.padStart) +{ + window.BrowserIE = 1; + String.prototype.padStart = function padStart(targetLength,padString) + { + targetLength = targetLength >> 0; + padString = String((typeof padString !== 'undefined' ? padString : ' ')); + if(this.length > targetLength) + { + return String(this); + } + else + { + targetLength = targetLength - this.length; + if(targetLength > padString.length) + { + padString += padString.repeat(targetLength / padString.length); + } + return padString.slice(0, targetLength) + String(this); + } + }; +} +window.Storage = {}; +window.Storage.setItem = function (Key,Value) +{ + if(window.localStorage) + localStorage.setItem(Key, Value); +}; +window.Storage.getItem = function (Key) +{ + if(window.localStorage) + return localStorage.getItem(Key); +}; +window.IsLocalClient = function () +{ + return (window.location.protocol.substr(0, 4) !== "http"); +}; var ServerHTTP; var MainServer; if(window.nw) @@ -74,7 +123,7 @@ else } else { - if(!window.location.hostname) + if(IsLocalClient()) return ; } } @@ -789,7 +838,7 @@ function SetGridData(arr,id_name,TotalSum,bclear,revert) if(cell0.H) { var text = "" + cell0.F(Item); - text.trim(); + text = toStaticHTML(text.trim()); if(cell.innerHTML !== text) cell.innerHTML = text; } @@ -873,7 +922,7 @@ function RetOpenDapps(Item,bNum,AccountNum) if(Item.HTMLLength > 0) { var StrText = RetIconDapp(Item) + Name; - return ''; + return ''; } else return RetIconDapp(Item) + Name; @@ -1059,7 +1108,7 @@ function LoadValuesByArr(Arr,DopStr) { if(!DopStr) DopStr = ""; - if(localStorage["VerSave"] !== "3") + if(Storage.getItem("VerSave") !== "3") return 0; for(var i = 0; i < Arr.length; i++) { @@ -1067,9 +1116,9 @@ function LoadValuesByArr(Arr,DopStr) var Item = document.getElementById(name); var name2 = DopStr + name; if(Item.type === "checkbox") - Item.checked = parseInt(localStorage.getItem(name2)); + Item.checked = parseInt(Storage.getItem(name2)); else - Item.value = localStorage.getItem(name2); + Item.value = Storage.getItem(name2); } return 1; }; @@ -1078,16 +1127,16 @@ function SaveValuesByArr(Arr,DopStr) { if(!DopStr) DopStr = ""; - localStorage["VerSave"] = "3"; + Storage.setItem("VerSave", "3"); for(var i = 0; i < Arr.length; i++) { var name = Arr[i]; var name2 = DopStr + name; var Item = $(name); if(Item.type === "checkbox") - window.localStorage.setItem(name2, 0 + Item.checked); + window.Storage.setItem(name2, 0 + Item.checked); else - window.localStorage.setItem(name2, Item.value); + window.Storage.setItem(name2, Item.value); } }; var MapCurrency = {}; @@ -1290,7 +1339,7 @@ function FillCategory(IdName) function AddToInvoiceList(Item) { var arr; - var Str = localStorage["InvoiceList"]; + var Str = Storage.getItem("InvoiceList"); if(Str) { arr = JSON.parse(Str); @@ -1300,13 +1349,13 @@ function AddToInvoiceList(Item) arr = []; } arr.unshift(Item); - localStorage["InvoiceList"] = JSON.stringify(arr); + Storage.setItem("InvoiceList", JSON.stringify(arr)); }; function OpenDapps(Num,AccountNum) { var StrPath = '/dapp/' + Num; - if(window.location.protocol === "file:") + if(IsLocalClient()) { StrPath = "./dapp-frame.html?dapp=" + Num; } @@ -1587,7 +1636,7 @@ function GetSignTransaction(TR,StrPrivKey,F) function GetSignFromArr(Arr,StrPrivKey) { if(!StrPrivKey) - StrPrivKey = localStorage["idPrivKey"]; + StrPrivKey = Storage.getItem("idPrivKey"); if(!IsHexStr(StrPrivKey) || StrPrivKey.length !== 64) return "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; var PrivKey = GetArrFromHex(StrPrivKey); @@ -1633,7 +1682,7 @@ Number.prototype.toStringF = function () function CanClientSign() { - var StrPrivKey = localStorage["idPrivKey"]; + var StrPrivKey = Storage.getItem("idPrivKey"); if(!IsHexStr(StrPrivKey) || StrPrivKey.length !== 64) { return 0; diff --git a/Source/HTML/JS/crypto-client.js b/Source/HTML/JS/crypto-client.js index eb29a2c..e2bf30f 100644 --- a/Source/HTML/JS/crypto-client.js +++ b/Source/HTML/JS/crypto-client.js @@ -35,10 +35,18 @@ function GetPowPower(arrhash) var SumBit = 0; for(var i = 0; i < arrhash.length; i++) { - var CurSum = Math.clz32(arrhash[i]) - 24; - SumBit += CurSum; - if(CurSum !== 8) - break; + var byte = arrhash[i]; + for(var b = 7; b >= 0; b--) + { + if((byte >> b) & 1) + { + return SumBit; + } + else + { + SumBit++; + } + } } return SumBit; }; @@ -265,9 +273,9 @@ function ComputeSecretWithCheck(PubKey,StrPrivKey,F) function ComputeSecret(Account,PubKey,F) { - if(localStorage["idPrivKey"]) + if(Storage.getItem("idPrivKey")) { - ComputeSecretWithCheck(PubKey, localStorage["idPrivKey"], F); + ComputeSecretWithCheck(PubKey, Storage.getItem("idPrivKey"), F); } else { diff --git a/Source/HTML/JS/diagram.js b/Source/HTML/JS/diagram.js index ba05bde..173b2ff 100644 --- a/Source/HTML/JS/diagram.js +++ b/Source/HTML/JS/diagram.js @@ -11,6 +11,11 @@ var DiagramMap = {}; var DiagramMapId = {}; var LMouseOn = false; +if(!window.toStaticHTML) + toStaticHTML = function (Str) + { + return Str; + }; function Rigth(Str,Count) { @@ -44,11 +49,11 @@ function SetHTMLDiagramItem(Item,width) } var ElBlock = document.getElementById("B" + Item.id); if(ElBlock) - ElBlock.innerHTML = Str; + ElBlock.innerHTML = toStaticHTML(Str); else { var diargams = document.getElementById("diargams"); - diargams.innerHTML += "