|
324 | 324 | padding: 9px 12px; |
325 | 325 | border-radius: 9px; |
326 | 326 | background: var(--surface); |
| 327 | + cursor: pointer; |
| 328 | + -webkit-tap-highlight-color: transparent; |
| 329 | + transition: background 0.1s; |
327 | 330 | } |
| 331 | + .word-item:active { background: var(--surface2); } |
328 | 332 | .word-item.top-item { |
329 | 333 | background: var(--surface2); |
330 | 334 | border: 1px solid var(--border); |
331 | 335 | } |
| 336 | + .word-item.top-item:active { background: var(--border); } |
332 | 337 | .word-rank { |
333 | 338 | font-family: 'IBM Plex Mono', monospace; |
334 | 339 | font-size: 11px; |
@@ -677,8 +682,20 @@ <h1>wdl·filter</h1> |
677 | 682 | } |
678 | 683 |
|
679 | 684 | // ───────────────────────────────────────────── |
680 | | -// RENDER |
| 685 | +// FILL WORD FROM RESULTS LIST |
681 | 686 | // ───────────────────────────────────────────── |
| 687 | +function fillWord(word) { |
| 688 | + currentWord = word; |
| 689 | + tileStates = ['_','_','_','_','_']; |
| 690 | + const inp = document.getElementById('word-input'); |
| 691 | + inp.value = word; |
| 692 | + renderTiles(); |
| 693 | + // Scroll input into view on mobile |
| 694 | + inp.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); |
| 695 | + inp.focus(); |
| 696 | +} |
| 697 | + |
| 698 | + |
682 | 699 | function renderAll() { |
683 | 700 | renderTiles(); |
684 | 701 | renderGuesses(); |
@@ -770,7 +787,7 @@ <h1>wdl·filter</h1> |
770 | 787 | if (guesses.length === 0) { |
771 | 788 | section.innerHTML = ` |
772 | 789 | <div class="empty-state"> |
773 | | - <p>Type a word, tap the tiles to set each letter's result,<br>then press <strong>Add guess</strong>.</p> |
| 790 | + <p>Type a word, tap the tiles to set each letter's result,<br>then press <strong>Add guess</strong>.<br><br>Tap any word in the results list to fill it in automatically.</p> |
774 | 791 | </div>`; |
775 | 792 | return; |
776 | 793 | } |
@@ -819,6 +836,7 @@ <h1>wdl·filter</h1> |
819 | 836 | ? '<span class="no-data">no data</span>' |
820 | 837 | : freq.toFixed(4)}</div> |
821 | 838 | </div>`; |
| 839 | + item.addEventListener('click', () => fillWord(word)); |
822 | 840 | listEl.appendChild(item); |
823 | 841 | }); |
824 | 842 |
|
@@ -910,4 +928,3 @@ <h1>wdl·filter</h1> |
910 | 928 | </script> |
911 | 929 | </body> |
912 | 930 | </html> |
913 | | - |
|
0 commit comments