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