Skip to content

Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.

NumPlay Studio: search the games

Mason363526d582ab2de
diff --git a/customize/app.css b/customize/app.css
index 25c02572..3e2713bb 100644
--- a/customize/app.css
+++ b/customize/app.css
@@ -49,6 +49,15 @@ main {
.title button { border: 0; padding: 0 0.04em 0.06em 0; background: none; font: inherit; letter-spacing: inherit; cursor: pointer; display: block; overflow: hidden; }
.title span { display: block; }
.chips { display: flex; gap: 8px; }
+.search {
+ grid-column: 1 / -1; margin-top: 14px; max-width: 360px; height: 42px; padding: 0 14px; border-radius: 21px;
+ background: var(--card); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); display: flex; align-items: center; gap: 9px;
+ color: var(--mute); cursor: text;
+}
+.search:focus-within { box-shadow: 0 0 0 3px var(--blue); }
+.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 15px; font-weight: 550; color: var(--ink); }
+.search input::placeholder { color: var(--mute); }
+.no-match { grid-column: 1 / -1; margin: 8px 0 0; font-size: 14px; color: var(--text); }
.lede { grid-column: 1 / -1; margin: 10px 0 0; max-width: 34em; font-size: 18px; line-height: 1.4; font-weight: 550; color: var(--ink); }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.row-head:first-child { margin-top: 0; }
diff --git a/customize/app.js b/customize/app.js
index 9b084f98..01dbe80d 100644
--- a/customize/app.js
+++ b/customize/app.js
@@ -1707,6 +1707,37 @@
box.classList.add('fit');
}
+ // ------------------------------------------------------------------ search
+ // A game shows when what's typed is in its name, its id or its initials ("fnaf", "hk", "pvz"), accents and
+ // punctuation aside. The grids keep their sizes; the others are only hidden
+ const plain = (t) => (t || '').normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
+ function search() {
+ const box = $('#search'), keys = new Map();
+ for (const [id, b] of buttons) {
+ const words = plain(byId[id].title).split(' ');
+ keys.set(b, [words.join(''), id, words.map((w) => (/^\d+$/.test(w) ? w : w[0])).join('')].join(' '));
+ }
+ const apply = () => {
+ const q = plain(box.value).replace(/ /g, '');
+ let n = 0;
+ for (const [b, k] of keys) { b.hidden = !!q && !k.includes(q); if (!b.hidden) n++; }
+ $('.games .row-head').hidden = ![...$('#small').children].some((b) => !b.hidden);
+ const none = $('#no-match');
+ none.hidden = !!n;
+ if (n) return;
+ none.textContent = 'No game called "' + box.value.trim() + '" yet. The ';
+ const a = none.appendChild(el('a', '', { href: 'https://github.com/Mason363/NumPlay#roadmap', target: '_blank', rel: 'noopener' }));
+ a.textContent = 'roadmap';
+ none.append(" has what's coming.");
+ };
+ box.addEventListener('input', apply);
+ box.addEventListener('keydown', (e) => { if (e.key === 'Escape' && box.value) { e.stopPropagation(); box.value = ''; apply(); } });
+ document.addEventListener('keydown', (e) => {
+ if (e.key === '/' && !e.target.closest('input, textarea, select') && !e.metaKey && !e.ctrlKey) { e.preventDefault(); box.focus(); }
+ });
+ apply();
+ }
+
// ------------------------------------------------------------------ start
async function start() {
try {
@@ -1750,6 +1781,7 @@
}
sortable(small);
sortable(big);
+ search();
fitGrid();
addEventListener('resize', () => requestAnimationFrame(fitGrid));
if (document.fonts) document.fonts.ready.then(fitGrid);
diff --git a/customize/index.html b/customize/index.html
index 0234911b..c98804f2 100644
--- a/customize/index.html
+++ b/customize/index.html
@@ -62,6 +62,11 @@
</button>
</div>
<p class="lede">Real games, rebuilt for the NumWorks. Choose yours and they go on your calculator as one app.</p>
+ <label class="search">
+ <svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><circle cx="7" cy="7" r="4.6" fill="none" stroke="currentColor" stroke-width="1.9"/><path d="M10.4 10.4l3.6 3.6" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/></svg>
+ <input id="search" type="search" placeholder="Search games" aria-label="Search games" autocomplete="off" spellcheck="false">
+ </label>
+ <p id="no-match" class="no-match" role="status" hidden></p>
</div>
<div class="games">