I noticed that you allow some basic calculations in the input boxes on the top. The implementation is quite inconsistent right now. The items/second boxes replaces the expression with the result of the expression, the factorios input doesn't.
Also, only division is allowed, and it will not work for numbers that are not integers, regardless if , or . is used. other expressions, for example, +, -, *, or ^ are not allowed.
I propose an easy to implement, more robust system to evaluate expressions: value = eval(input.value.replace(/,/g, ".").
The value in the input box would consistently be replaced with the new evaluated value on the onblur event, or when the enter key is pressed.
The syntax it accepts is a reflection of the output when the calculator is placed into "rational" mode. I have no intention of making it a generalized calculator.
I noticed that you allow some basic calculations in the input boxes on the top. The implementation is quite inconsistent right now. The items/second boxes replaces the expression with the result of the expression, the factorios input doesn't.
Also, only division is allowed, and it will not work for numbers that are not integers, regardless if
,
or.
is used. other expressions, for example,+
,-
,*
, or^
are not allowed.I propose an easy to implement, more robust system to evaluate expressions:
value = eval(input.value.replace(/,/g, ".")
.The value in the input box would consistently be replaced with the new evaluated value on the
onblur
event, or when the enter key is pressed.