pas d'infobulle sur les mots d'une lettre
This commit is contained in:
10
Grille.php
10
Grille.php
@@ -99,6 +99,7 @@ class Grille implements ArrayAccess
|
|||||||
"verticales" => []
|
"verticales" => []
|
||||||
];
|
];
|
||||||
foreach($this->lignes as $y => $mots) {
|
foreach($this->lignes as $y => $mots) {
|
||||||
|
$mots = explode_pos(CASE_NOIRE, $this->get_ligne($y, $this->largeur));
|
||||||
$this->definitions["horizontales"][$y] = [];
|
$this->definitions["horizontales"][$y] = [];
|
||||||
foreach($mots as $fin => $mot) {
|
foreach($mots as $fin => $mot) {
|
||||||
$definitions = $this->dico[strlen($mot)][$mot];
|
$definitions = $this->dico[strlen($mot)][$mot];
|
||||||
@@ -112,6 +113,7 @@ class Grille implements ArrayAccess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach($this->colonnes as $x => $mots) {
|
foreach($this->colonnes as $x => $mots) {
|
||||||
|
$mots = explode_pos(CASE_NOIRE, $this->get_colonne($x, $this->hauteur));
|
||||||
$this->definitions["verticales"][$x] = [];
|
$this->definitions["verticales"][$x] = [];
|
||||||
foreach($mots as $fin => $mot) {
|
foreach($mots as $fin => $mot) {
|
||||||
$definitions = $this->dico[strlen($mot)][$mot];
|
$definitions = $this->dico[strlen($mot)][$mot];
|
||||||
@@ -182,8 +184,8 @@ class Grille implements ArrayAccess
|
|||||||
|
|
||||||
// Omission des doublons
|
// Omission des doublons
|
||||||
$mots = [];
|
$mots = [];
|
||||||
if ($x == $this->largeur - 1) $mots = explode_pos(CASE_NOIRE, $this->get_ligne($y, $this->largeur));
|
if ($x == $this->largeur - 1) $mots = explode(CASE_NOIRE, $this->get_ligne($y, $this->largeur));
|
||||||
else if ($lettre == CASE_NOIRE) $mots = explode_pos(CASE_NOIRE, $this->get_ligne($y, $x));
|
else if ($lettre == CASE_NOIRE) $mots = explode(CASE_NOIRE, $this->get_ligne($y, $x));
|
||||||
else $mots = [];
|
else $mots = [];
|
||||||
$this->lignes[$y] = array_filter($mots, function ($mot) {
|
$this->lignes[$y] = array_filter($mots, function ($mot) {
|
||||||
return strlen($mot) >= 2;
|
return strlen($mot) >= 2;
|
||||||
@@ -195,9 +197,9 @@ class Grille implements ArrayAccess
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($y == $this->hauteur - 1) {
|
if ($y == $this->hauteur - 1) {
|
||||||
$mots = explode_pos(CASE_NOIRE, $this->get_colonne($x, $this->hauteur));
|
$mots = explode(CASE_NOIRE, $this->get_colonne($x, $this->hauteur));
|
||||||
foreach ($mots as $rang => $mot) {
|
foreach ($mots as $rang => $mot) {
|
||||||
//if (strlen($mot) < 2) continue;
|
if (strlen($mot) < 2) continue;
|
||||||
if (strlen($mot > 2) && in_array($mot, array_merge(...$this->lignes, ...$this->colonnes))) continue 2;
|
if (strlen($mot > 2) && in_array($mot, array_merge(...$this->lignes, ...$this->colonnes))) continue 2;
|
||||||
else $this->colonnes[$x][$rang] = $mot;
|
else $this->colonnes[$x][$rang] = $mot;
|
||||||
}
|
}
|
||||||
|
|||||||
12
index.php
12
index.php
@@ -145,14 +145,14 @@ function mot_courant($mots, $position) {
|
|||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<td class="case blanche">
|
<td class="case blanche">
|
||||||
<?php
|
<?php
|
||||||
$title = "";
|
$title = [];
|
||||||
$definition_horizontale = mot_courant($grille->definitions["horizontales"][$y], $x);
|
$definition_horizontale = mot_courant($grille->definitions["horizontales"][$y], $x);
|
||||||
$definition_verticale = mot_courant($grille->definitions["verticales"][$x], $y);
|
$definition_verticale = mot_courant($grille->definitions["verticales"][$x], $y);
|
||||||
if (isset($definition_horizontale[0])) $title .= "→ " . $definition_horizontale[0];
|
if (isset($definition_horizontale[0])) $title[0] = "→ " . $definition_horizontale[0];
|
||||||
if (isset($definition_horizontale[1])) $title .= " (" . $definition_horizontale[1] . ")";
|
if (isset($definition_horizontale[1])) $title[0] .= " (" . $definition_horizontale[1] . ")";
|
||||||
if (isset($definition_verticale[0])) $title .= "\n↓ " . $definition_verticale[0];
|
if (isset($definition_verticale[0])) $title[1] = "↓ " . $definition_verticale[0];
|
||||||
if (isset($definition_verticale[1])) $title .= " (" . $definition_verticale[1] . ")";
|
if (isset($definition_verticale[1])) $title[1] .= " (" . $definition_verticale[1] . ")";
|
||||||
$title = htmlspecialchars($title);
|
$title = htmlspecialchars(implode("\n", $title));
|
||||||
?>
|
?>
|
||||||
<input id="<?= chr($x + 65) . ($y + 1) ?>" type="text" maxlength="1" size="1" pattern="[A-Z]"
|
<input id="<?= chr($x + 65) . ($y + 1) ?>" type="text" maxlength="1" size="1" pattern="[A-Z]"
|
||||||
title="<?=$title?>" />
|
title="<?=$title?>" />
|
||||||
|
|||||||
Reference in New Issue
Block a user