Commit 27d02597 authored by missionfloyd's avatar missionfloyd Committed by GitHub

Remove parentheses if weight == 1

parent 7ef55516
...@@ -99,7 +99,13 @@ function keyupEditAttention(event){ ...@@ -99,7 +99,13 @@ function keyupEditAttention(event){
weight = parseFloat(weight.toPrecision(12)); weight = parseFloat(weight.toPrecision(12));
if(String(weight).length == 1) weight += ".0" if(String(weight).length == 1) weight += ".0"
text = text.slice(0, selectionEnd + 1) + weight + text.slice(selectionEnd + 1 + end - 1); if (closeCharacter == ')' && weight == 1) {
text = text.slice(0, selectionStart - 1) + text.slice(selectionStart, selectionEnd) + text.slice(selectionEnd + 5);
selectionStart--;
selectionEnd--;
} else {
text = text.slice(0, selectionEnd + 1) + weight + text.slice(selectionEnd + 1 + end - 1);
}
target.focus(); target.focus();
target.value = text; target.value = text;
...@@ -111,4 +117,4 @@ function keyupEditAttention(event){ ...@@ -111,4 +117,4 @@ function keyupEditAttention(event){
addEventListener('keydown', (event) => { addEventListener('keydown', (event) => {
keyupEditAttention(event); keyupEditAttention(event);
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment