Skip to content

176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.

fix: home page search endings, first keystroke and spaces in the address

matinf8325fd5409e
diff --git a/docs/superpowers/specs/2026-09-30-home-page-redesign-design.md b/docs/superpowers/specs/2026-09-30-home-page-redesign-design.md
index ee0c3f6d..44380e72 100644
--- a/docs/superpowers/specs/2026-09-30-home-page-redesign-design.md
+++ b/docs/superpowers/specs/2026-09-30-home-page-redesign-design.md
@@ -84,7 +84,9 @@ category's name in the form today's chips write it) opens All animations at that
Search looks at each animation's name, its one-line description, the names of its places and its category name. The
query is split into words; common small words are dropped (a, an, and, the, that, this, to, for, with, when, on, in,
of, my, it, i, want, make, some); each word is matched by its start, so "bounces", "bounce" and "bouncing" all match
-"bounce" (a word of four letters or more drops a final "s", "es", "ing" or "ed" before matching). An animation matches when at least one word matches;
+"bounce" (a typed word drops the first of the endings "ies", "ing", "ed", "es" and "s" that leaves three letters with a
+vowel, but not the last "s" of "ss"; after "ing" or "ed", a doubled last letter other than l, s, f or z loses one letter
+while three remain: "snapping" finds "snap", "ring" stays whole). An animation matches when at least one word matches;
results are ordered by how well they match (a word in the name counts 3, in a place name 2, in the description 1),
ties in home order. "a button that bounces when clicked" therefore puts Click / Tap Ripple, Bounce In and the other
button animations at the top.
diff --git a/index.html b/index.html
index f3ee77dd..8d844a8d 100644
--- a/index.html
+++ b/index.html
@@ -1734,8 +1734,18 @@ document.querySelectorAll('[data-count]').forEach(el=>{
// ---------- Views, search and the address ----------
const PAGE=8;
const STOP=new Set(['a','an','and','the','that','this','to','for','with','when','on','in','of','my','it','i','want','make','some']);
-const stem=w=>w.length>3?w.replace(/(ing|ed|es|s)$/,''):w;
-function queryWords(text){return [...new Set(wordsOf(text).filter(w=>!STOP.has(w)).map(stem).filter(w=>w.length>=2))];}
+// A typed word drops the first of these endings that leaves three letters with a vowel ("ring" stays whole), never the s of
+// "ss"; after "ing" or "ed" a doubled last letter other than l, s, f or z goes too while three stay (snapping → snap, added → add).
+function stem(w){
+ if(w.endsWith('ss'))return w;
+ for(const end of ['ies','ing','ed','es','s']){
+ const rest=w.slice(0,-end.length);
+ if(!w.endsWith(end)||rest.length<3||!/[aeiouy]/.test(rest))continue;
+ return (end==='ing'||end==='ed')&&rest.length>3&&/([bcdghjkmnpqrtvwx])\1$/.test(rest)?rest.slice(0,-1):rest;
+ }
+ return w;
+}
+function queryWords(text){return [...new Set(wordsOf(text).filter(w=>!STOP.has(w)).map(stem))];}
// A word counts 3 in the name, 2 in a place name, 1 in the description or category; each is matched by the start of a word.
function score(e,words){
let s=0;
@@ -1804,13 +1814,14 @@ function render(){
[q,q2].forEach(input=>{if(input!==document.activeElement&&input.value!==state.q)input.value=state.q;});
qClear.hidden=!q.value;
}
+// Spaces go in as %20, not +, as the spec shows; readURL() reads both.
function writeURL(push){
- const p=new URLSearchParams();
- if(state.q)p.set('q',state.q);
- else if(state.place)p.set('place',PLACE[state.place].url);
- else if(state.view)p.set('view','all');
- if(state.all&&(state.q||state.place))p.set('all','1');
- const url=p.toString()?'?'+p:location.pathname;
+ const p=[];
+ if(state.q)p.push('q='+encodeURIComponent(state.q));
+ else if(state.place)p.push('place='+PLACE[state.place].url);
+ else if(state.view)p.push('view=all');
+ if(state.all&&(state.q||state.place))p.push('all=1');
+ const url=p.length?'?'+p.join('&'):location.pathname;
history[push?'pushState':'replaceState'](null,'',url);
}
// Reads the view from the address. Returns the category of an old ?cat= link, to scroll to.