javascript
This commit is contained in:
parent
a77942768a
commit
96f530746a
1 changed files with 28 additions and 0 deletions
28
index.html
28
index.html
|
@ -187,6 +187,33 @@
|
||||||
haram.setUp()
|
haram.setUp()
|
||||||
document.getElementById('edit').addEventListener('click', () => {
|
document.getElementById('edit').addEventListener('click', () => {
|
||||||
if (haram.editMode === true) {
|
if (haram.editMode === true) {
|
||||||
|
haram.harams = [];
|
||||||
|
document.querySelectorAll('tr').forEach((trNode) => {
|
||||||
|
const labelNode = trNode.querySelector('input[type="text"]')
|
||||||
|
if (labelNode == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const pointsNode = trNode.querySelector('input[type="number"]')
|
||||||
|
if (pointsNode == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pointsNode.value < 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (labelNode.value === '') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const newHaram = {
|
||||||
|
points: pointsNode.value,
|
||||||
|
label: labelNode.value,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (haram.harams.some((item) => item.label == newHaram.label)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
haram.harams.push(newHaram)
|
||||||
|
})
|
||||||
haram.setUp()
|
haram.setUp()
|
||||||
const jsonString = JSON.stringify(haram.harams)
|
const jsonString = JSON.stringify(haram.harams)
|
||||||
const encoded = btoa(jsonString)
|
const encoded = btoa(jsonString)
|
||||||
|
@ -198,6 +225,7 @@
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
haram.edit()
|
haram.edit()
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
Loading…
Add table
Reference in a new issue