diff --git a/src/Controller/KanjiController.php b/src/Controller/KanjiController.php index a968b2e..c2f61db 100644 --- a/src/Controller/KanjiController.php +++ b/src/Controller/KanjiController.php @@ -109,10 +109,23 @@ class KanjiController extends AbstractController ): Response { $charInfo = $this->getCharInfo(force: $request->isNoCache()); + $completedRows = []; + $completedFlag = true; $chars = []; foreach (range(intval("{$start}0", 16), intval("{$end}f", 16)) as $codepoint) { $charStr = mb_chr($codepoint, 'UTF-8'); + if ( + !key_exists('ignored', $charInfo[$charStr] ?? ['ignored' => 0]) + and !key_exists('unicode', $charInfo[$charStr] ?? []) + ) { + $completedFlag = false; + } + if (($codepoint + 1) % 0x10 === 0) { + if ($completedFlag === true) $completedRows[] = dechex($codepoint - 0xf); + $completedFlag = true; + } + $chars[] = [ 'str' => $charStr, 'codepoint' => dechex($codepoint), @@ -122,6 +135,7 @@ class KanjiController extends AbstractController return $this->render(self::tmpl('grid'), [ 'characters' => $chars, + 'completed' => $completedRows, ]); } diff --git a/templates/kanji/grid.html.twig b/templates/kanji/grid.html.twig index aff1275..bb8bfd6 100644 --- a/templates/kanji/grid.html.twig +++ b/templates/kanji/grid.html.twig @@ -42,7 +42,8 @@ .ebook { border-top: 3px solid deeppink !important; } .jimaku { border-top: 3px solid lightgray !important; } - .none, .ignored { opacity: 0.15; } + .none, .ignored { opacity: 0.15; } + .completed { background-color: rgba(0 255 0 / 0.05); }