Auto-focus input after adding new row
This commit is contained in:
parent
e4862b60ad
commit
b04d4b12df
Binary file not shown.
14
package.json
14
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "dice",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16",
|
||||
"description": "Calculates the probability of rolling a value given a combination of dice.",
|
||||
"author": "F.W. Dekker",
|
||||
"browser": "dist/bundle.js",
|
||||
|
@ -16,18 +16,18 @@
|
|||
"deploy": "grunt deploy"
|
||||
},
|
||||
"dependencies": {
|
||||
"chart.js": "^3.2.0"
|
||||
"chart.js": "^3.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "^1.4.0",
|
||||
"grunt-cli": "^1.4.2",
|
||||
"grunt": "^1.4.1",
|
||||
"grunt-cli": "^1.4.3",
|
||||
"grunt-contrib-clean": "^2.0.0",
|
||||
"grunt-contrib-copy": "^1.0.0",
|
||||
"grunt-contrib-watch": "^1.1.0",
|
||||
"grunt-focus": "^1.0.0",
|
||||
"grunt-text-replace": "^0.4.0",
|
||||
"grunt-webpack": "^4.0.3",
|
||||
"webpack": "^5.36.0",
|
||||
"webpack-cli": "^4.6.0"
|
||||
"grunt-webpack": "^5.0.0",
|
||||
"webpack": "^5.64.0",
|
||||
"webpack-cli": "^4.9.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,6 @@ inputTable.addDieRow = () => {
|
|||
if (e.key === "Enter")
|
||||
outputChart.updateProbGraph();
|
||||
});
|
||||
input.focus();
|
||||
return input;
|
||||
};
|
||||
|
||||
|
@ -122,6 +121,8 @@ inputTable.addDieRow = () => {
|
|||
row.insertCell().appendChild(createNumberInput(newIndex, "dieEyes", 6));
|
||||
row.insertCell().appendChild(createNumberInput(newIndex, "dieCount", 2));
|
||||
row.insertCell().appendChild(createRemoveLink(newIndex, "dieRemove"));
|
||||
|
||||
$("#dieEyes" + newIndex).focus();
|
||||
};
|
||||
|
||||
inputTable.removeDieRow = index => {
|
||||
|
@ -152,7 +153,7 @@ inputTable.getDice = () => {
|
|||
doAfterLoad(() => {
|
||||
const button = $("#addDieRowButton");
|
||||
button.onclick = inputTable.addDieRow;
|
||||
button.click()
|
||||
button.click();
|
||||
});
|
||||
|
||||
|
||||
|
@ -215,17 +216,7 @@ doAfterLoad(() => {
|
|||
probChart = new Chart($("#probChart").getContext("2d"), {
|
||||
type: "line",
|
||||
data: {},
|
||||
options: {
|
||||
fill: true,
|
||||
scales: {
|
||||
yAxes: [{
|
||||
display: true,
|
||||
ticks: {
|
||||
suggestedMin: 0
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
options: {fill: true},
|
||||
});
|
||||
|
||||
const submit = $("#submit");
|
||||
|
|
Loading…
Reference in New Issue