diff --git a/eth/BigInteger.js b/eth/BigInteger.js index 2509833a7..e4a9d1c7b 100644 --- a/eth/BigInteger.js +++ b/eth/BigInteger.js @@ -53,7 +53,7 @@ } if (text === "-0") text = "0"; text = text.toUpperCase(); - var isValid = (base == 16 ? /^[0-9A-F]+$/ : /^[0-9]+$/).test(text); + var isValid = (base == 16 ? /^[0-9A-F]*$/ : /^[0-9]+$/).test(text); if (!isValid) throw new Error("Invalid integer"); if (base == 16) { var val = bigInt(0); @@ -335,7 +335,7 @@ str = str.slice(1); } if (!str.length) str = "0"; - var s = first.sign === sign.positive ? "" : "-"; + var s = (first.sign === sign.positive || str == "0") ? "" : "-"; return s + str; }, toHex: function (m) { diff --git a/eth/eth.js b/eth/eth.js index 7e3e71b1f..81fb524fd 100644 --- a/eth/eth.js +++ b/eth/eth.js @@ -1,7 +1,18 @@ +if (typeof(window.eth) === "undefined") +{ if (typeof(require) !== "undefined") require( ['ethString'], function() {} ) else if (typeof(String.prototype.pad) === "undefined") - alert("You need to have included ethString.js for eth to work.") +{ + var scriptTag = document.getElementsByTagName('script'); + scriptTag = scriptTag[scriptTag.length - 1]; + var scriptPath = scriptTag.src; + var path = scriptPath.substr(0, scriptPath.lastIndexOf( '/' )); + var start = '