fix area on showDuplicates
This commit is contained in:
parent
80bc9f083d
commit
77886a6878
13
sudoku.js
13
sudoku.js
@ -130,8 +130,9 @@ function searchCandidatesOf(box) {
|
|||||||
|
|
||||||
function onfocus() {
|
function onfocus() {
|
||||||
if (pencilRadio.checked) {
|
if (pencilRadio.checked) {
|
||||||
//this.type = "text"
|
this.type = "text"
|
||||||
this.value = this.placeholder
|
this.value = this.placeholder
|
||||||
|
this.placeholder = ""
|
||||||
this.classList.add("pencil")
|
this.classList.add("pencil")
|
||||||
} else {
|
} else {
|
||||||
this.select()
|
this.select()
|
||||||
@ -185,7 +186,7 @@ function checkBox(box) {
|
|||||||
}))
|
}))
|
||||||
for (neighbour of area)
|
for (neighbour of area)
|
||||||
if (box != neighbour)
|
if (box != neighbour)
|
||||||
showDuplicates(areaName, box, neighbour)
|
showDuplicates(area, areaName, box, neighbour)
|
||||||
}
|
}
|
||||||
|
|
||||||
checkSuccess()
|
checkSuccess()
|
||||||
@ -200,7 +201,7 @@ function checkBoxes() {
|
|||||||
colonne: columns,
|
colonne: columns,
|
||||||
}))
|
}))
|
||||||
for (area of areas)
|
for (area of areas)
|
||||||
area.filter(box => box.value).sort(showDuplicates.bind(null, areaName))
|
area.filter(box => box.value).sort(showDuplicates.bind(null, area, areaName))
|
||||||
|
|
||||||
checkSuccess()
|
checkSuccess()
|
||||||
}
|
}
|
||||||
@ -218,7 +219,7 @@ function checkCandidates(area) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDuplicates(areaName, box, neighbour) {
|
function showDuplicates(area, areaName, box, neighbour) {
|
||||||
if(box.value == neighbour.value) {
|
if(box.value == neighbour.value) {
|
||||||
area.forEach(neighbour => neighbour.parentElement.classList.add("table-danger"))
|
area.forEach(neighbour => neighbour.parentElement.classList.add("table-danger"))
|
||||||
for (neighbour of [box, neighbour]) {
|
for (neighbour of [box, neighbour]) {
|
||||||
@ -294,7 +295,7 @@ function onblur() {
|
|||||||
if (this.classList.contains("pencil")) {
|
if (this.classList.contains("pencil")) {
|
||||||
this.placeholder = this.value
|
this.placeholder = this.value
|
||||||
this.value = ""
|
this.value = ""
|
||||||
//this.type = "number"
|
this.type = "number"
|
||||||
this.classList.remove("pencil")
|
this.classList.remove("pencil")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user