show number of candidates in tooltip
This commit is contained in:
parent
661a25638e
commit
0c79b4fd53
5
app.js
5
app.js
@ -38,8 +38,9 @@ window.onload = function() {
|
||||
box.neighbourhood = new Set(rows[box.rowId].concat(columns[box.columnId]).concat(regions[box.regionId]))
|
||||
box.neighbourhood.delete(box)
|
||||
box.neighbourhood = Array.from(box.neighbourhood)
|
||||
searchCandidatesOf(box)
|
||||
})
|
||||
boxes.forEach(searchCandidatesOf)
|
||||
|
||||
enableButtons()
|
||||
highlightAndTab()
|
||||
|
||||
@ -58,6 +59,8 @@ window.onload = function() {
|
||||
function searchCandidatesOf(box) {
|
||||
box.candidates = new Set(VALUES)
|
||||
box.neighbourhood.forEach(neighbour => box.candidates.delete(neighbour.value))
|
||||
if (!box.disabled)
|
||||
box.title = box.candidates.size + (box.candidates.size <= 1 ? " possibilité [Clic-droit]" : " possibilités [Clic-droit]")
|
||||
}
|
||||
|
||||
function onfocus() {
|
||||
|
18
game.php
18
game.php
@ -33,15 +33,19 @@
|
||||
<?php
|
||||
for ($column = 0; $column < 9; $column++) {
|
||||
$value = $gridStr[9*$row+$column];
|
||||
if ($value == UNKNOWN) {
|
||||
$value = "";
|
||||
$disabled = "";
|
||||
} else {
|
||||
$disabled = "disabled";
|
||||
}
|
||||
?>
|
||||
<td>
|
||||
<input type='number' min='1' max='9' step='1' value='<?=$value?>' title='Valeurs possibles [Clic-droit]' <?=$disabled?>/>
|
||||
<?php
|
||||
if ($value == UNKNOWN) {
|
||||
?>
|
||||
<input type='number' min='1' max='9' step='1' value='' title='Valeurs possibles [Clic-droit]'/>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<input type='number' min='1' max='9' step='1' value='<?=$value?>' disabled/>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user